Skip to contentSkip to conversation

kernel-shark v2: Change the logic for opening trace-cmd files

PATCH In review Tzvetomir Stoyanov (VMware) 3 participants 4 messages Mar 10, 2021 – Mar 11, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel-shark v2: Change the logic for opening trace-cmd files

From: Tzvetomir (VMware) Stoyanov <[email protected]>

The logic for opening a trace file by trace-cmd library has changed. Any timestamp corrections, found in the trace file metadata are applied automatically. The old APIs, used by KernelShark for pairing trace files from the same host-guest traceing session and adjusting timestamps are now obsolete and should not be used.

---
 src/libkshark-tepdata.c | 49 -----------------------------------------
 1 file changed, 49 deletions(-)
src/libkshark-tepdata.c +0 -49
index d29e98b..4e76ef2 100644
@@ -1206,49 +1206,6 @@ static void kshark_tep_init_methods(struct kshark_generic_stream_interface *inte
 	interface->load_matrix = tepdata_load_matrix;
 }
 
-/** Find a host stream from the same tracing session, that has guest information */
-static struct tracecmd_input *
-kshark_tep_find_merge_peer(struct kshark_context *kshark_ctx,
-			   struct tracecmd_input *handle)
-{
-	struct tracecmd_input *peer_handle = NULL;
-	struct kshark_data_stream *peer_stream;
-	unsigned long long trace_id;
-	int *stream_ids = NULL;
-	int ret;
-	int i;
-
-	trace_id = tracecmd_get_traceid(handle);
-	if (!trace_id)
-		goto out;
-
-	stream_ids = kshark_all_streams(kshark_ctx);
-	if (!stream_ids)
-		goto out;
-
-	for (i = 0; i < kshark_ctx->n_streams - 1; i++) {
-		peer_stream = kshark_get_data_stream(kshark_ctx, stream_ids[i]);
-		if (!peer_stream || !kshark_is_tep(peer_stream))
-			continue;
-
-		peer_handle = kshark_get_tep_input(peer_stream);
-		if (!peer_handle)
-			continue;
-
-		ret = tracecmd_get_guest_cpumap(peer_handle, trace_id,
-						NULL, NULL, NULL);
-		if (!ret)
-			break;
-	}
-
-	if (i == kshark_ctx->n_streams)
-		peer_handle = NULL;
-
-out:
-	free(stream_ids);
-	return peer_handle;
-}
-
 /** A list of built in default plugins for FTRACE (trace-cmd) data. */
 const char *tep_plugin_names[] = {
 	"sched_events",
@@ -1574,7 +1531,6 @@ bool kshark_tep_check_data(const char *file_name)
 int kshark_tep_init_input(struct kshark_data_stream *stream)
 {
 	struct kshark_context *kshark_ctx = NULL;
-	struct tracecmd_input *merge_peer;
 	struct tracecmd_input *input;
 
 	if (!kshark_instance(&kshark_ctx) || !init_thread_seq())
@@ -1591,11 +1547,6 @@ int kshark_tep_init_input(struct kshark_data_stream *stream)
 	if (!input)
 		return -EEXIST;
 
-	/* Find a merge peer from the same tracing session. */
-	merge_peer = kshark_tep_find_merge_peer(kshark_ctx, input);
-	if (merge_peer)
-		tracecmd_pair_peer(input, merge_peer);
-
 	/* Read the tracing data from the file. */
 	if (tracecmd_init_data(input) < 0)
 		goto fail;
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · On Wed, 10 Mar 2021 14:11:35 +0200 "Tzvetomir Stoyanov (VMware)"…

From: Tzvetomir (VMware) Stoyanov <[email protected]>

The logic for opening a trace file by trace-cmd library has changed. Any timestamp corrections, found in the trace file metadata are applied automatically. The old APIs, used by KernelShark for pairing trace files from the same host-guest traceing session and adjusting timestamps are

s/traceing/tracing/

Quoted 3 lines

now obsolete and should not be used.

The from and SOB should be Tzvetomir Stoyanov (VMware), unless you changed your middle name to (VMware) ;-)

As for the rest of the patch.

-- Steve

#2 lore raw
Quoted 14 lines · Steven Rostedt
Quoted 6 lines · On Wed, 10 Mar 2021 14:11:35 +0200 "Tzvetomir Stoyanov (VMware)"…

From: Tzvetomir (VMware) Stoyanov <[email protected]>

The logic for opening a trace file by trace-cmd library has changed. Any timestamp corrections, found in the trace file metadata are applied automatically. The old APIs, used by KernelShark for pairing trace files from the same host-guest traceing session and adjusting timestamps are

s/traceing/tracing/

Quoted 2 lines

now obsolete and should not be used.

Quoted 8 lines
Quoted 1 line

The from and SOB should be Tzvetomir Stoyanov (VMware), unless you changed your middle name to (VMware) ;-)

As for the rest of the patch.

Hi Steven,

Thanks a lot for the review!

Have you tested that this works with the Timestamp synchronization patches that are not upstreamed yet?

Thanks!
Yordan

Quoted 3 lines

-- Steve

#3 lore raw
Quoted 2 lines · On Thu, 11 Mar 2021 16:15:59 +0200 "Yordan Karadzhov (VMware)"…

Have you tested that this works with the Timestamp synchronization patches that are not upstreamed yet?

I was in the process of doing so, but haven't done it yet :-/

Will do today.

-- Steve