aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2015-05-08 15:29:04 -0400
committerSteven Rostedt <rostedt@goodmis.org>2015-06-10 15:12:02 -0400
commit996bbe5a450ae1a096e8a576c9a168ef6884a514 (patch)
treea712880c1d72354590e280be6c9ed5f7f1913285
parent86a3d04c2eeb2d66a78fd4c3ddfb424b6891bbc8 (diff)
downloadtrace-cmd-996bbe5a450ae1a096e8a576c9a168ef6884a514.tar.gz
trace-cmd: Make trace-hist work with instances
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. Link: http://lkml.kernel.org/r/1431113344-22579-6-git-send-email-jbacik@fb.com Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-hist.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/trace-hist.c b/trace-hist.c
index 574549e9..2a2e7806 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);
}