mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fb.com>
To: <rostedt@goodmis.org>, <linux-kernel@vger.kernel.org>,
	<kernel-team@fb.com>
Subject: [PATCH 5/5] trace-cmd: make trace-hist work with instances
Date: Fri, 8 May 2015 15:29:04 -0400	[thread overview]
Message-ID: <1431113344-22579-6-git-send-email-jbacik@fb.com> (raw)
In-Reply-To: <1431113344-22579-1-git-send-email-jbacik@fb.com>

If you recorded information completely in an instance then trace-hist wouldn't
think your trace.dat file had any events because it didn't know about instances.
Fix this.

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 trace-hist.c | 33 +++++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/trace-hist.c b/trace-hist.c
index 574549e..2a2e780 100644
--- a/trace-hist.c
+++ b/trace-hist.c
@@ -954,13 +954,6 @@ static void do_trace_hist(struct tracecmd_input *handle)
 	int cpu;
 	int ret;
 
-	ret = tracecmd_init_data(handle);
-	if (ret < 0)
-		die("failed to init data");
-
-	if (ret > 0)
-		die("trace-cmd hist does not work with latency traces\n");
-
 	cpus = tracecmd_cpus(handle);
 
 	/* Need to get any event */
@@ -1025,6 +1018,7 @@ void trace_hist(int argc, char **argv)
 {
 	struct tracecmd_input *handle;
 	const char *input_file = NULL;
+	int instances;
 	int ret;
 
 	for (;;) {
@@ -1067,7 +1061,30 @@ void trace_hist(int argc, char **argv)
 	if (ret)
 		return;
 
-	do_trace_hist(handle);
+	ret = tracecmd_init_data(handle);
+	if (ret < 0)
+		die("failed to init data");
+
+	if (ret > 0)
+		die("trace-cmd hist does not work with latency traces\n");
+
+	instances = tracecmd_buffer_instances(handle);
+	if (instances) {
+		struct tracecmd_input *new_handle;
+		int i;
+
+		for (i = 0; i < instances; i++) {
+			new_handle = tracecmd_buffer_instance_handle(handle, i);
+			if (!new_handle) {
+				warning("could not retrieve handle %d", i);
+				continue;
+			}
+			do_trace_hist(new_handle);
+			tracecmd_close(new_handle);
+		}
+	} else {
+		do_trace_hist(handle);
+	}
 
 	tracecmd_close(handle);
 }
-- 
2.1.0


  parent reply	other threads:[~2015-05-08 19:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08 19:28 [PATCH 0/5] trace-cmd profile enhancements Josef Bacik
2015-05-08 19:29 ` [PATCH 1/5] trace-cmd: add option to group like comms for profile Josef Bacik
2015-05-20 17:31   ` Steven Rostedt
2015-05-20 17:51     ` Josef Bacik
2015-05-08 19:29 ` [PATCH 2/5] trace-cmd: group schedule stacktraces together with --merge Josef Bacik
2015-05-20 17:36   ` Steven Rostedt
2015-05-20 17:54     ` Josef Bacik
2015-05-08 19:29 ` [PATCH 3/5] trace-cmd: lookup syscall names in profile Josef Bacik
2015-05-20 18:00   ` Steven Rostedt
2015-05-20 18:22     ` Josef Bacik
2015-05-20 18:56       ` Steven Rostedt
2015-05-20 19:01         ` Steven Rostedt
2015-05-20 19:06           ` Josef Bacik
2015-05-08 19:29 ` [PATCH 4/5] trace-cmd: sort the events in the profile output Josef Bacik
2015-05-08 19:29 ` Josef Bacik [this message]
2015-05-08 20:13 ` [PATCH 0/5] trace-cmd profile enhancements Steven Rostedt

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=1431113344-22579-6-git-send-email-jbacik@fb.com \
    --to=jbacik@fb.com \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®