From 19e87d332f47acfa98f5c4a6646b3336008e45e7 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 28 Dec 2013 09:37:59 +0100 Subject: measurement: Speculative performance change Most timeslots do not have eight lchan. Use the subslots_per_lchan map to reduce the number of iterations. Looking at the ARM assembly showed that no loop-unrolling was done so this could be a speed up. --- src/common/measurement.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/common/measurement.c b/src/common/measurement.c index 774962d4..f32adda6 100644 --- a/src/common/measurement.c +++ b/src/common/measurement.c @@ -207,11 +207,24 @@ int lchan_build_rsl_ul_meas(struct gsm_lchan *lchan, uint8_t *buf) return 3; } +/* Copied from OpenBSC and enlarged to _GSM_PCHAN_MAX */ +static const uint8_t subslots_per_pchan[_GSM_PCHAN_MAX] = { + [GSM_PCHAN_NONE] = 0, + [GSM_PCHAN_CCCH] = 0, + [GSM_PCHAN_CCCH_SDCCH4] = 4, + [GSM_PCHAN_TCH_F] = 1, + [GSM_PCHAN_TCH_H] = 2, + [GSM_PCHAN_SDCCH8_SACCH8C] = 8, + /* FIXME: what about dynamic TCH_F_TCH_H ? */ + [GSM_PCHAN_TCH_F_PDCH] = 1, +}; + static int ts_meas_check_compute(struct gsm_bts_trx_ts *ts, uint32_t fn) { int i; + const int num_subslots = subslots_per_pchan[ts->pchan]; - for (i = 0; i < ARRAY_SIZE(ts->lchan); i++) { + for (i = 0; i < num_subslots; ++i) { struct gsm_lchan *lchan = &ts->lchan[i]; if (lchan->state != LCHAN_S_ACTIVE) -- cgit v1.2.3