Skip to content

Commit 8ccd9d8

Browse files
lenticularis39rostedt
authored andcommitted
rtla: Add function to report missed events
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]>
1 parent 2aee44f commit 8ccd9d8

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

tools/tracing/rtla/src/osnoise.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,26 @@ bool osnoise_trace_is_off(struct osnoise_tool *tool, struct osnoise_tool *record
10951095
return record && !tracefs_trace_is_on(record->trace.inst);
10961096
}
10971097

1098+
/*
1099+
* osnoise_report_missed_events - report number of events dropped by trace
1100+
* buffer
1101+
*/
1102+
void
1103+
osnoise_report_missed_events(struct osnoise_tool *tool)
1104+
{
1105+
unsigned long long total_events;
1106+
1107+
if (tool->trace.missed_events == UINT64_MAX)
1108+
printf("unknown number of events missed, results might not be accurate\n");
1109+
else if (tool->trace.missed_events > 0) {
1110+
total_events = tool->trace.processed_events + tool->trace.missed_events;
1111+
1112+
printf("%lld (%.2f%%) events missed, results might not be accurate\n",
1113+
tool->trace.missed_events,
1114+
(double) tool->trace.missed_events / total_events * 100.0);
1115+
}
1116+
}
1117+
10981118
static void osnoise_usage(int err)
10991119
{
11001120
int i;

tools/tracing/rtla/src/osnoise.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ struct osnoise_tool {
104104
void osnoise_destroy_tool(struct osnoise_tool *top);
105105
struct osnoise_tool *osnoise_init_tool(char *tool_name);
106106
struct osnoise_tool *osnoise_init_trace_tool(char *tracer);
107+
void osnoise_report_missed_events(struct osnoise_tool *tool);
107108
bool osnoise_trace_is_off(struct osnoise_tool *tool, struct osnoise_tool *record);
108109

109110
int osnoise_hist_main(int argc, char *argv[]);

0 commit comments

Comments
 (0)