Fix: Initialize events discarded and packet lost counters to zero
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 11 Mar 2016 23:36:17 +0000 (18:36 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 11 Mar 2016 23:36:42 +0000 (18:36 -0500)
The runtime stats functions would only set the counter value
matching the current buffer-switching policy resulting in
uninitialized discarded event counts in "overwrite" mode, and
uninitialized lost packet counts in "discard" mode.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/ust-app.c

index 9a766e4ab68e628cbdec4d9f0432ec0b83dea547..987bb0e1cf3209eba995e68a0670d3efae5c4b51 100644 (file)
@@ -5945,9 +5945,11 @@ int ust_app_uid_get_channel_runtime_stats(uint64_t ust_session_id,
        if (overwrite) {
                ret = consumer_get_lost_packets(ust_session_id,
                                consumer_chan_key, consumer, lost);
        if (overwrite) {
                ret = consumer_get_lost_packets(ust_session_id,
                                consumer_chan_key, consumer, lost);
+               *discarded = 0;
        } else {
                ret = consumer_get_discarded_events(ust_session_id,
                                consumer_chan_key, consumer, discarded);
        } else {
                ret = consumer_get_discarded_events(ust_session_id,
                                consumer_chan_key, consumer, discarded);
+               *lost = 0;
        }
 
 end:
        }
 
 end:
@@ -5990,10 +5992,12 @@ int ust_app_pid_get_channel_runtime_stats(struct ltt_ust_session *usess,
                if (overwrite) {
                        ret = consumer_get_lost_packets(usess->id, ua_chan->key,
                                        consumer, lost);
                if (overwrite) {
                        ret = consumer_get_lost_packets(usess->id, ua_chan->key,
                                        consumer, lost);
+                       *discarded = 0;
                        goto end;
                } else {
                        ret = consumer_get_discarded_events(usess->id,
                                        ua_chan->key, consumer, discarded);
                        goto end;
                } else {
                        ret = consumer_get_discarded_events(usess->id,
                                        ua_chan->key, consumer, discarded);
+                       *lost = 0;
                        goto end;
                }
        }
                        goto end;
                }
        }
This page took 0.037491 seconds and 4 git commands to generate.