linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [PATCH] kernel-shark-2.alpha: Use new tracecmd API to open guest tracing file
Date: Wed,  1 Apr 2020 19:45:09 +0300	[thread overview]
Message-ID: <20200401164509.191494-1-tz.stoyanov@gmail.com> (raw)

From: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@gmail.com>

The new tracecmd API tracecmd_open_merge() is used to open guest
tracing file and synchronize it to the host file.
This change is for testing purposes only, to test the new per CPU
timestamps synchronization logic.
It assumes that the stream with id 0 is the host one, and all others are
guest streams.
This change depends on commit:
 "trace-cmd: Add new API to merge two trace files"
where the new tracecmd API is introduced.

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

diff --git a/src/libkshark-tepdata.c b/src/libkshark-tepdata.c
index 8678e12..b80b945 100644
--- a/src/libkshark-tepdata.c
+++ b/src/libkshark-tepdata.c
@@ -1008,8 +1008,17 @@ int kshark_tep_init_input(struct kshark_data_stream *stream,
 	tep_handle = calloc(1, sizeof(*tep_handle));
 	if (!tep_handle)
 		return -EFAULT;
-
-	tep_handle->input = tracecmd_open(file);
+	if (stream->stream_id > 0) {
+		struct kshark_data_stream *primary;
+
+		primary = kshark_get_data_stream(kshark_ctx, 0);
+		if (primary && primary->file)
+			tep_handle->input = tracecmd_open_merge(file,
+								primary->file);
+		else
+			tep_handle->input = tracecmd_open(file);
+	} else
+		tep_handle->input = tracecmd_open(file);
 	if (!tep_handle->input) {
 		free(tep_handle);
 		stream->interface.handle = NULL;
-- 
2.25.1


             reply	other threads:[~2020-04-01 16:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-01 16:45 Tzvetomir Stoyanov (VMware) [this message]
2020-04-03 11:39 ` [PATCH] kernel-shark-2.alpha: Use new tracecmd API to open guest tracing file Yordan Karadzhov (VMware)
2020-04-03 12:26   ` Tzvetomir Stoyanov
2020-04-03 13:25     ` Steven Rostedt
2020-04-03 15:09     ` Yordan Karadzhov (VMware)
2020-04-03 17:12       ` Tzvetomir Stoyanov
2020-04-06 13:24         ` Yordan Karadzhov (VMware)
2020-04-06 14:33           ` Tzvetomir Stoyanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200401164509.191494-1-tz.stoyanov@gmail.com \
    --to=tz.stoyanov@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).