perf timechart: Add backtrace support to CPU info
authorStanislav Fomichev <stfomichev@yandex-team.ru>
Mon, 2 Dec 2013 14:37:33 +0000 (18:37 +0400)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 16 Dec 2013 19:33:14 +0000 (16:33 -0300)
Add backtrace info to the CPU usage timechart.

Signed-off-by: Stanislav Fomichev <stfomichev@yandex-team.ru>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ramkumar Ramachandra <artagnon@gmail.com>
Link: http://lkml.kernel.org/r/1385995056-20158-2-git-send-email-stfomichev@yandex-team.ru
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-timechart.c
tools/perf/util/svghelper.c
tools/perf/util/svghelper.h

index 0bda620a717dc056ca7bd23416178ce295cf7a7a..d955095b6d63cfa8fece379e5225952fbb001fe7 100644 (file)
@@ -837,8 +837,14 @@ static void draw_cpu_usage(struct timechart *tchart)
                while (c) {
                        sample = c->samples;
                        while (sample) {
-                               if (sample->type == TYPE_RUNNING)
-                                       svg_process(sample->cpu, sample->start_time, sample->end_time, "sample", c->comm);
+                               if (sample->type == TYPE_RUNNING) {
+                                       svg_process(sample->cpu,
+                                                   sample->start_time,
+                                                   sample->end_time,
+                                                   "sample",
+                                                   c->comm,
+                                                   sample->backtrace);
+                               }
 
                                sample = sample->next;
                        }
index 8b79d3ad124629e44184b8d20474592f9346a44b..740f0328fc13a10daaf3ccde26293fd812af5405 100644 (file)
@@ -285,7 +285,7 @@ void svg_cpu_box(int cpu, u64 __max_freq, u64 __turbo_freq)
        fprintf(svgfile, "</g>\n");
 }
 
-void svg_process(int cpu, u64 start, u64 end, const char *type, const char *name)
+void svg_process(int cpu, u64 start, u64 end, const char *type, const char *name, const char *backtrace)
 {
        double width;
 
@@ -295,6 +295,8 @@ void svg_process(int cpu, u64 start, u64 end, const char *type, const char *name
 
        fprintf(svgfile, "<g transform=\"translate(%4.8f,%4.8f)\">\n", time2pixels(start), cpu2y(cpu));
        fprintf(svgfile, "<title>%s %s</title>\n", name, time_to_string(end - start));
+       if (backtrace)
+               fprintf(svgfile, "<desc>Switched because:\n%s</desc>\n", backtrace);
        fprintf(svgfile, "<rect x=\"0\" width=\"%4.8f\" y=\"0\" height=\"%4.1f\" class=\"%s\"/>\n",
                time2pixels(end)-time2pixels(start), SLOT_MULT+SLOT_HEIGHT, type);
        width = time2pixels(end)-time2pixels(start);
index fad79ceeac1adb12470d0a7f842e4787f52f2dad..7db6ae98bf2c83425e2d83199bfa71571f416d2f 100644 (file)
@@ -11,7 +11,7 @@ extern void svg_waiting(int Yslot, int cpu, u64 start, u64 end, const char *back
 extern void svg_cpu_box(int cpu, u64 max_frequency, u64 turbo_frequency);
 
 
-extern void svg_process(int cpu, u64 start, u64 end, const char *type, const char *name);
+extern void svg_process(int cpu, u64 start, u64 end, const char *type, const char *name, const char *backtrace);
 extern void svg_cstate(int cpu, u64 start, u64 end, int type);
 extern void svg_pstate(int cpu, u64 start, u64 end, u64 freq);