This is going to be useful for the upcoming feature that checks and
eventually displays the amount of lost packets/discarded events.

If we don't do that, more events might be lost/discarded between the
"lttng destroy" command and the time the trace is actually stopped.

Signed-off-by: Julien Desfossez <[email protected]>
---
 src/bin/lttng/commands/destroy.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/bin/lttng/commands/destroy.c b/src/bin/lttng/commands/destroy.c
index 53fe3ac..3a6e3ef 100644
--- a/src/bin/lttng/commands/destroy.c
+++ b/src/bin/lttng/commands/destroy.c
@@ -78,6 +78,13 @@ static int destroy_session(struct lttng_session *session)
        int ret;
        char *session_name = NULL;
 
+       ret = lttng_stop_tracing_no_wait(session->name);
+       if (ret < 0) {
+               if (ret != -LTTNG_ERR_TRACE_ALREADY_STOPPED) {
+                       ERR("%s", lttng_strerror(ret));
+               }
+       }
+
        ret = lttng_destroy_session(session->name);
        if (ret < 0) {
                switch (-ret) {
-- 
1.9.1


_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Reply via email to