All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] trace-cmd: Set user specified clock to all trace instances
@ 2021-05-07 17:26 Tzvetomir Stoyanov (VMware)
  0 siblings, 0 replies; only message in thread
From: Tzvetomir Stoyanov (VMware) @ 2021-05-07 17:26 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

If there is a user specified clock with "-C" option, apply it to all
trace instances, if there is no user clock for the instance. This
ensures that by default, all trace instances use the same trace clock.

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 tracecmd/trace-record.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 5dd8be4a..3014f560 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -2766,8 +2766,9 @@ void tracecmd_enable_events(void)
 	enable_events(first_instance);
 }
 
-static void set_clock(struct buffer_instance *instance)
+static void set_clock(struct common_record_context *ctx, struct buffer_instance *instance)
 {
+	const char *clock;
 	char *path;
 	char *content;
 	char *str;
@@ -2775,7 +2776,12 @@ static void set_clock(struct buffer_instance *instance)
 	if (is_guest(instance))
 		return;
 
-	if (!instance->clock)
+	if (instance->clock)
+		clock = instance->clock;
+	else
+		clock = ctx->clock;
+
+	if (!clock)
 		return;
 
 	/* The current clock is in brackets, reset it when we are done */
@@ -2798,7 +2804,7 @@ static void set_clock(struct buffer_instance *instance)
 	tracefs_put_tracing_file(path);
 
 	tracefs_instance_file_write(instance->tracefs,
-				    "trace_clock", instance->clock);
+				    "trace_clock", clock);
 }
 
 static void set_max_graph_depth(struct buffer_instance *instance, char *max_graph_depth)
@@ -6633,7 +6639,7 @@ static void record_trace(int argc, char **argv,
 		tracecmd_disable_all_tracing(1);
 
 	for_all_instances(instance)
-		set_clock(instance);
+		set_clock(ctx, instance);
 
 
 	/* Record records the date first */
-- 
2.31.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-07 17:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07 17:26 [PATCH] trace-cmd: Set user specified clock to all trace instances Tzvetomir Stoyanov (VMware)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.