diff options
author | Stanislav Fomichev <stfomichev@yandex-team.ru> | 2013-11-01 20:25:51 +0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-11-27 14:58:37 -0300 |
commit | 6f8d67fa0c6bdca535ecab137c44b095023cc1b4 (patch) | |
tree | 4c624985d3666affdb2800eb0ca59384fbd9be6d /tools/perf/util/svghelper.c | |
parent | 367b3152d72c20d789b07650bd1189ce0fe266b8 (diff) | |
download | linux-6f8d67fa0c6bdca535ecab137c44b095023cc1b4.tar.bz2 |
perf timechart: Add backtrace support
Add -g flag to `perf timechart record` which saves callchain info in the
perf.data.
When generating SVG, add backtrace information to the figure details, so
now it's possible to see which code path woke up the task and why some
task went to sleep.
Signed-off-by: Stanislav Fomichev <stfomichev@yandex-team.ru>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1383323151-19810-8-git-send-email-stfomichev@yandex-team.ru
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/svghelper.c')
-rw-r--r-- | tools/perf/util/svghelper.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c index 9a5b41392e01..8b79d3ad1246 100644 --- a/tools/perf/util/svghelper.c +++ b/tools/perf/util/svghelper.c @@ -130,7 +130,7 @@ void svg_box(int Yslot, u64 start, u64 end, const char *type) } static char *time_to_string(u64 duration); -void svg_blocked(int Yslot, int cpu, u64 start, u64 end) +void svg_blocked(int Yslot, int cpu, u64 start, u64 end, const char *backtrace) { if (!svgfile) return; @@ -138,11 +138,13 @@ void svg_blocked(int Yslot, int cpu, u64 start, u64 end) fprintf(svgfile, "<g>\n"); fprintf(svgfile, "<title>#%d blocked %s</title>\n", cpu, time_to_string(end - start)); + if (backtrace) + fprintf(svgfile, "<desc>Blocked on:\n%s</desc>\n", backtrace); svg_box(Yslot, start, end, "blocked"); fprintf(svgfile, "</g>\n"); } -void svg_running(int Yslot, int cpu, u64 start, u64 end) +void svg_running(int Yslot, int cpu, u64 start, u64 end, const char *backtrace) { double text_size; if (!svgfile) @@ -152,6 +154,8 @@ void svg_running(int Yslot, int cpu, u64 start, u64 end) fprintf(svgfile, "<title>#%d running %s</title>\n", cpu, time_to_string(end - start)); + if (backtrace) + fprintf(svgfile, "<desc>Switched because:\n%s</desc>\n", backtrace); fprintf(svgfile, "<rect x=\"%4.8f\" width=\"%4.8f\" y=\"%4.1f\" height=\"%4.1f\" class=\"sample\"/>\n", time2pixels(start), time2pixels(end)-time2pixels(start), Yslot * SLOT_MULT, SLOT_HEIGHT); @@ -187,7 +191,7 @@ static char *time_to_string(u64 duration) return text; } -void svg_waiting(int Yslot, int cpu, u64 start, u64 end) +void svg_waiting(int Yslot, int cpu, u64 start, u64 end, const char *backtrace) { char *text; const char *style; @@ -212,6 +216,8 @@ void svg_waiting(int Yslot, int cpu, u64 start, u64 end) fprintf(svgfile, "<g transform=\"translate(%4.8f,%4.8f)\">\n", time2pixels(start), Yslot * SLOT_MULT); fprintf(svgfile, "<title>#%d waiting %s</title>\n", cpu, time_to_string(end - start)); + if (backtrace) + fprintf(svgfile, "<desc>Waiting on:\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_HEIGHT, style); if (font_size > MIN_TEXT_SIZE) @@ -382,7 +388,7 @@ void svg_pstate(int cpu, u64 start, u64 end, u64 freq) } -void svg_partial_wakeline(u64 start, int row1, char *desc1, int row2, char *desc2) +void svg_partial_wakeline(u64 start, int row1, char *desc1, int row2, char *desc2, const char *backtrace) { double height; @@ -396,6 +402,9 @@ void svg_partial_wakeline(u64 start, int row1, char *desc1, int row2, char *desc desc1 ? desc1 : "?", desc2 ? desc2 : "?"); + if (backtrace) + fprintf(svgfile, "<desc>%s</desc>\n", backtrace); + if (row1 < row2) { if (row1) { fprintf(svgfile, "<line x1=\"%4.8f\" y1=\"%4.2f\" x2=\"%4.8f\" y2=\"%4.2f\" style=\"stroke:rgb(32,255,32);stroke-width:0.009\"/>\n", @@ -437,7 +446,7 @@ void svg_partial_wakeline(u64 start, int row1, char *desc1, int row2, char *desc fprintf(svgfile, "</g>\n"); } -void svg_wakeline(u64 start, int row1, int row2) +void svg_wakeline(u64 start, int row1, int row2, const char *backtrace) { double height; @@ -447,6 +456,9 @@ void svg_wakeline(u64 start, int row1, int row2) fprintf(svgfile, "<g>\n"); + if (backtrace) + fprintf(svgfile, "<desc>%s</desc>\n", backtrace); + if (row1 < row2) fprintf(svgfile, "<line x1=\"%4.8f\" y1=\"%4.2f\" x2=\"%4.8f\" y2=\"%4.2f\" style=\"stroke:rgb(32,255,32);stroke-width:0.009\"/>\n", time2pixels(start), row1 * SLOT_MULT + SLOT_HEIGHT, time2pixels(start), row2 * SLOT_MULT); @@ -463,7 +475,7 @@ void svg_wakeline(u64 start, int row1, int row2) fprintf(svgfile, "</g>\n"); } -void svg_interrupt(u64 start, int row) +void svg_interrupt(u64 start, int row, const char *backtrace) { if (!svgfile) return; @@ -472,6 +484,9 @@ void svg_interrupt(u64 start, int row) fprintf(svgfile, "<title>Wakeup from interrupt</title>\n"); + if (backtrace) + fprintf(svgfile, "<desc>%s</desc>\n", backtrace); + fprintf(svgfile, "<circle cx=\"%4.8f\" cy=\"%4.2f\" r = \"0.01\" style=\"fill:rgb(255,128,128)\"/>\n", time2pixels(start), row * SLOT_MULT); fprintf(svgfile, "<circle cx=\"%4.8f\" cy=\"%4.2f\" r = \"0.01\" style=\"fill:rgb(255,128,128)\"/>\n", |