mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Stanislav Fomichev <stfomichev@yandex-team.ru>
Cc: a.p.zijlstra@chello.nl, paulus@samba.org, mingo@redhat.com,
	acme@ghostprotocols.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/6] perf timechart: use proc_num to implement --power-only
Date: Tue, 29 Oct 2013 17:03:51 +0900	[thread overview]
Message-ID: <87txg05wrc.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <1382439412-23713-3-git-send-email-stfomichev@yandex-team.ru> (Stanislav Fomichev's message of "Tue, 22 Oct 2013 14:56:48 +0400")

On Tue, 22 Oct 2013 14:56:48 +0400, Stanislav Fomichev wrote:
> Don't use special flag to indicate power-only mode, use proc_num == 0.
> -P now equals to -n 0

I don't see how it does same thing.  You mean it by skipping
draw_process_bars() and draw_wakeups() on patch 1?  It'd be better
changelog explains the details.

>
> Signed-off-by: Stanislav Fomichev <stfomichev@yandex-team.ru>
> ---
>  tools/perf/builtin-timechart.c | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
> index d965f26308ed..e6c041301aa4 100644
> --- a/tools/perf/builtin-timechart.c
> +++ b/tools/perf/builtin-timechart.c
> @@ -50,8 +50,6 @@ static u64		turbo_frequency;
>  
>  static u64		first_time, last_time;
>  
> -static bool		power_only;
> -
>  
>  struct per_pid;
>  struct per_pidcomm;
> @@ -912,7 +910,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 && !power_only)
> +		if (p->total_time >= threshold)
>  			p->display = 1;
>  
>  		c = p->all;
> @@ -923,7 +921,7 @@ static int determine_display_tasks(u64 threshold)
>  			if (c->start_time == 1)
>  				c->start_time = first_time;
>  
> -			if (c->total_time >= threshold && !power_only) {
> +			if (c->total_time >= threshold) {
>  				c->display = 1;
>  				count++;
>  			}
> @@ -1086,6 +1084,15 @@ parse_process(const struct option *opt __maybe_unused, const char *arg,
>  	return 0;
>  }
>  
> +static int
> +parse_power(const struct option *opt __maybe_unused,
> +	    const char *arg __maybe_unused,
> +	    int unset __maybe_unused)
> +{
> +	proc_num = 0;
> +	return 0;
> +}
> +
>  int cmd_timechart(int argc, const char **argv,
>  		  const char *prefix __maybe_unused)
>  {
> @@ -1094,7 +1101,8 @@ int cmd_timechart(int argc, const char **argv,
>  	OPT_STRING('i', "input", &input_name, "file", "input file name"),
>  	OPT_STRING('o', "output", &output_name, "file", "output file name"),
>  	OPT_INTEGER('w', "width", &svg_page_width, "page width"),
> -	OPT_BOOLEAN('P', "power-only", &power_only, "output power data only"),
> +	OPT_CALLBACK_NOOPT('P', "power-only", NULL, NULL,
> +		     "output power data only", parse_power),

And I'd like to keep it as BOOLEAN option - it's simpler and more
straight-forward IMHO.

How about adding

	if (power_only)
		proc_num = 0;

after parsing the command line options?

Thanks,
Namhyung


>  	OPT_CALLBACK('p', "process", NULL, "process",
>  		      "process selector. Pass a pid or process name.",
>  		       parse_process),

  reply	other threads:[~2013-10-29  8:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-22 10:56 [PATCH 0/6] perf timechart improvements Stanislav Fomichev
2013-10-22 10:56 ` [PATCH 1/6] perf timechart: always try to print at least 15 tasks Stanislav Fomichev
2013-10-29  7:50   ` Namhyung Kim
2013-10-29  9:24     ` Stanislav Fomichev
2013-11-01  6:06       ` Namhyung Kim
2013-10-22 10:56 ` [PATCH 2/6] perf timechart: use proc_num to implement --power-only Stanislav Fomichev
2013-10-29  8:03   ` Namhyung Kim [this message]
2013-10-29  9:28     ` Stanislav Fomichev
2013-11-01  6:07       ` Namhyung Kim
2013-10-22 10:56 ` [PATCH 3/6] perf timechart: add support for displaying only tasks related data Stanislav Fomichev
2013-10-29  8:10   ` Namhyung Kim
2013-10-29  9:33     ` Stanislav Fomichev
2013-11-01  6:10       ` Namhyung Kim
2013-10-22 10:56 ` [PATCH 4/6] perf timechart: group figures and add title with details Stanislav Fomichev
2013-10-29  8:15   ` Namhyung Kim
2013-10-29  9:35     ` Stanislav Fomichev
2013-10-22 10:56 ` [PATCH 5/6] perf timechart: add support for -P and -T in timechart recording Stanislav Fomichev
2013-10-29  8:27   ` Namhyung Kim
2013-10-29  9:51     ` Stanislav Fomichev
2013-10-22 10:56 ` [PATCH 6/6] perf timechart: add backtrace support Stanislav Fomichev
2013-10-29  8:41   ` Namhyung Kim

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=87txg05wrc.fsf@sejong.aot.lge.com \
    --to=namhyung@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=stfomichev@yandex-team.ru \
    /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

all inboxes | Powered by JetHome®