X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Flist.c;h=8f07bb2da253e8de18c7aff280e5b472294f8112;hb=e50e81d3670e2420810ff62a036a7303b578e1e1;hp=1315783f34149721163cfdd125947e7dccb9bbb1;hpb=4fc83d948cea6b10484e65f004a6c167e71ac440;p=lttng-tools.git diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c index 1315783f3..8f07bb2da 100644 --- a/src/bin/lttng/commands/list.c +++ b/src/bin/lttng/commands/list.c @@ -57,6 +57,9 @@ enum { static struct lttng_handle *handle; static struct mi_writer *writer; +/* Only set when listing a single session. */ +static struct lttng_session listed_session; + static struct poptOption long_options[] = { /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */ {"help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0}, @@ -1173,6 +1176,7 @@ static void print_channel(struct lttng_channel *channel) { int ret; uint64_t discarded_events, lost_packets, monitor_timer_interval; + int64_t blocking_timeout; ret = lttng_channel_get_discarded_event_count(channel, &discarded_events); @@ -1195,19 +1199,25 @@ static void print_channel(struct lttng_channel *channel) return; } + ret = lttng_channel_get_blocking_timeout(channel, + &blocking_timeout); + if (ret) { + ERR("Failed to retrieve blocking timeout of channel"); + return; + } + MSG("- %s:%s\n", channel->name, enabled_string(channel->enabled)); MSG("%sAttributes:", indent4); MSG("%soverwrite mode: %d", indent6, channel->attr.overwrite); - MSG("%ssubbuffers size: %" PRIu64, indent6, channel->attr.subbuf_size); + MSG("%ssubbuffers size: %" PRIu64 " bytes", indent6, channel->attr.subbuf_size); MSG("%snumber of subbuffers: %" PRIu64, indent6, channel->attr.num_subbuf); - MSG("%sswitch timer interval: %u", indent6, channel->attr.switch_timer_interval); - MSG("%sread timer interval: %u", indent6, channel->attr.read_timer_interval); - MSG("%smonitor timer interval: %" PRIu64, indent6, monitor_timer_interval); + MSG("%sswitch timer interval: %u µs", indent6, channel->attr.switch_timer_interval); + MSG("%sread timer interval: %u µs", indent6, channel->attr.read_timer_interval); + MSG("%smonitor timer interval: %" PRIu64 " µs", indent6, monitor_timer_interval); + MSG("%sblocking timeout: %" PRId64 " µs", indent6, blocking_timeout); MSG("%strace file count: %" PRIu64, indent6, channel->attr.tracefile_count); - MSG("%strace file size (bytes): %" PRIu64, indent6, channel->attr.tracefile_size); - MSG("%sdiscarded events: %" PRIu64, indent6, discarded_events); - MSG("%slost packets: %" PRIu64, indent6, lost_packets); + MSG("%strace file size: %" PRIu64 " bytes", indent6, channel->attr.tracefile_size); switch (channel->attr.output) { case LTTNG_EVENT_SPLICE: MSG("%soutput: splice()", indent6); @@ -1216,6 +1226,31 @@ static void print_channel(struct lttng_channel *channel) MSG("%soutput: mmap()", indent6); break; } + + if (!listed_session.snapshot_mode) { + /* + * The lost packet count is omitted for sessions in snapshot + * mode as it is misleading: it would indicate the number of + * packets that the consumer could not extract during the + * course of recording the snapshot. It does not have the + * same meaning as the "regular" lost packet count that + * would result from the consumer not keeping up with + * event production in an overwrite-mode channel. + * + * A more interesting statistic would be the number of + * packets lost between the first and last extracted + * packets of a given snapshot (which prevents most analyses). + */ + goto skip_stats_printing; + } + + if (!channel->attr.overwrite) { + MSG("%sdiscarded events: %" PRIu64, indent6, discarded_events); + } else { + MSG("%slost packets: %" PRIu64, indent6, lost_packets); + } +skip_stats_printing: + return; } /* @@ -1575,6 +1610,8 @@ static int list_sessions(const char *session_name) active_string(sessions[i].enabled), snapshot_string(sessions[i].snapshot_mode)); MSG("%sTrace path: %s\n", indent4, sessions[i].path); + memcpy(&listed_session, &sessions[i], + sizeof(listed_session)); break; } } else { @@ -1584,7 +1621,7 @@ static int list_sessions(const char *session_name) snapshot_string(sessions[i].snapshot_mode)); MSG("%sTrace path: %s", indent4, sessions[i].path); if (sessions[i].live_timer_interval != 0) { - MSG("%sLive timer interval (usec): %u", indent4, + MSG("%sLive timer interval: %u µs", indent4, sessions[i].live_timer_interval); } MSG("");