@@ -57,6 +57,14 @@ static struct tsync_proto *tsync_proto_find(const char *proto_name)
return NULL;
}
+/**
+ * tracecmd_tsync_init - Initialize the global, per task, time sync data.
+ */
+void tracecmd_tsync_init(void)
+{
+
+}
+
int tracecmd_tsync_proto_register(const char *proto_name, int accuracy, int roles,
int supported_clocks, unsigned int flags,
int (*init)(struct tracecmd_time_sync *),
@@ -248,6 +248,8 @@ static void agent_serve(unsigned int port)
if (sd < 0)
die("Failed to open vsocket");
+ tracecmd_tsync_init();
+
if (!get_local_cid(&cid))
printf("listening on @%u:%u\n", cid, port);
@@ -6218,10 +6218,6 @@ static bool has_local_instances(void)
return false;
}
-/*
- * This function contains common code for the following commands:
- * record, start, stream, profile.
- */
static void record_trace(int argc, char **argv,
struct common_record_context *ctx)
{
@@ -6379,12 +6375,23 @@ static void record_trace(int argc, char **argv,
finalize_record_trace(ctx);
}
+/*
+ * This function contains common code for the following commands:
+ * record, start, stream, profile.
+ */
+static void record_trace_command(int argc, char **argv,
+ struct common_record_context *ctx)
+{
+ tracecmd_tsync_init();
+ record_trace(argc, argv, ctx);
+}
+
void trace_start(int argc, char **argv)
{
struct common_record_context ctx;
parse_record_options(argc, argv, CMD_start, &ctx);
- record_trace(argc, argv, &ctx);
+ record_trace_command(argc, argv, &ctx);
exit(0);
}
@@ -6476,7 +6483,7 @@ void trace_stream(int argc, char **argv)
struct common_record_context ctx;
parse_record_options(argc, argv, CMD_stream, &ctx);
- record_trace(argc, argv, &ctx);
+ record_trace_command(argc, argv, &ctx);
exit(0);
}
@@ -6495,7 +6502,7 @@ void trace_profile(int argc, char **argv)
if (!buffer_instances)
top_instance.flags |= BUFFER_FL_PROFILE;
- record_trace(argc, argv, &ctx);
+ record_trace_command(argc, argv, &ctx);
do_trace_profile();
exit(0);
}
@@ -6505,7 +6512,7 @@ void trace_record(int argc, char **argv)
struct common_record_context ctx;
parse_record_options(argc, argv, CMD_record, &ctx);
- record_trace(argc, argv, &ctx);
+ record_trace_command(argc, argv, &ctx);
exit(0);
}
A dummy empty function is added, will be used to initialize timestamp synchronization logic: tracecmd_tsync_init() When this code is implemented as real plugins, this function will be removed. Then the initializion will be triggered at plugin load time. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> --- lib/trace-cmd/trace-timesync.c | 8 ++++++++ tracecmd/trace-agent.c | 2 ++ tracecmd/trace-record.c | 23 +++++++++++++++-------- 3 files changed, 25 insertions(+), 8 deletions(-)