[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150311005241.GI943@sejong>
Date: Wed, 11 Mar 2015 09:52:41 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Andi Kleen <ak@...ux.intel.com>
Cc: Andi Kleen <andi@...stfloor.org>, acme@...nel.org,
jolsa@...hat.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/4] perf, tools: Output running time and run/enabled
ratio in CSV mode
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@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists