The tracecmd_time_sync struct holds the timestamp synchronization context, used by the timestamp synchronization plugins. Guest CPU count and PID of the host task, running the guest, is important information which may be needed by the plugins. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@xxxxxxxxx> --- include/trace-cmd/trace-cmd.h | 4 ++++ tracecmd/trace-tsync.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/trace-cmd/trace-cmd.h b/include/trace-cmd/trace-cmd.h index 1ca2da10..9629d074 100644 --- a/include/trace-cmd/trace-cmd.h +++ b/include/trace-cmd/trace-cmd.h @@ -450,6 +450,10 @@ struct tracecmd_time_sync { char *clock_str; struct tracecmd_msg_handle *msg_handle; void *context; + + int guest_pid; + int vcpu_count; + }; void tracecmd_tsync_init(void); diff --git a/tracecmd/trace-tsync.c b/tracecmd/trace-tsync.c index aede3754..bc5c744e 100644 --- a/tracecmd/trace-tsync.c +++ b/tracecmd/trace-tsync.c @@ -77,6 +77,7 @@ int tracecmd_host_tsync(struct buffer_instance *instance, { struct tracecmd_msg_handle *msg_handle = NULL; cpu_set_t *pin_mask = NULL; + struct trace_guest *guest; pthread_attr_t attrib; size_t mask_size = 0; int ret; @@ -84,7 +85,11 @@ int tracecmd_host_tsync(struct buffer_instance *instance, if (!instance->tsync.proto_name) return -1; - + guest = get_guest_by_cid(instance->cid); + if (guest == NULL) + return -1; + instance->tsync.guest_pid = guest->pid; + instance->tsync.vcpu_count = guest->cpu_max; fd = trace_open_vsock(instance->cid, tsync_port); if (fd < 0) { ret = -1; -- 2.26.2