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 [email protected]
> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to