gprs_rlcmac_received_lost() in gprs_rlcmac_meas.cpp

Daniel Willmann dwillmann at
Mon Nov 18 15:56:23 UTC 2013

Hello Andreas,

while looking through the osmo-pcu code to figure out why some
connections stall we had some problems making sense of the elapsed time
calculations in gprs_rlcmac_meas.cpp.

Could you confirm/deny my assumptions about it or explain the idea
behind it?

> gettimeofday(&now_tv, NULL);
> elapsed = ((now_tv.tv_sec - loss_tv->tv_sec) << 7)
> 	+ ((now_tv.tv_usec - loss_tv->tv_usec) << 7) / 1000000;

I assume here you're calculating the duration of the measurement period
so far and since you want to have sub-second accuracy you multiply
everything with 128. Why 128?
Is it becasue it simplifies the throughput calculation?
(tbf->meas.dl_bw_octets/elapsed in gprs_rlcmac_dl_bw())

> if (elapsed < 128)
> 	return 0;

Is the intention here that the duration of the measurements is supposed
to be one second? So every second these measurements are printed out and

Daniel Willmann

- Daniel Willmann <dwillmann at>
* sysmocom - systems for mobile communications GmbH
* Schivelbeiner Str. 5
* 10439 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte

More information about the osmocom-net-gprs mailing list