@@ -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);
@@ -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_);
--
@@ -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 *
@@ -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);
@@ -95,7 +95,6 @@ struct host_trace_info {
unsigned long long peer_trace_id;
unsigned int flags;
bool sync_enable;
- struct tracecmd_input *peer_data;
int ts_samples_count;
struct ts_offset_sample *ts_samples;
};
@@ -2226,38 +2225,10 @@ static void tsync_offset_load(struct tracecmd_input *handle, char *buf)
host->ts_samples_count = j;
}
-static void tsync_check_enable(struct tracecmd_input *handle)
-{
- struct host_trace_info *host = &handle->host;
- struct guest_trace_info *guest;
-
- host->sync_enable = false;
-
- if (!host->peer_data || !host->peer_data->guest ||
- !host->ts_samples_count || !host->ts_samples)
- return;
- if (host->peer_trace_id != host->peer_data->trace_id)
- return;
- guest = host->peer_data->guest;
- while (guest) {
- if (guest->trace_id == handle->trace_id)
- break;
- guest = guest->next;
- }
- if (!guest)
- return;
-
- host->sync_enable = true;
-}
-
static void trace_tsync_offset_free(struct host_trace_info *host)
{
free(host->ts_samples);
host->ts_samples = NULL;
- if (host->peer_data) {
- tracecmd_close(host->peer_data);
- host->peer_data = NULL;
- }
}
static int trace_pid_map_cmp(const void *a, const void *b)
@@ -2266,7 +2237,6 @@ static int trace_pid_map_cmp(const void *a, const void *b)
struct tracecmd_proc_addr_map *m_b = (struct tracecmd_proc_addr_map *)b;
if (m_a->start > m_b->start)
- return 1;
if (m_a->start < m_b->start)
return -1;
return 0;
@@ -3278,61 +3248,6 @@ fail:
return NULL;
}
-/**
- * tracecmd_unpair_peer - Remove the linked tracing peer of this handle
- * @handle: input handle for the trace.dat file
- *
- * 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
- *
- * This removes any peer that is linked to the @handle.
- */
-void tracecmd_unpair_peer(struct tracecmd_input *handle)
-{
- if (!handle)
- return;
-
- if (handle->host.peer_data) {
- tracecmd_close(handle->host.peer_data);
- handle->host.peer_data = NULL;
- tsync_check_enable(handle);
- }
-}
-
-/**
- * tracecmd_pair_peer - Link a tracing peer to this handle
- * @handle: input handle for the trace.dat file
- * @peer: input handle for the tracing peer
- *
- * 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
- *
- * Returns 1, if a peer is already paired, -1 in case of an error or 0 otherwise
- */
-int tracecmd_pair_peer(struct tracecmd_input *handle,
- struct tracecmd_input *peer)
-{
- if (!handle)
- return -1;
-
- if (handle->host.peer_data)
- return 1;
-
- handle->host.peer_data = peer;
- tracecmd_ref(peer);
- tsync_check_enable(handle);
-
- return 0;
-}
-
/**
* tracecmd_ref - add a reference to the handle
* @handle: input handle for the trace.dat file
@@ -3910,19 +3825,6 @@ int tracecmd_get_guest_cpumap(struct tracecmd_input *handle,
return 0;
}
-/**
- * tracecmd_get_tsync_peer - get the trace session id of the peer host
- * @handle: input handle for the trace.dat file
- *
- * Returns the trace id of the peer host, written in the trace file
- *
- * This information is stored in guest trace.dat file
- */
-unsigned long long tracecmd_get_tsync_peer(struct tracecmd_input *handle)
-{
- return handle->host.peer_trace_id;
-}
-
/**
* tracecmd_enable_tsync - enable / disable the timestamps correction
* @handle: input handle for the trace.dat file
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. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> --- .../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(-)