trace-cmd: Apply time stamp corrections by default
cover trace-cmd: Apply time stamp corrections by default
Apply all time stamp corrections from trace file meta data by default. Removed APIs for pair and unpair tracing peers, as that logic is not relevant any more.
Tzvetomir Stoyanov (VMware) (2):
trace-cmd: Enable TS correction by default
trace-cmd: Remove APIs for pairing a tracing peer.
.../libtracecmd/libtracecmd-peer.3.txt | 32 +----- Documentation/libtracecmd/libtracecmd.3.txt | 2 - include/trace-cmd/trace-cmd.h | 3 - .../include/private/trace-cmd-private.h | 1 - lib/trace-cmd/trace-input.c | 102 +----------------- 5 files changed, 5 insertions(+), 135 deletions(-)
Signature · 1 line
2.29.2
PATCH 1/2 trace-cmd: Enable TS correction by default
When opening a trace.dat file with trace-cmd library, apply time stamps corrections from the file's metadata by default. This default behaviour can be disabled with flag TRACECMD_FL_IGNORE_DATE using tracecmd_set_flag() API, before reading the tracing data. There is also a "trace-cmd report" option for ignoring any timestamp corrections: "--nodate".
--- lib/trace-cmd/trace-input.c | 4 ++++ 1 file changed, 4 insertions(+)
lib/trace-cmd/trace-input.c +4 -0
@@ -1167,6 +1167,9 @@ static unsigned long long timestamp_correct(unsigned long long ts,struct host_trace_info *host = &handle->host;int min, mid, max; +if (handle->flags &TRACECMD_FL_IGNORE_DATE ) +return ts; +if (handle->ts_offset)return ts + handle->ts_offset;
@@ -2585,6 +2588,7 @@ static int handle_options(struct tracecmd_input *handle)if (!handle->host.ts_samples)return -ENOMEM ;tsync_offset_load (handle, buf +16 ); +tracecmd_enable_tsync (handle, true);break ;case TRACECMD_OPTION_CPUSTAT : buf[size-1 ] ='\n' ;
Signature · 1 line
2.29.2
PATCH 2/2 trace-cmd: Remove APIs for pairing a tracing peer.
In reply to Tzvetomir Stoyanov (VMware)In host-guests tracing context, tracing peers are all machines which are being traced at the same time, as part of a single tracing session. The logic for matching and pairing tracing peers from the same session, when opening trace files, is used to take decision whether to apply time stamps correction on the tracing events, in order to be in the same time space. As there is a change in that behaviour - now these corrections are applied by default, there is no need for pairing logic. These APIs are removed:
tracecmd_pair_peer()
tracecmd_unpair_peer()
Note that the peer information is still saved in the file metadata.
--- .../libtracecmd/libtracecmd-peer.3.txt | 32 +----- Documentation/libtracecmd/libtracecmd.3.txt | 2 - include/trace-cmd/trace-cmd.h | 3 - .../include/private/trace-cmd-private.h | 1 - lib/trace-cmd/trace-input.c | 98 ------------------- 5 files changed, 1 insertion(+), 135 deletions(-)
Documentation/libtracecmd/libtracecmd-peer.3.txt +1 -31
@@ -3,8 +3,7 @@ libtracecmd(3) NAME ---- -tracecmd_pair_peer, tracecmd_unpair_peer, tracecmd_get_traceid, -tracecmd_get_guest_cpumap - Manage trace session with multiple trace peers, +tracecmd_get_traceid, tracecmd_get_guest_cpumap - Manage trace session with multiple trace peers, recorded in multiple trace files. SYNOPSIS
@@ -13,8 +12,6 @@ SYNOPSIS -- *#include <trace-cmd.h>* -int *tracecmd_pair_peer*(struct tracecmd_input pass:[*]_handle_, struct tracecmd_input pass:[*]_peer_); -void *tracecmd_unpair_peer*(struct tracecmd_input pass:[*]_handle_); unsigned long long *tracecmd_get_traceid*(struct tracecmd_input pass:[*]_handle_); int *tracecmd_get_guest_cpumap*(struct tracecmd_input pass:[*]_handle_, unsigned long long _trace_id_, const char pass:[*]pass:[*]_name_, int pass:[*]_vcpu_count_, const int pass:[*]pass:[*]_cpu_pid_); --
@@ -28,15 +25,6 @@ Information about peers from the session is stored in the metadata of each trace file. These APIs use that information to extract and synchronize the trace data. -The _tracecmd_pair_peer()_ function pairs two tracecmd_input handlers, -associated with two trace files from the same trace session. This API must -be called before _tracecmd_init_data()(3)_, as the initialisation of -the trace data depends on that. If there is a tracing peer, the event -timestamps are recalculated in order to be in the same time space. - -The _tracecmd_unpair_peer()_ function unpairs a peer from _handle_ -previously paired with _tracecmd_pair_peer()_. - The _tracecmd_get_traceid()_ function returns the trace ID stored in the trace file metadata associated with _handle_. Each peer from a trace session has an ID unique for that peer and that trace session only.
@@ -59,9 +47,6 @@ The _name_, _vcpu_count_ and _cpu_pid_ values must *not* be freed. RETURN VALUE ------------ -The _tracecmd_pair_peer()_ function returns 1, if a peer is already -paired, -1 in case of an error or 0 if it successfully paired the peers. - The _tracecmd_get_traceid()_ function returns a 64 bit trace ID. The _tracecmd_get_guest_cpumap()_ function returns -1 in case of
@@ -90,7 +75,6 @@ struct tracecmd_input *guest2 = tracecmd_open_head("trace-Guest2.dat"); unsigned long long guest_id_1 = tracecmd_get_traceid(guest1); unsigned long long guest_id_2 = tracecmd_get_traceid(guest2); -bool g1 = false, g2 = false; int *cpu_pid_1, *cpu_pid_2; int vcount_1, vcount_2; char *name_1, *name_2;
@@ -99,27 +83,13 @@ char *name_1, *name_2; /* The Host and a guest1 with name_1 are part of the same trace session. * Got guest1 VCPU to host PID mapping. */ - if (!tracecmd_pair_peer(guest1, host)) { - /* Successfully paired guest1 to the host handler */ - tracecmd_init_data(guest1); - g1 = true; - } } if (!tracecmd_get_guest_cpumap(host, guest_id_2, &name_2, &vcount_2, &cpu_pid_2)) { /* The Host and a guest2 with name_2 are part of the same trace session. * Got guest2 VCPU to host PID mapping. */ - if (!tracecmd_pair_peer(guest2, host)) { - /* Successfully paired guest2 to the host handler */ - tracecmd_init_data(guest2); - g2 = true; - } } ... - if (g1) - tracecmd_unpair_peer(guest1); - if (g2) - tracecmd_unpair_peer(guest2); tracecmd_close(guest1); tracecmd_close(guest2); tracecmd_close(handle);
Documentation/libtracecmd/libtracecmd.3.txt +0 -2
@@ -31,8 +31,6 @@ Read tracing instances from a trace file: struct tracecmd_input pass:[*]*tracecmd_buffer_instance_handle*(struct tracecmd_input pass:[*]_handle_, int _indx_); Get traceing peer information from a trace file: - int *tracecmd_pair_peer*(struct tracecmd_input pass:[*]_handle_, struct tracecmd_input pass:[*]_peer_); - void tracecmd_unpair_peer(struct tracecmd_input pass:[*]handle); unsigned long long *tracecmd_get_traceid*(struct tracecmd_input pass:[*]_handle_); int *tracecmd_get_guest_cpumap*(struct tracecmd_input pass:[*]_handle_, unsigned long long _trace_id_, const char pass:[*]pass:[*]_name_, int pass:[*]_vcpu_count_, const int pass:[*]pass:[*]_cpu_pid_); --
include/trace-cmd/trace-cmd.h +0 -3
@@ -20,9 +20,6 @@ struct tracecmd_input *tracecmd_open(const char *file, int flags);struct tracecmd_input *tracecmd_open_fd (int fd,int flags);void tracecmd_close (struct tracecmd_input *handle); -int tracecmd_pair_peer (struct tracecmd_input *handle, -struct tracecmd_input *peer); -void tracecmd_unpair_peer (struct tracecmd_input *handle);int tracecmd_init_data (struct tracecmd_input *handle); struct tep_record *
lib/trace-cmd/include/private/trace-cmd-private.h +0 -1
@@ -163,7 +163,6 @@ void tracecmd_set_flag(struct tracecmd_input *handle, int flag);void tracecmd_clear_flag (struct tracecmd_input *handle,int flag);unsigned long tracecmd_get_flags (struct tracecmd_input *handle);unsigned long tracecmd_get_file_state (struct tracecmd_input *handle); -unsigned long long tracecmd_get_tsync_peer (struct tracecmd_input *handle);int tracecmd_enable_tsync (struct tracecmd_input *handle,bool enable);void tracecmd_parse_trace_clock (struct tracecmd_input *handle,char *file,int size);
lib/trace-cmd/trace-input.c +0 -98
132 lines not on this page · raw message
Signature · 1 line
2.29.2