rtla: Start the tracers after creating all instances
authorDaniel Bristot de Oliveira <bristot@kernel.org>
Tue, 6 Jun 2023 16:12:21 +0000 (18:12 +0200)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 13 Jun 2023 20:37:05 +0000 (16:37 -0400)
Group all start tracing after finishing creating all instances.

The tracing instance starts first for the case of hitting a stop
tracing while enabling other instances. The trace instance is the
one with most valuable information.

Link: https://lkml.kernel.org/r/67da7a703a56f75d7cd46568525145a65501a7e8.1686066600.git.bristot@kernel.org
Cc: William White <chwhite@redhat.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Tested-by: Juri Lelli <juri.lelli@redhat.com>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
tools/tracing/rtla/src/osnoise_hist.c
tools/tracing/rtla/src/osnoise_top.c
tools/tracing/rtla/src/timerlat_hist.c
tools/tracing/rtla/src/timerlat_top.c

index dfbcb5ca7ecbc999028b622899f80d986e8e8a12..8f81fa007364890dd4303b047c484786a56390f2 100644 (file)
@@ -870,8 +870,6 @@ int osnoise_hist_main(int argc, char *argv[])
                }
        }
 
-       trace_instance_start(trace);
-
        if (params->trace_output) {
                record = osnoise_init_trace_tool("osnoise");
                if (!record) {
@@ -885,9 +883,19 @@ int osnoise_hist_main(int argc, char *argv[])
                                goto out_hist;
                }
 
-               trace_instance_start(&record->trace);
        }
 
+       /*
+        * Start the tracer here, after having set all instances.
+        *
+        * Let the trace instance start first for the case of hitting a stop
+        * tracing while enabling other instances. The trace instance is the
+        * one with most valuable information.
+        */
+       if (params->trace_output)
+               trace_instance_start(&record->trace);
+       trace_instance_start(trace);
+
        tool->start_time = time(NULL);
        osnoise_hist_set_signals(params);
 
index 0833537bb2eb9dfd53c2166c7bf82e780f902495..85abba568fafd0004aac1e63e35f4d757944c0bd 100644 (file)
@@ -697,8 +697,6 @@ int osnoise_top_main(int argc, char **argv)
                }
        }
 
-       trace_instance_start(trace);
-
        if (params->trace_output) {
                record = osnoise_init_trace_tool("osnoise");
                if (!record) {
@@ -711,9 +709,18 @@ int osnoise_top_main(int argc, char **argv)
                        if (retval)
                                goto out_top;
                }
+       }
 
+       /*
+        * Start the tracer here, after having set all instances.
+        *
+        * Let the trace instance start first for the case of hitting a stop
+        * tracing while enabling other instances. The trace instance is the
+        * one with most valuable information.
+        */
+       if (params->trace_output)
                trace_instance_start(&record->trace);
-       }
+       trace_instance_start(trace);
 
        tool->start_time = time(NULL);
        osnoise_top_set_signals(params);
index e720c890890677c2fb814f2bac98b46ca767c41e..f431cf43246c4245bb1dfd631fb546d68dc781e5 100644 (file)
@@ -922,8 +922,6 @@ int timerlat_hist_main(int argc, char *argv[])
                }
        }
 
-       trace_instance_start(trace);
-
        if (params->trace_output) {
                record = osnoise_init_trace_tool("timerlat");
                if (!record) {
@@ -936,8 +934,6 @@ int timerlat_hist_main(int argc, char *argv[])
                        if (retval)
                                goto out_hist;
                }
-
-               trace_instance_start(&record->trace);
        }
 
        if (!params->no_aa) {
@@ -956,9 +952,20 @@ int timerlat_hist_main(int argc, char *argv[])
                        err_msg("Failed to enable timerlat tracer\n");
                        goto out_hist;
                }
+       }
 
+       /*
+        * Start the tracers here, after having set all instances.
+        *
+        * Let the trace instance start first for the case of hitting a stop
+        * tracing while enabling other instances. The trace instance is the
+        * one with most valuable information.
+        */
+       if (params->trace_output)
+               trace_instance_start(&record->trace);
+       if (!params->no_aa)
                trace_instance_start(&aa->trace);
-       }
+       trace_instance_start(trace);
 
        tool->start_time = time(NULL);
        timerlat_hist_set_signals(params);
index d6b5a382569ec64a771fa617b0139678c5d79654..02cff4948981a7f92e83995c03d75ac34dc0a168 100644 (file)
@@ -743,8 +743,6 @@ int timerlat_top_main(int argc, char *argv[])
                }
        }
 
-       trace_instance_start(trace);
-
        if (params->trace_output) {
                record = osnoise_init_trace_tool("timerlat");
                if (!record) {
@@ -757,8 +755,6 @@ int timerlat_top_main(int argc, char *argv[])
                        if (retval)
                                goto out_top;
                }
-
-               trace_instance_start(&record->trace);
        }
 
        if (!params->no_aa) {
@@ -785,11 +781,22 @@ int timerlat_top_main(int argc, char *argv[])
                                err_msg("Failed to enable timerlat tracer\n");
                                goto out_top;
                        }
-
-                       trace_instance_start(&aa->trace);
                }
        }
 
+       /*
+        * Start the tracers here, after having set all instances.
+        *
+        * Let the trace instance start first for the case of hitting a stop
+        * tracing while enabling other instances. The trace instance is the
+        * one with most valuable information.
+        */
+       if (params->trace_output)
+               trace_instance_start(&record->trace);
+       if (!params->no_aa && aa != top)
+               trace_instance_start(&aa->trace);
+       trace_instance_start(trace);
+
        top->start_time = time(NULL);
        timerlat_top_set_signals(params);