提交 39a90a8e 编写于 作者: A Arjan van de Ven 提交者: Ingo Molnar

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: NArjan van de Ven <arjan@linux.intel.com>
Cc: peterz@infradead.org
LKML-Reference: <20090924154013.0675ab71@infradead.org>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 8357275b
...@@ -31,6 +31,9 @@ OPTIONS ...@@ -31,6 +31,9 @@ OPTIONS
-w:: -w::
--width=:: --width=::
Select the width of the SVG file (default: 1000) Select the width of the SVG file (default: 1000)
-p::
--power-only::
Only output the CPU power section of the diagram
SEE ALSO SEE ALSO
......
...@@ -46,6 +46,8 @@ static u64 turbo_frequency; ...@@ -46,6 +46,8 @@ static u64 turbo_frequency;
static u64 first_time, last_time; static u64 first_time, last_time;
static int power_only;
static struct perf_header *header; static struct perf_header *header;
...@@ -547,7 +549,7 @@ static void end_sample_processing(void) ...@@ -547,7 +549,7 @@ static void end_sample_processing(void)
u64 cpu; u64 cpu;
struct power_event *pwr; struct power_event *pwr;
for (cpu = 0; cpu < numcpus; cpu++) { for (cpu = 0; cpu <= numcpus; cpu++) {
pwr = malloc(sizeof(struct power_event)); pwr = malloc(sizeof(struct power_event));
if (!pwr) if (!pwr)
return; return;
...@@ -871,7 +873,7 @@ static int determine_display_tasks(u64 threshold) ...@@ -871,7 +873,7 @@ static int determine_display_tasks(u64 threshold)
/* no exit marker, task kept running to the end */ /* no exit marker, task kept running to the end */
if (p->end_time == 0) if (p->end_time == 0)
p->end_time = last_time; p->end_time = last_time;
if (p->total_time >= threshold) if (p->total_time >= threshold && !power_only)
p->display = 1; p->display = 1;
c = p->all; c = p->all;
...@@ -882,7 +884,7 @@ static int determine_display_tasks(u64 threshold) ...@@ -882,7 +884,7 @@ static int determine_display_tasks(u64 threshold)
if (c->start_time == 1) if (c->start_time == 1)
c->start_time = first_time; c->start_time = first_time;
if (c->total_time >= threshold) { if (c->total_time >= threshold && !power_only) {
c->display = 1; c->display = 1;
count++; count++;
} }
...@@ -1134,6 +1136,8 @@ static const struct option options[] = { ...@@ -1134,6 +1136,8 @@ static const struct option options[] = {
"output file name"), "output file name"),
OPT_INTEGER('w', "width", &svg_page_width, OPT_INTEGER('w', "width", &svg_page_width,
"page width"), "page width"),
OPT_BOOLEAN('p', "power-only", &power_only,
"output power data only"),
OPT_END() OPT_END()
}; };
......
...@@ -28,7 +28,7 @@ static u64 turbo_frequency, max_freq; ...@@ -28,7 +28,7 @@ static u64 turbo_frequency, max_freq;
int svg_page_width = 1000; int svg_page_width = 1000;
#define MIN_TEXT_SIZE 0.001 #define MIN_TEXT_SIZE 0.01
static u64 total_height; static u64 total_height;
static FILE *svgfile; static FILE *svgfile;
...@@ -217,6 +217,18 @@ static char *cpu_model(void) ...@@ -217,6 +217,18 @@ static char *cpu_model(void)
} }
fclose(file); fclose(file);
} }
/* CPU type */
file = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies", "r");
if (file) {
while (fgets(buf, 255, file)) {
unsigned int freq;
freq = strtoull(buf, NULL, 10);
if (freq > max_freq)
max_freq = freq;
}
fclose(file);
}
return cpu_m; return cpu_m;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册