From: Tomas Glozar <tglozar@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>, Tomas Glozar <tglozar@redhat.com>
Cc: John Kacur <jkacur@redhat.com>,
Luis Goncalves <lgoncalv@redhat.com>,
Crystal Wood <crwood@redhat.com>,
Costa Shulyupin <costa.shul@redhat.com>,
Wander Lairson Costa <wander@redhat.com>,
linux-trace-kernel <linux-trace-kernel@vger.kernel.org>
Subject: [RFC PATCH 09/10] rtla/timerlat_aa: Print time offset and seqnum of the spike
Date: Fri, 27 Nov 2026 16:32:05 +0100 [thread overview]
Message-ID: <20261127153206.134322-10-tglozar@redhat.com> (raw)
In-Reply-To: <20261127153206.134322-1-tglozar@redhat.com>
Print the time elapsed since the beginning of the measurement, taken from
the triggering sample, and the sequence number of that sample in the
latency spike header.
This makes it possible to tell multiple spikes apart, which is useful
when tracing is not stopped on the first occurrence, for example with
--on-threshold continue.
The time is printed as days, hours, minutes, seconds and milliseconds,
prefixed to the existing header. If the start reference is not available,
the header keeps its previous format, with the sequence number appended.
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
---
tools/tracing/rtla/src/timerlat_aa.c | 42 ++++++++++++++++++++++++----
1 file changed, 37 insertions(+), 5 deletions(-)
diff --git a/tools/tracing/rtla/src/timerlat_aa.c b/tools/tracing/rtla/src/timerlat_aa.c
index 11ddceab208ac..3c9b86e2f40cc 100644
--- a/tools/tracing/rtla/src/timerlat_aa.c
+++ b/tools/tracing/rtla/src/timerlat_aa.c
@@ -570,14 +570,30 @@ static int timerlat_aa_kworker_start_handler(struct trace_seq *s, struct tep_rec
return 0;
}
+/*
+ * timerlat_aa_format_elapsed - format a duration as days/hours/min/sec
+ */
+static void timerlat_aa_format_elapsed(unsigned long long ns, char *buf,
+ size_t len)
+{
+ unsigned long long sec = ns / 1000000000ULL;
+
+ snprintf(buf, len, "%3llud %02llu:%02llu:%02llu.%03llu",
+ sec / 86400, sec / 3600 % 24, sec / 60 % 60, sec % 60,
+ ns / 1000000 % 1000);
+}
+
/*
* timerlat_thread_analysis - Prints the analysis of a CPU that hit a stop tracing
*
* This is the core of the analysis.
*/
static void timerlat_thread_analysis(struct timerlat_aa_data *taa_data, int cpu,
- int irq_thresh, int thread_thresh)
+ int irq_thresh, int thread_thresh,
+ unsigned long long start_ts)
{
+ unsigned long long seqnum, tstamp;
+ char elapsed[32];
long long exp_irq_ts;
int total;
int irq;
@@ -588,9 +604,23 @@ static void timerlat_thread_analysis(struct timerlat_aa_data *taa_data, int cpu,
if (taa_data->tlat_irq_seqnum > taa_data->tlat_thread_seqnum) {
irq = 1;
total = taa_data->tlat_irq_latency;
+ tstamp = taa_data->tlat_irq_timstamp;
+ seqnum = taa_data->tlat_irq_seqnum;
} else {
irq = 0;
total = taa_data->tlat_thread_latency;
+ tstamp = taa_data->tlat_thread_timstamp;
+ seqnum = taa_data->tlat_thread_seqnum;
+ }
+
+ if (start_ts && tstamp >= start_ts) {
+ timerlat_aa_format_elapsed(tstamp - start_ts, elapsed,
+ sizeof(elapsed));
+ printf("[%s] ## CPU %d hit stop tracing, analyzing it ## (seqnum %llu)\n",
+ elapsed, cpu, seqnum);
+ } else {
+ printf("## CPU %d hit stop tracing, analyzing it ## (seqnum %llu)\n",
+ cpu, seqnum);
}
/*
@@ -829,11 +859,13 @@ void timerlat_auto_analysis(int irq_thresh, int thread_thresh)
taa_data = timerlat_aa_get_data(taa_ctx, cpu);
if (irq_thresh && taa_data->tlat_irq_latency >= irq_thresh) {
- printf("## CPU %d hit stop tracing, analyzing it ##\n", cpu);
- timerlat_thread_analysis(taa_data, cpu, irq_thresh, thread_thresh);
+ timerlat_thread_analysis(taa_data, cpu, irq_thresh,
+ thread_thresh,
+ taa_ctx->tool->trace.start_ts[cpu]);
} else if (thread_thresh && (taa_data->tlat_thread_latency) >= thread_thresh) {
- printf("## CPU %d hit stop tracing, analyzing it ##\n", cpu);
- timerlat_thread_analysis(taa_data, cpu, irq_thresh, thread_thresh);
+ timerlat_thread_analysis(taa_data, cpu, irq_thresh,
+ thread_thresh,
+ taa_ctx->tool->trace.start_ts[cpu]);
}
if (taa_data->max_exit_idle_latency > max_exit_from_idle) {
--
2.56.1
next prev parent reply other threads:[~2026-11-27 15:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 15:31 [RFC PATCH 00/10] rtla/timerlat: Add auto-analysis action and report spike timestamps Tomas Glozar
2026-11-27 15:31 ` [RFC PATCH 01/10] rtla: Support auto-analysis as an action Tomas Glozar
2026-11-27 15:31 ` [RFC PATCH 02/10] rtla/tests: Add unit tests for aa action Tomas Glozar
2026-11-27 15:31 ` [RFC PATCH 03/10] rtla/tests: Add runtime " Tomas Glozar
2026-11-27 15:32 ` [RFC PATCH 04/10] Documentation/rtla: Document " Tomas Glozar
2026-11-27 15:32 ` [RFC PATCH 05/10] rtla/trace: Add helper to read "now ts" stats field Tomas Glozar
2026-11-27 15:32 ` [RFC PATCH 06/10] rtla/trace: Add helper to gather "now ts" over a CPU set Tomas Glozar
2026-11-27 15:32 ` [RFC PATCH 07/10] rtla/trace: Allow storing start clock value of tracefs instances Tomas Glozar
2026-11-27 15:32 ` [RFC PATCH 08/10] rtla/timerlat: Save the trace clock at measurement start Tomas Glozar
2026-11-27 15:32 ` Tomas Glozar [this message]
2026-11-27 15:32 ` [RFC PATCH 10/10] Documentation/rtla: Document auto-analysis timestamps Tomas Glozar
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=20261127153206.134322-10-tglozar@redhat.com \
--to=tglozar@redhat.com \
--cc=costa.shul@redhat.com \
--cc=crwood@redhat.com \
--cc=jkacur@redhat.com \
--cc=lgoncalv@redhat.com \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=wander@redhat.com \
/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