diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-06-15 11:05:44 +0200 |
---|---|---|
committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-06-22 10:39:06 +0200 |
commit | 07eb655244bd973a9bdf69ef958ee06cf867a0bb (patch) | |
tree | b8755ad7d75edf67161f16560b702c0d31ba1c8c /src/llc.cpp | |
parent | 1eae96ca2fe1e23def798ea90645538a4e4193e5 (diff) |
llc: Keep track of the number of stored LLC octets
To get the number of LLC octets that are stored in the queue, this
commit adds a m_queue_octets member along with a octets() method.
This value is updated similarly to m_queue_size on each modifying
method call.
Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/llc.cpp')
-rw-r--r-- | src/llc.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/llc.cpp b/src/llc.cpp index d847c872..3388db1f 100644 --- a/src/llc.cpp +++ b/src/llc.cpp @@ -100,12 +100,14 @@ void gprs_llc_queue::init() { INIT_LLIST_HEAD(&m_queue); m_queue_size = 0; + m_queue_octets = 0; m_avg_queue_delay = 0; } void gprs_llc_queue::enqueue(struct msgb *llc_msg) { m_queue_size += 1; + m_queue_octets += msgb_length(llc_msg) - 2*sizeof(struct timeval); msgb_enqueue(&m_queue, llc_msg); } @@ -120,6 +122,7 @@ void gprs_llc_queue::clear(BTS *bts) } m_queue_size = 0; + m_queue_octets = 0; } #define ALPHA 0.5f @@ -136,6 +139,7 @@ struct msgb *gprs_llc_queue::dequeue() return NULL; m_queue_size -= 1; + m_queue_octets -= msgb_length(msg) - 2*sizeof(struct timeval); /* take the second time */ gettimeofday(&tv_now, NULL); |