aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2009-09-24 09:40:13 -0400
committerIngo Molnar <mingo@elte.hu>2009-10-01 03:26:40 -0400
commit39a90a8ef17fe6fbf4b45e46e3c10d3b8b4a3dea (patch)
tree8aa8c5b0486d1d2cedace07bcb9e42189b4ccda5 /tools/perf
parent8357275bb919d91093bc5a959932ef7b1ea816e8 (diff)
perf timechart: Add a power-only mode
For doing work on the Linux power management components, I need to make long (30+ seconds) traces. Currently, this then results in a HUGE svg file, with mostly process data that isn't interesting. This patch adds a --power-only mode to perf timechart that only outputs the CPU power section of the SVG; this significantly reduces the size of the SVG file, making even 30+ second traces viewable with inkscape. As a minor tweak for the same effect, the minimum text size is decreased; current inkscape cannot zoom in deep enough to show text this small, but it reduces inkscape compute time. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Cc: peterz@infradead.org LKML-Reference: <20090924154013.0675ab71@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/Documentation/perf-timechart.txt3
-rw-r--r--tools/perf/builtin-timechart.c10
-rw-r--r--tools/perf/util/svghelper.c14
3 files changed, 23 insertions, 4 deletions
diff --git a/tools/perf/Documentation/perf-timechart.txt b/tools/perf/Documentation/perf-timechart.txt
index 1c2ed3090cce..a7910099d6fd 100644
--- a/tools/perf/Documentation/perf-timechart.txt
+++ b/tools/perf/Documentation/perf-timechart.txt
@@ -31,6 +31,9 @@ OPTIONS
31-w:: 31-w::
32--width=:: 32--width=::
33 Select the width of the SVG file (default: 1000) 33 Select the width of the SVG file (default: 1000)
34-p::
35--power-only::
36 Only output the CPU power section of the diagram
34 37
35 38
36SEE ALSO 39SEE ALSO
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 4405681b3134..702d8fe58fbc 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -46,6 +46,8 @@ static u64 turbo_frequency;
46 46
47static u64 first_time, last_time; 47static u64 first_time, last_time;
48 48
49static int power_only;
50
49 51
50static struct perf_header *header; 52static struct perf_header *header;
51 53
@@ -547,7 +549,7 @@ static void end_sample_processing(void)
547 u64 cpu; 549 u64 cpu;
548 struct power_event *pwr; 550 struct power_event *pwr;
549 551
550 for (cpu = 0; cpu < numcpus; cpu++) { 552 for (cpu = 0; cpu <= numcpus; cpu++) {
551 pwr = malloc(sizeof(struct power_event)); 553 pwr = malloc(sizeof(struct power_event));
552 if (!pwr) 554 if (!pwr)
553 return; 555 return;
@@ -871,7 +873,7 @@ static int determine_display_tasks(u64 threshold)
871 /* no exit marker, task kept running to the end */ 873 /* no exit marker, task kept running to the end */
872 if (p->end_time == 0) 874 if (p->end_time == 0)
873 p->end_time = last_time; 875 p->end_time = last_time;
874 if (p->total_time >= threshold) 876 if (p->total_time >= threshold && !power_only)
875 p->display = 1; 877 p->display = 1;
876 878
877 c = p->all; 879 c = p->all;
@@ -882,7 +884,7 @@ static int determine_display_tasks(u64 threshold)
882 if (c->start_time == 1) 884 if (c->start_time == 1)
883 c->start_time = first_time; 885 c->start_time = first_time;
884 886
885 if (c->total_time >= threshold) { 887 if (c->total_time >= threshold && !power_only) {
886 c->display = 1; 888 c->display = 1;
887 count++; 889 count++;
888 } 890 }
@@ -1134,6 +1136,8 @@ static const struct option options[] = {
1134 "output file name"), 1136 "output file name"),
1135 OPT_INTEGER('w', "width", &svg_page_width, 1137 OPT_INTEGER('w', "width", &svg_page_width,
1136 "page width"), 1138 "page width"),
1139 OPT_BOOLEAN('p', "power-only", &power_only,
1140 "output power data only"),
1137 OPT_END() 1141 OPT_END()
1138}; 1142};
1139 1143
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c
index a778fd0f4ae4..856655d8b0b8 100644
--- a/tools/perf/util/svghelper.c
+++ b/tools/perf/util/svghelper.c
@@ -28,7 +28,7 @@ static u64 turbo_frequency, max_freq;
28 28
29int svg_page_width = 1000; 29int svg_page_width = 1000;
30 30
31#define MIN_TEXT_SIZE 0.001 31#define MIN_TEXT_SIZE 0.01
32 32
33static u64 total_height; 33static u64 total_height;
34static FILE *svgfile; 34static FILE *svgfile;
@@ -217,6 +217,18 @@ static char *cpu_model(void)
217 } 217 }
218 fclose(file); 218 fclose(file);
219 } 219 }
220
221 /* CPU type */
222 file = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies", "r");
223 if (file) {
224 while (fgets(buf, 255, file)) {
225 unsigned int freq;
226 freq = strtoull(buf, NULL, 10);
227 if (freq > max_freq)
228 max_freq = freq;
229 }
230 fclose(file);
231 }
220 return cpu_m; 232 return cpu_m;
221} 233}
222 234