diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2009-09-20 12:13:53 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-09-20 13:37:35 -0400 |
commit | a92fe7b3063db2caa578872fce975ff53aa56214 (patch) | |
tree | ff864f33e311daacb119e578f39e1fcac2275240 | |
parent | 4f1202c8e61478984ed2d0df616149faf84c2a7f (diff) |
perf timechart: Show the duration of scheduler delays in the SVG
Given that scheduler latencies are the hot thing nowadays, show the
duration of said latencies in the SVG in text form.
In addition, if the latency is more than 10 msec, pick a brighter
yellow color as a way to point these long delays out.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20090920181353.796f4509@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | tools/perf/builtin-timechart.c | 6 | ||||
-rw-r--r-- | tools/perf/util/svghelper.c | 56 | ||||
-rw-r--r-- | tools/perf/util/svghelper.h | 3 |
3 files changed, 57 insertions, 8 deletions
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 3f45b8b24e3d..23b3f09d19aa 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c | |||
@@ -827,15 +827,15 @@ static void draw_process_bars(void) | |||
827 | continue; | 827 | continue; |
828 | } | 828 | } |
829 | 829 | ||
830 | svg_box(Y, p->start_time, p->end_time, "process"); | 830 | svg_box(Y, c->start_time, c->end_time, "process"); |
831 | sample = c->samples; | 831 | sample = c->samples; |
832 | while (sample) { | 832 | while (sample) { |
833 | if (sample->type == TYPE_RUNNING) | 833 | if (sample->type == TYPE_RUNNING) |
834 | svg_sample(Y, sample->cpu, sample->start_time, sample->end_time, "sample"); | 834 | svg_sample(Y, sample->cpu, sample->start_time, sample->end_time); |
835 | if (sample->type == TYPE_BLOCKED) | 835 | if (sample->type == TYPE_BLOCKED) |
836 | svg_box(Y, sample->start_time, sample->end_time, "blocked"); | 836 | svg_box(Y, sample->start_time, sample->end_time, "blocked"); |
837 | if (sample->type == TYPE_WAITING) | 837 | if (sample->type == TYPE_WAITING) |
838 | svg_box(Y, sample->start_time, sample->end_time, "waiting"); | 838 | svg_waiting(Y, sample->start_time, sample->end_time); |
839 | sample = sample->next; | 839 | sample = sample->next; |
840 | } | 840 | } |
841 | 841 | ||
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c index 9f70fa8e7643..52f628fe6421 100644 --- a/tools/perf/util/svghelper.c +++ b/tools/perf/util/svghelper.c | |||
@@ -69,7 +69,8 @@ void open_svg(const char *filename, int cpus, int rows) | |||
69 | fprintf(svgfile, " rect.process2 { fill:rgb(180,180,180); fill-opacity:0.9; stroke-width:0; stroke:rgb( 0, 0, 0); } \n"); | 69 | fprintf(svgfile, " rect.process2 { fill:rgb(180,180,180); fill-opacity:0.9; stroke-width:0; stroke:rgb( 0, 0, 0); } \n"); |
70 | fprintf(svgfile, " rect.sample { fill:rgb( 0, 0,255); fill-opacity:0.8; stroke-width:0; stroke:rgb( 0, 0, 0); } \n"); | 70 | fprintf(svgfile, " rect.sample { fill:rgb( 0, 0,255); fill-opacity:0.8; stroke-width:0; stroke:rgb( 0, 0, 0); } \n"); |
71 | fprintf(svgfile, " rect.blocked { fill:rgb(255, 0, 0); fill-opacity:0.5; stroke-width:0; stroke:rgb( 0, 0, 0); } \n"); | 71 | fprintf(svgfile, " rect.blocked { fill:rgb(255, 0, 0); fill-opacity:0.5; stroke-width:0; stroke:rgb( 0, 0, 0); } \n"); |
72 | fprintf(svgfile, " rect.waiting { fill:rgb(255,255, 0); fill-opacity:0.3; stroke-width:0; stroke:rgb( 0, 0, 0); } \n"); | 72 | fprintf(svgfile, " rect.waiting { fill:rgb(214,214, 0); fill-opacity:0.3; stroke-width:0; stroke:rgb( 0, 0, 0); } \n"); |
73 | fprintf(svgfile, " rect.WAITING { fill:rgb(255,214, 48); fill-opacity:0.6; stroke-width:0; stroke:rgb( 0, 0, 0); } \n"); | ||
73 | fprintf(svgfile, " rect.cpu { fill:rgb(192,192,192); fill-opacity:0.2; stroke-width:0.5; stroke:rgb(128,128,128); } \n"); | 74 | fprintf(svgfile, " rect.cpu { fill:rgb(192,192,192); fill-opacity:0.2; stroke-width:0.5; stroke:rgb(128,128,128); } \n"); |
74 | fprintf(svgfile, " rect.pstate { fill:rgb(128,128,128); fill-opacity:0.8; stroke-width:0; } \n"); | 75 | fprintf(svgfile, " rect.pstate { fill:rgb(128,128,128); fill-opacity:0.8; stroke-width:0; } \n"); |
75 | fprintf(svgfile, " rect.c1 { fill:rgb(255,214,214); fill-opacity:0.5; stroke-width:0; } \n"); | 76 | fprintf(svgfile, " rect.c1 { fill:rgb(255,214,214); fill-opacity:0.5; stroke-width:0; } \n"); |
@@ -92,14 +93,14 @@ void svg_box(int Yslot, u64 start, u64 end, const char *type) | |||
92 | time2pixels(start), time2pixels(end)-time2pixels(start), Yslot * SLOT_MULT, SLOT_HEIGHT, type); | 93 | time2pixels(start), time2pixels(end)-time2pixels(start), Yslot * SLOT_MULT, SLOT_HEIGHT, type); |
93 | } | 94 | } |
94 | 95 | ||
95 | void svg_sample(int Yslot, int cpu, u64 start, u64 end, const char *type) | 96 | void svg_sample(int Yslot, int cpu, u64 start, u64 end) |
96 | { | 97 | { |
97 | double text_size; | 98 | double text_size; |
98 | if (!svgfile) | 99 | if (!svgfile) |
99 | return; | 100 | return; |
100 | 101 | ||
101 | fprintf(svgfile, "<rect x=\"%4.8f\" width=\"%4.8f\" y=\"%4.1f\" height=\"%4.1f\" class=\"%s\"/>\n", | 102 | fprintf(svgfile, "<rect x=\"%4.8f\" width=\"%4.8f\" y=\"%4.1f\" height=\"%4.1f\" class=\"sample\"/>\n", |
102 | time2pixels(start), time2pixels(end)-time2pixels(start), Yslot * SLOT_MULT, SLOT_HEIGHT, type); | 103 | time2pixels(start), time2pixels(end)-time2pixels(start), Yslot * SLOT_MULT, SLOT_HEIGHT); |
103 | 104 | ||
104 | text_size = (time2pixels(end)-time2pixels(start)); | 105 | text_size = (time2pixels(end)-time2pixels(start)); |
105 | if (cpu > 9) | 106 | if (cpu > 9) |
@@ -112,6 +113,53 @@ void svg_sample(int Yslot, int cpu, u64 start, u64 end, const char *type) | |||
112 | 113 | ||
113 | } | 114 | } |
114 | 115 | ||
116 | static char *time_to_string(u64 duration) | ||
117 | { | ||
118 | static char text[80]; | ||
119 | |||
120 | text[0] = 0; | ||
121 | |||
122 | if (duration < 1000) /* less than 1 usec */ | ||
123 | return text; | ||
124 | |||
125 | if (duration < 1000 * 1000) { /* less than 1 msec */ | ||
126 | sprintf(text, "%4.1f us", duration / 1000.0); | ||
127 | return text; | ||
128 | } | ||
129 | sprintf(text, "%4.1f ms", duration / 1000.0 / 1000); | ||
130 | |||
131 | return text; | ||
132 | } | ||
133 | |||
134 | void svg_waiting(int Yslot, u64 start, u64 end) | ||
135 | { | ||
136 | char *text; | ||
137 | const char *style; | ||
138 | double font_size; | ||
139 | |||
140 | if (!svgfile) | ||
141 | return; | ||
142 | |||
143 | style = "waiting"; | ||
144 | |||
145 | if (end-start > 10 * 1000000) /* 10 msec */ | ||
146 | style = "WAITING"; | ||
147 | |||
148 | text = time_to_string(end-start); | ||
149 | |||
150 | font_size = 1.0 * (time2pixels(end)-time2pixels(start)) / strlen(text); | ||
151 | |||
152 | if (font_size > 0.2) | ||
153 | font_size = 0.2; | ||
154 | |||
155 | |||
156 | fprintf(svgfile, "<rect x=\"%4.8f\" width=\"%4.8f\" y=\"%4.1f\" height=\"%4.1f\" class=\"%s\"/>\n", | ||
157 | time2pixels(start), time2pixels(end)-time2pixels(start), Yslot * SLOT_MULT, SLOT_HEIGHT, style); | ||
158 | if (font_size > MIN_TEXT_SIZE) | ||
159 | fprintf(svgfile, "<text transform=\"translate(%1.8f,%1.8f)\" font-size=\"%1.6fpt\">%s</text>\n", | ||
160 | time2pixels(start), Yslot * SLOT_MULT + 2, font_size, text); | ||
161 | } | ||
162 | |||
115 | static char *cpu_model(void) | 163 | static char *cpu_model(void) |
116 | { | 164 | { |
117 | static char cpu_m[255]; | 165 | static char cpu_m[255]; |
diff --git a/tools/perf/util/svghelper.h b/tools/perf/util/svghelper.h index 8260a7e6e314..ed4ebcfaf493 100644 --- a/tools/perf/util/svghelper.h +++ b/tools/perf/util/svghelper.h | |||
@@ -5,7 +5,8 @@ | |||
5 | 5 | ||
6 | extern void open_svg(const char *filename, int cpus, int rows); | 6 | extern void open_svg(const char *filename, int cpus, int rows); |
7 | extern void svg_box(int Yslot, u64 start, u64 end, const char *type); | 7 | extern void svg_box(int Yslot, u64 start, u64 end, const char *type); |
8 | extern void svg_sample(int Yslot, int cpu, u64 start, u64 end, const char *type); | 8 | extern void svg_sample(int Yslot, int cpu, u64 start, u64 end); |
9 | extern void svg_waiting(int Yslot, u64 start, u64 end); | ||
9 | extern void svg_cpu_box(int cpu, u64 max_frequency, u64 turbo_frequency); | 10 | extern void svg_cpu_box(int cpu, u64 max_frequency, u64 turbo_frequency); |
10 | 11 | ||
11 | 12 | ||