diff mbox series

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

Message ID 20210310121135.1620453-1-tz.stoyanov@gmail.com (mailing list archive)
State Accepted
Commit a461ff8f477e7e3992cab47f2bbe14e2d73ac69f
Headers show
Series kernel-shark v2: Change the logic for opening trace-cmd files | expand

Commit Message

Tzvetomir Stoyanov (VMware) March 10, 2021, 12:11 p.m. UTC
From: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@gmail.com>

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.

Signed-off-by: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@gmail.com>
---
 src/libkshark-tepdata.c | 49 -----------------------------------------
 1 file changed, 49 deletions(-)

Comments

Steven Rostedt March 10, 2021, 9:48 p.m. UTC | #1
On Wed, 10 Mar 2021 14:11:35 +0200
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:

> From: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@gmail.com>
> 
> 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/

> now obsolete and should not be used.
> 
> Signed-off-by: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@gmail.com>

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

As for the rest of the patch.

Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

-- Steve
Yordan Karadzhov March 11, 2021, 2:15 p.m. UTC | #2
On 10.03.21 г. 23:48, Steven Rostedt wrote:
> On Wed, 10 Mar 2021 14:11:35 +0200
> "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:
> 
>> From: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@gmail.com>
>>
>> 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/
> 
>> now obsolete and should not be used.
>>
>> Signed-off-by: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@gmail.com>
> 
> The from and SOB should be Tzvetomir Stoyanov (VMware), unless you changed
> your middle name to (VMware) ;-)
> 
> As for the rest of the patch.
> 
> Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

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


> 
> -- Steve
>
Steven Rostedt March 11, 2021, 2:55 p.m. UTC | #3
On Thu, 11 Mar 2021 16:15:59 +0200
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:

> 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
diff mbox series

Patch

diff --git a/src/libkshark-tepdata.c b/src/libkshark-tepdata.c
index d29e98b..4e76ef2 100644
--- a/src/libkshark-tepdata.c
+++ b/src/libkshark-tepdata.c
@@ -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;