]> Git Repo - linux.git/commitdiff
rtla: Add function to report missed events
authorTomas Glozar <[email protected]>
Thu, 23 Jan 2025 14:23:38 +0000 (15:23 +0100)
committerSteven Rostedt (Google) <[email protected]>
Fri, 24 Jan 2025 18:46:43 +0000 (13:46 -0500)
Add osnoise_report_missed_events to be used to report the number
of missed events either during or after an osnoise or timerlat run.
Also, display the percentage of missed events compared to the total
number of received events.

If an unknown number of missed events was reported during the run, the
entire number of missed events is reported as unknown.

Cc: John Kacur <[email protected]>
Cc: Luis Goncalves <[email protected]>
Cc: Gabriele Monaco <[email protected]>
Link: https://lore.kernel.org/[email protected]
Signed-off-by: Tomas Glozar <[email protected]>
Signed-off-by: Steven Rostedt (Google) <[email protected]>
tools/tracing/rtla/src/osnoise.c
tools/tracing/rtla/src/osnoise.h

index f521f052cbd32a5518296eb90e2c2840cc56f4db..85f398b89597a0f47b096e3df06a0805714d4b89 100644 (file)
@@ -1095,6 +1095,26 @@ bool osnoise_trace_is_off(struct osnoise_tool *tool, struct osnoise_tool *record
        return record && !tracefs_trace_is_on(record->trace.inst);
 }
 
+/*
+ * osnoise_report_missed_events - report number of events dropped by trace
+ * buffer
+ */
+void
+osnoise_report_missed_events(struct osnoise_tool *tool)
+{
+       unsigned long long total_events;
+
+       if (tool->trace.missed_events == UINT64_MAX)
+               printf("unknown number of events missed, results might not be accurate\n");
+       else if (tool->trace.missed_events > 0) {
+               total_events = tool->trace.processed_events + tool->trace.missed_events;
+
+               printf("%lld (%.2f%%) events missed, results might not be accurate\n",
+                      tool->trace.missed_events,
+                      (double) tool->trace.missed_events / total_events * 100.0);
+       }
+}
+
 static void osnoise_usage(int err)
 {
        int i;
index 1dc188baddef919047e0b2419ba900ec36916b64..91835a7d8c2b2b40ffafda6dab7d6053c25e1d02 100644 (file)
@@ -104,6 +104,7 @@ struct osnoise_tool {
 void osnoise_destroy_tool(struct osnoise_tool *top);
 struct osnoise_tool *osnoise_init_tool(char *tool_name);
 struct osnoise_tool *osnoise_init_trace_tool(char *tracer);
+void osnoise_report_missed_events(struct osnoise_tool *tool);
 bool osnoise_trace_is_off(struct osnoise_tool *tool, struct osnoise_tool *record);
 
 int osnoise_hist_main(int argc, char *argv[]);
This page took 0.053835 seconds and 4 git commands to generate.