osmux: add statistics to osmux_in_handle struct

Add statistics to the osmux input handle, which translates the RTP
messages to osmux batch.
This commit is contained in:
Pablo Neira Ayuso 2014-08-28 16:14:16 +02:00
parent 7a990e8e53
commit 843c23098a
2 changed files with 15 additions and 0 deletions

View File

@ -45,6 +45,14 @@ struct osmux_in_handle {
uint8_t osmux_seq;
uint8_t batch_factor;
uint16_t batch_size;
struct {
uint32_t input_rtp_msgs;
uint32_t output_osmux_msgs;
uint64_t input_rtp_bytes;
uint64_t output_osmux_bytes;
} stats;
void (*deliver)(struct msgb *msg, void *data);
void *data;
char *internal_data; /* internal data to store batch */

View File

@ -327,6 +327,10 @@ void osmux_xfrm_input_deliver(struct osmux_in_handle *h)
LOGP(DLMIB, LOGL_DEBUG, "invoking delivery function\n");
batch_msg = osmux_build_batch(h);
h->stats.output_osmux_msgs++;
h->stats.output_osmux_bytes += batch_msg->len;
h->deliver(batch_msg, h->data);
osmo_timer_del(&batch->timer);
batch->remaining_bytes = h->batch_size;
@ -536,6 +540,9 @@ int osmux_xfrm_input(struct osmux_in_handle *h, struct msgb *msg, int ccid)
if (ret < 0)
return 0;
h->stats.input_rtp_msgs++;
h->stats.input_rtp_bytes += msg->len;
if (first_rtp_msg) {
LOGP(DLMIB, LOGL_DEBUG,
"osmux start timer batch\n");