Useful APIs for merging tracing files
v2 cover Useful APIs for merging tracing files
Helper APIs, used when opening and merging files from same tracing session.
[
v2 changes:
- Renamed tracecmd_set_merge_peer() to tracecmd_pair_peer() and introduced tracecmd_unpair_peer()
]
Tzvetomir Stoyanov (VMware) (2):
trace-cmd: Add new APIs to pair and unpair tracing peers
trace-cmd: Validate input parameters of tracecmd_get_guest_cpumap()
API
include/trace-cmd/trace-cmd.h | 3 + lib/trace-cmd/trace-input.c | 104 +++++++++++++++++++++++++++++++--- 2 files changed, 100 insertions(+), 7 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/2 trace-cmd: Add new APIs to pair and unpair tracing peers
When tracing host and one or more guest machines at the same time, guest and host are tracing peers. There is information in both trace files, related to host PID to guest vCPU mapping, timestamp synchronization and other. This information is useful when opening files at the same time and merging the events. When the host is set as a tracing peer to the guest, then the timestamps of guest's events are recalculated to match the host event's time Two new APIs are intrduced to control pairing of tracing peers:
int tracecmd_pair_peer(struct tracecmd_input *handle,
struct tracecmd_input *peer);
int tracecmd_unpair_peer(struct tracecmd_input *handle);
--- include/trace-cmd/trace-cmd.h | 3 ++ lib/trace-cmd/trace-input.c | 95 +++++++++++++++++++++++++++++++++-- 2 files changed, 94 insertions(+), 4 deletions(-)
include/trace-cmd/trace-cmd.h +3 -0
@@ -145,6 +145,9 @@ struct tracecmd_input *tracecmd_alloc_fd(int fd);struct tracecmd_input *tracecmd_open (const char *file);struct tracecmd_input *tracecmd_open_head (const char *file);struct tracecmd_input *tracecmd_open_fd (int fd); +int tracecmd_pair_peer (struct tracecmd_input *handle, +struct tracecmd_input *peer); +int tracecmd_unpair_peer (struct tracecmd_input *handle);void tracecmd_ref (struct tracecmd_input *handle);void tracecmd_close (struct tracecmd_input *handle);int tracecmd_read_headers (struct tracecmd_input *handle);
lib/trace-cmd/trace-input.c +91 -4
130 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 2/2 trace-cmd: Validate input parameters of tracecmd_get_guest_cpumap() API
In reply to Tzvetomir Stoyanov (VMware)The API:
int tracecmd_get_guest_cpumap(struct tracecmd_input *handle,
unsigned long long trace_id,
const char **name,
int *vcpu_count, const int **cpu_pid)
is used to retrieve the host PID to guest VCPU mapping from a tracecmd input handle, if such information is available in the trace.dat file for the peer with the given trace_id. The input parameters name, vcpu_count and cpu_pid are mandatory, they are used to return then requested mapping. The API could be used also to check if such information is available, without requesting it. Made those input parameters optional, so the API can be used in this use case.
--- lib/trace-cmd/trace-input.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
lib/trace-cmd/trace-input.c +6 -3
@@ -3856,9 +3856,12 @@ int tracecmd_get_guest_cpumap(struct tracecmd_input *handle,if (!guest)return -1 ; - *name = guest->name; - *vcpu_count = guest->vcpu_count; - *cpu_pid = guest->cpu_pid; +if (name) + *name = guest->name; +if (vcpu_count) + *vcpu_count = guest->vcpu_count; +if (cpu_pid) + *cpu_pid = guest->cpu_pid;return 0 ; }
Signature · 1 line
2.25.1