Skip to content

Commit 57cf76e

Browse files
Daniel Bristot de Oliveirarostedt
authored andcommitted
rtla: Start the tracers after creating all instances
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 <[email protected]> Cc: Jonathan Corbet <[email protected]> Tested-by: Juri Lelli <[email protected]> Signed-off-by: Daniel Bristot de Oliveira <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 2091336 commit 57cf76e

File tree

4 files changed

+46
-17
lines changed

4 files changed

+46
-17
lines changed

tools/tracing/rtla/src/osnoise_hist.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -870,8 +870,6 @@ int osnoise_hist_main(int argc, char *argv[])
870870
}
871871
}
872872

873-
trace_instance_start(trace);
874-
875873
if (params->trace_output) {
876874
record = osnoise_init_trace_tool("osnoise");
877875
if (!record) {
@@ -885,9 +883,19 @@ int osnoise_hist_main(int argc, char *argv[])
885883
goto out_hist;
886884
}
887885

888-
trace_instance_start(&record->trace);
889886
}
890887

888+
/*
889+
* Start the tracer here, after having set all instances.
890+
*
891+
* Let the trace instance start first for the case of hitting a stop
892+
* tracing while enabling other instances. The trace instance is the
893+
* one with most valuable information.
894+
*/
895+
if (params->trace_output)
896+
trace_instance_start(&record->trace);
897+
trace_instance_start(trace);
898+
891899
tool->start_time = time(NULL);
892900
osnoise_hist_set_signals(params);
893901

tools/tracing/rtla/src/osnoise_top.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -697,8 +697,6 @@ int osnoise_top_main(int argc, char **argv)
697697
}
698698
}
699699

700-
trace_instance_start(trace);
701-
702700
if (params->trace_output) {
703701
record = osnoise_init_trace_tool("osnoise");
704702
if (!record) {
@@ -711,9 +709,18 @@ int osnoise_top_main(int argc, char **argv)
711709
if (retval)
712710
goto out_top;
713711
}
712+
}
714713

714+
/*
715+
* Start the tracer here, after having set all instances.
716+
*
717+
* Let the trace instance start first for the case of hitting a stop
718+
* tracing while enabling other instances. The trace instance is the
719+
* one with most valuable information.
720+
*/
721+
if (params->trace_output)
715722
trace_instance_start(&record->trace);
716-
}
723+
trace_instance_start(trace);
717724

718725
tool->start_time = time(NULL);
719726
osnoise_top_set_signals(params);

tools/tracing/rtla/src/timerlat_hist.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -922,8 +922,6 @@ int timerlat_hist_main(int argc, char *argv[])
922922
}
923923
}
924924

925-
trace_instance_start(trace);
926-
927925
if (params->trace_output) {
928926
record = osnoise_init_trace_tool("timerlat");
929927
if (!record) {
@@ -936,8 +934,6 @@ int timerlat_hist_main(int argc, char *argv[])
936934
if (retval)
937935
goto out_hist;
938936
}
939-
940-
trace_instance_start(&record->trace);
941937
}
942938

943939
if (!params->no_aa) {
@@ -956,9 +952,20 @@ int timerlat_hist_main(int argc, char *argv[])
956952
err_msg("Failed to enable timerlat tracer\n");
957953
goto out_hist;
958954
}
955+
}
959956

957+
/*
958+
* Start the tracers here, after having set all instances.
959+
*
960+
* Let the trace instance start first for the case of hitting a stop
961+
* tracing while enabling other instances. The trace instance is the
962+
* one with most valuable information.
963+
*/
964+
if (params->trace_output)
965+
trace_instance_start(&record->trace);
966+
if (!params->no_aa)
960967
trace_instance_start(&aa->trace);
961-
}
968+
trace_instance_start(trace);
962969

963970
tool->start_time = time(NULL);
964971
timerlat_hist_set_signals(params);

tools/tracing/rtla/src/timerlat_top.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,6 @@ int timerlat_top_main(int argc, char *argv[])
743743
}
744744
}
745745

746-
trace_instance_start(trace);
747-
748746
if (params->trace_output) {
749747
record = osnoise_init_trace_tool("timerlat");
750748
if (!record) {
@@ -757,8 +755,6 @@ int timerlat_top_main(int argc, char *argv[])
757755
if (retval)
758756
goto out_top;
759757
}
760-
761-
trace_instance_start(&record->trace);
762758
}
763759

764760
if (!params->no_aa) {
@@ -785,11 +781,22 @@ int timerlat_top_main(int argc, char *argv[])
785781
err_msg("Failed to enable timerlat tracer\n");
786782
goto out_top;
787783
}
788-
789-
trace_instance_start(&aa->trace);
790784
}
791785
}
792786

787+
/*
788+
* Start the tracers here, after having set all instances.
789+
*
790+
* Let the trace instance start first for the case of hitting a stop
791+
* tracing while enabling other instances. The trace instance is the
792+
* one with most valuable information.
793+
*/
794+
if (params->trace_output)
795+
trace_instance_start(&record->trace);
796+
if (!params->no_aa && aa != top)
797+
trace_instance_start(&aa->trace);
798+
trace_instance_start(trace);
799+
793800
top->start_time = time(NULL);
794801
timerlat_top_set_signals(params);
795802

0 commit comments

Comments
 (0)