public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Andi Kleen <ak@linux.intel.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	acme@kernel.org, jolsa@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] perf, tools: Output running time and run/enabled ratio in CSV mode
Date: Wed, 11 Mar 2015 09:52:41 +0900	[thread overview]
Message-ID: <20150311005241.GI943@sejong> (raw)
In-Reply-To: <20150310153704.GH31334@tassilo.jf.intel.com>

On Tue, Mar 10, 2015 at 08:37:04AM -0700, Andi Kleen wrote:
> > Why not handle both cases here?
> > 
> > static void print_running(u64 run, u64 ena)
> > {
> > 	if (csv_output)
> > 		fprintf(output, ...);
> > 	else if (run != ena)
> > 		fprintf(output, ...);
> > }
> 
> print_running has 6 callers. run != ena is only needed
> for two of them. So I don't think it makes sense to do.

Those 6 are from print_aggr(), print_counter_aggr() and
print_counter().  They all have two branch - one is for no-scaling or
not-supported counter (I guess run or ena being 0 goes to this case),
another is scaling case - so IMHO print_counter_aggr() should check
the run and the ena in this case too.

The former can call print_running() to print empty column to CSV and
discard normal (scaling) output.  The latter also can call
print_running() to print for both output.

So by using print_running(), we can enforce same check to all cases
and reduce code duplication also IMHO.

Thanks,
Namhyung

> 
> -Andi
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2015-03-11  0:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-08 23:55 A number of perf stat improvements Andi Kleen
2015-03-08 23:55 ` [PATCH 1/4] perf, tools: Output running time and run/enabled ratio in CSV mode Andi Kleen
2015-03-09  7:49   ` Jiri Olsa
2015-03-09 14:04     ` Andi Kleen
2015-03-10  7:15   ` Namhyung Kim
2015-03-10 15:37     ` Andi Kleen
2015-03-11  0:52       ` Namhyung Kim [this message]
2015-03-08 23:55 ` [PATCH 2/4] perf, tools: Fix metrics calculation with event qualifiers Andi Kleen
2015-03-09  7:55   ` Jiri Olsa
2015-03-08 23:55 ` [PATCH 3/4] perf, tools, stat: Fix IPC and other formulas with -A Andi Kleen
2015-03-09  8:11   ` Jiri Olsa
2015-03-08 23:55 ` [PATCH 4/4] perf, tools, stat: Always correctly indent ratio column Andi Kleen
2015-03-09  8:24   ` Jiri Olsa
2015-03-11 13:35 ` A number of perf stat improvements Arnaldo Carvalho de Melo
2015-03-11 15:29   ` Andi Kleen
2015-03-11 19:13     ` Arnaldo Carvalho de Melo

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=20150311005241.GI943@sejong \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.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