aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@infradead.org>2009-09-19 07:35:07 -0400
committerIngo Molnar <mingo@elte.hu>2009-09-19 12:57:52 -0400
commit964a0b3d2b1b1cac1d01e29b635831b3d92a3fdd (patch)
treee8583a730594429444b00c7db8db95e914c20659 /tools
parent3c09eebd61eaacca866cd60b50416f18640bc731 (diff)
perf utils: Be consistent about minimum text size in the svghelper
Be more consistent in the svghelper about the minimum text size by having a global #define for this. There needs to be a minimum text size in order to keep the size of the SVG file within the reach of what current SVG viewers can cope with. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Cc: fweisbec@gmail.com Cc: peterz@infradead.org Cc: Paul Mackerras <paulus@samba.org> Cc: Arjan van de Ven <arjan@infradead.org> LKML-Reference: <20090919133507.7374ef8b@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/svghelper.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c
index c7a29afe2d72..b0fcecdf378d 100644
--- a/tools/perf/util/svghelper.c
+++ b/tools/perf/util/svghelper.c
@@ -27,6 +27,8 @@ static u64 turbo_frequency, max_freq;
27#define SLOT_HEIGHT 25.0 27#define SLOT_HEIGHT 25.0
28#define WIDTH 1000.0 28#define WIDTH 1000.0
29 29
30#define MIN_TEXT_SIZE 0.001
31
30static u64 total_height; 32static u64 total_height;
31static FILE *svgfile; 33static FILE *svgfile;
32 34
@@ -104,8 +106,8 @@ void svg_sample(int Yslot, int cpu, u64 start, u64 end, const char *type)
104 text_size = text_size/2; 106 text_size = text_size/2;
105 if (text_size > 1.25) 107 if (text_size > 1.25)
106 text_size = 1.25; 108 text_size = 1.25;
107 if (text_size > 0.0001) 109 if (text_size > MIN_TEXT_SIZE)
108 fprintf(svgfile, "<text transform=\"translate(%1.6f,%1.6f)\" font-size=\"%1.6fpt\">%i</text>\n", 110 fprintf(svgfile, "<text transform=\"translate(%1.8f,%1.8f)\" font-size=\"%1.6fpt\">%i</text>\n",
109 time2pixels(start), Yslot * SLOT_MULT + SLOT_HEIGHT - 1, text_size, cpu + 1); 111 time2pixels(start), Yslot * SLOT_MULT + SLOT_HEIGHT - 1, text_size, cpu + 1);
110 112
111} 113}
@@ -146,10 +148,10 @@ void svg_cpu_box(int cpu, u64 __max_freq, u64 __turbo_freq)
146 cpu2y(cpu), SLOT_MULT+SLOT_HEIGHT); 148 cpu2y(cpu), SLOT_MULT+SLOT_HEIGHT);
147 149
148 sprintf(cpu_string, "CPU %i", (int)cpu+1); 150 sprintf(cpu_string, "CPU %i", (int)cpu+1);
149 fprintf(svgfile, "<text transform=\"translate(%4.1f,%4.1f)\">%s</text>\n", 151 fprintf(svgfile, "<text transform=\"translate(%4.8f,%4.8f)\">%s</text>\n",
150 10+time2pixels(first_time), cpu2y(cpu) + SLOT_HEIGHT/2, cpu_string); 152 10+time2pixels(first_time), cpu2y(cpu) + SLOT_HEIGHT/2, cpu_string);
151 153
152 fprintf(svgfile, "<text transform=\"translate(%4.1f,%4.1f)\" font-size=\"1.25pt\">%s</text>\n", 154 fprintf(svgfile, "<text transform=\"translate(%4.8f,%4.8f)\" font-size=\"1.25pt\">%s</text>\n",
153 10+time2pixels(first_time), cpu2y(cpu) + SLOT_MULT + SLOT_HEIGHT - 4, cpu_model()); 155 10+time2pixels(first_time), cpu2y(cpu) + SLOT_MULT + SLOT_HEIGHT - 4, cpu_model());
154} 156}
155 157
@@ -166,8 +168,8 @@ void svg_process(int cpu, u64 start, u64 end, const char *type, const char *name
166 if (width > 6) 168 if (width > 6)
167 width = 6; 169 width = 6;
168 170
169 if (width > 0.001) 171 if (width > MIN_TEXT_SIZE)
170 fprintf(svgfile, "<text transform=\"translate(%4.5f,%4.5f) rotate(90)\" font-size=\"%3.4fpt\">%s</text>\n", 172 fprintf(svgfile, "<text transform=\"translate(%4.8f,%4.8f) rotate(90)\" font-size=\"%3.4fpt\">%s</text>\n",
171 time2pixels(start), cpu2y(cpu), width, name); 173 time2pixels(start), cpu2y(cpu), width, name);
172} 174}
173 175
@@ -193,8 +195,8 @@ void svg_cstate(int cpu, u64 start, u64 end, int type)
193 if (width > 6) 195 if (width > 6)
194 width = 6; 196 width = 6;
195 197
196 if (width > 0.05) 198 if (width > MIN_TEXT_SIZE)
197 fprintf(svgfile, "<text transform=\"translate(%4.5f,%4.5f) rotate(90)\" font-size=\"%3.4fpt\">C%i</text>\n", 199 fprintf(svgfile, "<text transform=\"translate(%4.8f,%4.8f) rotate(90)\" font-size=\"%3.4fpt\">C%i</text>\n",
198 time2pixels(start), cpu2y(cpu), width, type); 200 time2pixels(start), cpu2y(cpu), width, type);
199} 201}
200 202
@@ -234,7 +236,7 @@ void svg_pstate(int cpu, u64 start, u64 end, u64 freq)
234 height = 1 + cpu2y(cpu) + SLOT_MULT + SLOT_HEIGHT - height; 236 height = 1 + cpu2y(cpu) + SLOT_MULT + SLOT_HEIGHT - height;
235 fprintf(svgfile, "<line x1=\"%4.8f\" x2=\"%4.8f\" y1=\"%4.1f\" y2=\"%4.1f\" class=\"pstate\"/>\n", 237 fprintf(svgfile, "<line x1=\"%4.8f\" x2=\"%4.8f\" y1=\"%4.1f\" y2=\"%4.1f\" class=\"pstate\"/>\n",
236 time2pixels(start), time2pixels(end), height, height); 238 time2pixels(start), time2pixels(end), height, height);
237 fprintf(svgfile, "<text transform=\"translate(%4.1f,%4.1f)\" font-size=\"0.25pt\">%s</text>\n", 239 fprintf(svgfile, "<text transform=\"translate(%4.8f,%4.8f)\" font-size=\"0.25pt\">%s</text>\n",
238 time2pixels(start), height+0.9, HzToHuman(freq)); 240 time2pixels(start), height+0.9, HzToHuman(freq));
239 241
240} 242}
@@ -311,7 +313,7 @@ void svg_text(int Yslot, u64 start, const char *text)
311 if (!svgfile) 313 if (!svgfile)
312 return; 314 return;
313 315
314 fprintf(svgfile, "<text transform=\"translate(%4.1f,%4.1f)\">%s</text>\n", 316 fprintf(svgfile, "<text transform=\"translate(%4.8f,%4.8f)\">%s</text>\n",
315 time2pixels(start), Yslot * SLOT_MULT+SLOT_HEIGHT/2, text); 317 time2pixels(start), Yslot * SLOT_MULT+SLOT_HEIGHT/2, text);
316} 318}
317 319
@@ -322,7 +324,7 @@ static void svg_legenda_box(int X, const char *text, const char *style)
322 324
323 fprintf(svgfile, "<rect x=\"%i\" width=\"%4.8f\" y=\"0\" height=\"%4.1f\" class=\"%s\"/>\n", 325 fprintf(svgfile, "<rect x=\"%i\" width=\"%4.8f\" y=\"0\" height=\"%4.1f\" class=\"%s\"/>\n",
324 X, boxsize, boxsize, style); 326 X, boxsize, boxsize, style);
325 fprintf(svgfile, "<text transform=\"translate(%4.1f, %4.1f)\" font-size=\"%4.4fpt\">%s</text>\n", 327 fprintf(svgfile, "<text transform=\"translate(%4.8f, %4.8f)\" font-size=\"%4.4fpt\">%s</text>\n",
326 X + boxsize + 5, boxsize, 0.8 * boxsize, text); 328 X + boxsize + 5, boxsize, 0.8 * boxsize, text);
327} 329}
328 330