mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Arjan van de Ven <arjan@infradead.org>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, peterz@infradead.org
Subject: Re: [patch] perf timechart: Add a power-only mode
Date: Thu, 24 Sep 2009 15:47:01 +0200	[thread overview]
Message-ID: <4ABB7855.4080409@gmail.com> (raw)
In-Reply-To: <20090924154013.0675ab71@infradead.org>

Arjan van de Ven a écrit :
> From: Arjan van de Ven <arjan@linux.intel.com>
> Subject: 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>
> 
> diff --git a/tools/perf/Documentation/perf-timechart.txt b/tools/perf/Documentation/perf-timechart.txt
> index 1c2ed30..a791009 100644
> --- a/tools/perf/Documentation/perf-timechart.txt
> +++ b/tools/perf/Documentation/perf-timechart.txt
> @@ -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
> diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
> index 4405681..702d8fe 100644
> --- a/tools/perf/builtin-timechart.c
> +++ b/tools/perf/builtin-timechart.c
> @@ -46,6 +46,8 @@ static u64		turbo_frequency;
>  
>  static u64		first_time, last_time;
>  
> +static int		power_only;
> +
>  
>  static struct perf_header	*header;
>  
> @@ -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++) {

hmm, why test is now "cpu <= numcpus" ?

>  		pwr = malloc(sizeof(struct power_event));
>  		if (!pwr)
>  			return;
> @@ -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;
> @@ -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++;
>  			}
> @@ -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()
>  };
>  
> diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c
> index a778fd0..856655d 100644
> --- a/tools/perf/util/svghelper.c
> +++ b/tools/perf/util/svghelper.c
> @@ -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;
> @@ -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 this cpu is offline

 /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies: No such file or directory


> +	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;
>  }
>  
> 
> 


  reply	other threads:[~2009-09-24 13:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-24 13:40 Arjan van de Ven
2009-09-24 13:47 ` Eric Dumazet [this message]
2009-09-24 13:51   ` Arjan van de Ven
2009-10-01  7:46 ` [tip:perf/urgent] " tip-bot for Arjan van de Ven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ABB7855.4080409@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome