kirr has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmocom-bb/+/40088?usp=email )
Change subject: trx_toolkit/data_msg: TODO random -> C
......................................................................
trx_toolkit/data_msg: TODO random -> C
With this patch I'm completing my optimization work on fake_trx. I have
not had time to convert random routines to C yet. In my testing I was
not activating any FakeTRX random modes at all and so lack of C random
support was not showing in the profiles. But if those random modes will
be activated py-level random will certainly slow things down. Add TODO
entries to fix that.
For the reference compared to the state where Cython was just introduced
in I2159a07bece13bda4f6ccd957063d4644d8b5e4f (trx_toolkit: Move
FakeTRX-related performance-sensitive modules to Cython) we now perform
significantly better: for 1 BTS + 2 ccch_scan fake_trx now takes ~ 25%
of CPU without clock overruns. While at that Pyx-base state it was
taking ~ 70% of CPU with frequent clock overruns.
Profiles at pyx-base and hereby state can be seen here:
http://navytux.spb.ru/~kirr/osmo/fake_trx/pyx-base.html
http://navytux.spb.ru/~kirr/osmo/fake_trx/pyx-optimized.html
and if comparing the effect of whole optimization work starting from
Ic9e16720daeb348b5f9c535c24a682db53a93529 parented on 54a0052a
(fake_trx: Remove unneeded field assignment) the effect is as follows:
Running 1 BTS + 2 Mobiles without Frequency Hopping + 1 ccch_scan
Before optimization work:
fake_trx is occupying 2 CPU cores loading every core close to
100% with hitting clock overrun non-stop.
After optimization work:
fake_Trx is occupying 1 CPU core with loading it ~ 35% by only
one thread without hitting any clock overrun.
Change-Id: If2c091c0a729a04dcac954ab0905b6f3be32a533
---
M src/target/trx_toolkit/data_msg.pyx
1 file changed, 12 insertions(+), 12 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/88/40088/1
diff --git a/src/target/trx_toolkit/data_msg.pyx b/src/target/trx_toolkit/data_msg.pyx
index bdc3119..d62dd63 100644
--- a/src/target/trx_toolkit/data_msg.pyx
+++ b/src/target/trx_toolkit/data_msg.pyx
@@ -131,11 +131,11 @@
def rand_fn(self):
''' Generate a random frame number. '''
- return random.randint(0, GSM_HYPERFRAME)
+ return random.randint(0, GSM_HYPERFRAME) # TODO -> C
def rand_tn(self):
''' Generate a random timeslot number. '''
- return random.randint(0, 7)
+ return random.randint(0, 7) # TODO -> C
def rand_hdr(self):
''' Randomize the message header. '''
@@ -393,7 +393,7 @@
if max is None:
max = PWR_MAX
- return random.randint(min, max)
+ return random.randint(min, max) # TODO -> C
def rand_hdr(self):
''' Randomize message specific header. '''
@@ -457,7 +457,7 @@
def rand_burst(self, length = GMSK_BURST_LEN):
''' Generate a random message specific burst. '''
- self.burst = bytearray([random.randint(0, 1) for _ in range(length)])
+ self.burst = bytearray([random.randint(0, 1) for _ in range(length)]) # TODO -> C
def trans(self, ver = None):
''' Transform this message into RxMsg. '''
@@ -625,7 +625,7 @@
if max is None:
max = RSSI_MAX
- return random.randint(min, max)
+ return random.randint(min, max) # TODO -> C
def rand_toa256(self, min = None, max = None):
''' Generate a random ToA (Time of Arrival) value. '''
@@ -636,7 +636,7 @@
if max is None:
max = TOA256_MAX
- return random.randint(min, max)
+ return random.randint(min, max) # TODO -> C
def rand_hdr(self):
''' Randomize message specific header. '''
@@ -646,15 +646,15 @@
self.toa256 = self.rand_toa256()
if self.ver >= 0x01:
- self.mod_type = random.choice(_mod_registry)
+ self.mod_type = random.choice(_mod_registry) # TODO -> C
if self.mod_type is ModGMSK:
- self.tsc_set = random.randint(0, 3)
+ self.tsc_set = random.randint(0, 3) # TODO -> C
else:
- self.tsc_set = random.randint(0, 1)
- self.tsc = random.randint(0, TSC_MAX)
+ self.tsc_set = random.randint(0, 1) # TODO -> C
+ self.tsc = random.randint(0, TSC_MAX) # TODO -> C
# C/I: Carrier-to-Interference ratio
- self.ci = random.randint(CI_MIN, CI_MAX)
+ self.ci = random.randint(CI_MIN, CI_MAX) # TODO -> C
def desc_hdr(self):
''' Generate human-readable header description. '''
@@ -815,7 +815,7 @@
if length is None:
length = self.mod_type.bl
- self.burst = array.array('b', [random.randint(-127, 127) for _ in
range(length)])
+ self.burst = array.array('b', [random.randint(-127, 127) for _ in
range(length)]) # TODO -> C
def trans(self, ver = None):
''' Transform this message to TxMsg. '''
--
To view, visit
https://gerrit.osmocom.org/c/osmocom-bb/+/40088?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: If2c091c0a729a04dcac954ab0905b6f3be32a533
Gerrit-Change-Number: 40088
Gerrit-PatchSet: 1
Gerrit-Owner: kirr <kirr(a)nexedi.com>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: osmith <osmith(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>