From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [PATCH] trace-cmd: Set user specified clock to all trace instances
Date: Fri, 7 May 2021 20:26:02 +0300 [thread overview]
Message-ID: <20210507172602.1253305-1-tz.stoyanov@gmail.com> (raw)
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
reply other threads:[~2021-05-07 17:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210507172602.1253305-1-tz.stoyanov@gmail.com \
--to=tz.stoyanov@gmail.com \
--cc=linux-trace-devel@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;
as well as URLs for NNTP newsgroup(s).