Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 166896
b: refs/heads/master
c: 39a90a8
h: refs/heads/master
v: v3
  • Loading branch information
Arjan van de Ven authored and Ingo Molnar committed Oct 1, 2009
1 parent 668d9a8 commit 2abb987
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8357275bb919d91093bc5a959932ef7b1ea816e8
refs/heads/master: 39a90a8ef17fe6fbf4b45e46e3c10d3b8b4a3dea
3 changes: 3 additions & 0 deletions trunk/tools/perf/Documentation/perf-timechart.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ OPTIONS
-w::
--width=::
Select the width of the SVG file (default: 1000)
-p::
--power-only::
Only output the CPU power section of the diagram


SEE ALSO
Expand Down
10 changes: 7 additions & 3 deletions trunk/tools/perf/builtin-timechart.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ static u64 turbo_frequency;

static u64 first_time, last_time;

static int power_only;


static struct perf_header *header;

Expand Down Expand Up @@ -547,7 +549,7 @@ static void end_sample_processing(void)
u64 cpu;
struct power_event *pwr;

for (cpu = 0; cpu < numcpus; cpu++) {
for (cpu = 0; cpu <= numcpus; cpu++) {
pwr = malloc(sizeof(struct power_event));
if (!pwr)
return;
Expand Down Expand Up @@ -871,7 +873,7 @@ static int determine_display_tasks(u64 threshold)
/* no exit marker, task kept running to the end */
if (p->end_time == 0)
p->end_time = last_time;
if (p->total_time >= threshold)
if (p->total_time >= threshold && !power_only)
p->display = 1;

c = p->all;
Expand All @@ -882,7 +884,7 @@ static int determine_display_tasks(u64 threshold)
if (c->start_time == 1)
c->start_time = first_time;

if (c->total_time >= threshold) {
if (c->total_time >= threshold && !power_only) {
c->display = 1;
count++;
}
Expand Down Expand Up @@ -1134,6 +1136,8 @@ static const struct option options[] = {
"output file name"),
OPT_INTEGER('w', "width", &svg_page_width,
"page width"),
OPT_BOOLEAN('p', "power-only", &power_only,
"output power data only"),
OPT_END()
};

Expand Down
14 changes: 13 additions & 1 deletion trunk/tools/perf/util/svghelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static u64 turbo_frequency, max_freq;

int svg_page_width = 1000;

#define MIN_TEXT_SIZE 0.001
#define MIN_TEXT_SIZE 0.01

static u64 total_height;
static FILE *svgfile;
Expand Down Expand Up @@ -217,6 +217,18 @@ static char *cpu_model(void)
}
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;
}

Expand Down

0 comments on commit 2abb987

Please sign in to comment.