X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fmi-lttng.c;h=5530acee9a1ce11e91aa2cef3e863ca385901a98;hp=72b0791527eddf25ba89fb1a7ed4b27197fc9101;hb=fb83fe64f250bec7416f18891a8264450c61ead3;hpb=53e367f936beb2f9a1f49f6a2920c2f58bcb08d7 diff --git a/src/common/mi-lttng.c b/src/common/mi-lttng.c index 72b079152..5530acee9 100644 --- a/src/common/mi-lttng.c +++ b/src/common/mi-lttng.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "mi-lttng.h" #include @@ -866,9 +867,22 @@ int mi_lttng_channel_attr(struct mi_writer *writer, struct lttng_channel_attr *attr) { int ret = 0; + struct lttng_channel *chan = caa_container_of(attr, + struct lttng_channel, attr); + uint64_t discarded_events, lost_packets; assert(attr); + ret = lttng_channel_get_discarded_event_count(chan, &discarded_events); + if (ret) { + goto end; + } + + ret = lttng_channel_get_lost_packet_count(chan, &lost_packets); + if (ret) { + goto end; + } + /* Opening Attributes */ ret = mi_lttng_writer_open_element(writer, config_element_attributes); if (ret) { @@ -947,6 +961,22 @@ int mi_lttng_channel_attr(struct mi_writer *writer, goto end; } + /* Discarded events */ + ret = mi_lttng_writer_write_element_unsigned_int(writer, + config_element_discarded_events, + discarded_events); + if (ret) { + goto end; + } + + /* Lost packets */ + ret = mi_lttng_writer_write_element_unsigned_int(writer, + config_element_lost_packets, + lost_packets); + if (ret) { + goto end; + } + /* Closing attributes */ ret = mi_lttng_writer_close_element(writer); if (ret) {