From: Tomas Glozar <tglozar@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
John Kacur <jkacur@redhat.com>,
Luis Goncalves <lgoncalv@redhat.com>,
Gabriele Monaco <gmonaco@redhat.com>,
Tomas Glozar <tglozar@redhat.com>
Subject: [PATCH 3/4] rtla: Add function to report missed events
Date: Thu, 23 Jan 2025 15:23:38 +0100 [thread overview]
Message-ID: <20250123142339.990300-4-tglozar@redhat.com> (raw)
In-Reply-To: <20250123142339.990300-1-tglozar@redhat.com>
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.
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
---
tools/tracing/rtla/src/osnoise.c | 20 ++++++++++++++++++++
tools/tracing/rtla/src/osnoise.h | 1 +
2 files changed, 21 insertions(+)
diff --git a/tools/tracing/rtla/src/osnoise.c b/tools/tracing/rtla/src/osnoise.c
index 245e9344932b..eede5e01bff6 100644
--- a/tools/tracing/rtla/src/osnoise.c
+++ b/tools/tracing/rtla/src/osnoise.c
@@ -1079,6 +1079,26 @@ struct osnoise_tool *osnoise_init_trace_tool(char *tracer)
return NULL;
}
+/*
+ * 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;
diff --git a/tools/tracing/rtla/src/osnoise.h b/tools/tracing/rtla/src/osnoise.h
index 555f4f4903cc..43e4b7bb7f4a 100644
--- a/tools/tracing/rtla/src/osnoise.h
+++ b/tools/tracing/rtla/src/osnoise.h
@@ -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);
int osnoise_hist_main(int argc, char *argv[]);
int osnoise_top_main(int argc, char **argv);
--
2.48.1
next prev parent reply other threads:[~2025-01-23 14:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-23 14:23 [PATCH 0/4] rtla: Collect and print number of " Tomas Glozar
2025-01-23 14:23 ` [PATCH 1/4] rtla: Count missed trace events Tomas Glozar
2025-01-23 14:23 ` [PATCH 2/4] rtla: Count all processed events Tomas Glozar
2025-01-23 14:23 ` Tomas Glozar [this message]
2025-01-23 14:23 ` [PATCH 4/4] rtla: Report missed event count Tomas Glozar
2025-01-24 9:24 ` Gabriele Monaco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250123142339.990300-4-tglozar@redhat.com \
--to=tglozar@redhat.com \
--cc=gmonaco@redhat.com \
--cc=jkacur@redhat.com \
--cc=lgoncalv@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®