perf diff: Display data file info ahead of the diff output
authorJiri Olsa <[email protected]>
Sat, 1 Dec 2012 20:56:03 +0000 (21:56 +0100)
committerArnaldo Carvalho de Melo <[email protected]>
Fri, 12 Jul 2013 16:54:06 +0000 (13:54 -0300)
Data files are referenced through the index of the file on the command
line. Adding list of data files for each index to ease up navigation for
user.

It's displayed only if in verbose mode.

Signed-off-by: Jiri Olsa <[email protected]>
Reviewed-by: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Namhyung Kim <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/builtin-diff.c

index 0cfe99ea905642703cb13d6848ace4ed3bca17c6..9574ba18bc7b3d252a28e686118be9ccb1b3a66c 100644 (file)
@@ -481,6 +481,21 @@ static void hists__process(struct hists *base, struct hists *new)
        hists__fprintf(base, true, 0, 0, 0, stdout);
 }
 
+static void data__fprintf(void)
+{
+       struct data__file *d;
+       int i;
+
+       fprintf(stdout, "# Data files:\n");
+
+       data__for_each_file(i, d)
+               fprintf(stdout, "#  [%d] %s %s\n",
+                       d->idx, d->file,
+                       !d->idx ? "(Baseline)" : "");
+
+       fprintf(stdout, "#\n");
+}
+
 static void data_process(void)
 {
        struct perf_evlist *evlist_old = data__files[0].session->evlist;
@@ -500,6 +515,9 @@ static void data_process(void)
 
                first = false;
 
+               if (verbose)
+                       data__fprintf();
+
                hists__process(&evsel_old->hists, &evsel_new->hists);
        }
 }