Moved the logic for appending new options into guest trace file from tracecmd_write_guest_time_shift() to host_tsync_complete() context. The guest time shift may not be the only option to append, the right place for this logic is when the tracing session is completed. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@xxxxxxxxx> --- lib/trace-cmd/trace-timesync.c | 1 - tracecmd/trace-record.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/trace-cmd/trace-timesync.c b/lib/trace-cmd/trace-timesync.c index 5995551e..85a57f23 100644 --- a/lib/trace-cmd/trace-timesync.c +++ b/lib/trace-cmd/trace-timesync.c @@ -840,7 +840,6 @@ int tracecmd_write_guest_time_shift(struct tracecmd_output *handle, vector[5].iov_len = 8 * count; vector[5].iov_base = scalings; tracecmd_add_option_v(handle, TRACECMD_OPTION_TIME_SHIFT, vector, 6); - tracecmd_append_options(handle); #ifdef TSYNC_DEBUG if (count > 1) printf("Got %d timestamp synch samples in %lld ns trace\n\r", diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index 117e4f17..b064a1ff 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -681,6 +681,7 @@ static void host_tsync_complete(struct buffer_instance *instance) if (!handle) die("cannot create output handle"); tracecmd_write_guest_time_shift(handle, instance->tsync); + tracecmd_append_options(handle); tracecmd_output_close(handle); } -- 2.29.2