Display discarded and lost events at destroy and stop
[lttng-tools.git] / src / bin / lttng / commands / destroy.c
index 87231858f96ded25cb05c189b1c0464dc2f09c3f..ad181d7c4343b72182269556bf689d593bd21d4d 100644 (file)
@@ -23,6 +23,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
+#include <stdbool.h>
 
 #include "../command.h"
 
@@ -79,11 +80,13 @@ static int destroy_session(struct lttng_session *session)
 {
        int ret;
        char *session_name = NULL;
+       bool session_was_stopped;
 
        ret = lttng_stop_tracing_no_wait(session->name);
        if (ret < 0 && ret != -LTTNG_ERR_TRACE_ALREADY_STOPPED) {
                ERR("%s", lttng_strerror(ret));
        }
+       session_was_stopped = ret == -LTTNG_ERR_TRACE_ALREADY_STOPPED;
        if (!opt_no_wait) {
                _MSG("Waiting for data availability");
                fflush(stdout);
@@ -106,6 +109,13 @@ static int destroy_session(struct lttng_session *session)
                } while (ret != 0);
                MSG("");
        }
+       if (!session_was_stopped) {
+               /*
+                * Don't print the event and packet loss warnings since the user
+                * already saw them when stopping the trace.
+                */
+               print_session_stats(session->name);
+       }
 
        ret = lttng_destroy_session_no_wait(session->name);
        if (ret < 0) {
This page took 0.02358 seconds and 4 git commands to generate.