Linux Trace Kernel
 help / color / mirror / Atom feed
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 08/10] rtla/timerlat: Save the trace clock at measurement start
Date: Fri, 27 Nov 2026 16:32:04 +0100	[thread overview]
Message-ID: <20261127153206.134322-9-tglozar@redhat.com> (raw)
In-Reply-To: <20261127153206.134322-1-tglozar@redhat.com>

Save the measurement start reference after the warm-up and before any
instance starts tracing. The per-CPU clock is shared by all instances,
so the clock is read once and copied to the record and auto-analysis
instances.

Reading the reference before tracing is enabled avoids perturbing an
already running measurement, and keeping the read in the enable path
avoids re-reading it when tracing is restarted with --on-threshold
continue.

Signed-off-by: Tomas Glozar <tglozar@redhat.com>
---
 tools/tracing/rtla/src/timerlat.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tools/tracing/rtla/src/timerlat.c b/tools/tracing/rtla/src/timerlat.c
index 169aa9a6569d6..8ae8241978491 100644
--- a/tools/tracing/rtla/src/timerlat.c
+++ b/tools/tracing/rtla/src/timerlat.c
@@ -173,6 +173,20 @@ int timerlat_enable(struct osnoise_tool *tool)
 			return -1;
 	}
 
+	/*
+	 * Save the measurement start reference before any instance starts
+	 * tracing: the per-CPU clock is shared by all instances, so a single
+	 * reading is enough for all of them.
+	 */
+	if (!params->no_aa) {
+		if (trace_instance_save_start(&tool->trace,
+					      &params->common.monitored_cpus))
+			debug_msg("Could not read all the start timestamps\n");
+		if (tool->record)
+			trace_instance_copy_start(&tool->record->trace, &tool->trace);
+		trace_instance_copy_start(&tool->aa->trace, &tool->trace);
+	}
+
 	/*
 	 * Start the tracers here, after having set all instances.
 	 *
-- 
2.56.1


  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 ` Tomas Glozar [this message]
2026-11-27 15:32 ` [RFC PATCH 09/10] rtla/timerlat_aa: Print time offset and seqnum of the spike Tomas Glozar
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-9-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