Re: [RFC/PATCH 1/2] perf top: Fix -z option behavior

Namhyung Kim
2014-08-19T06:07:51Z

On Wed, 13 Aug 2014 17:27:56 -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Aug 12, 2014 at 05:16:05PM +0900, Namhyung Kim escreveu:
>> The current -z option does almost nothing. It doesn't zero the
>> existing samples so that we can see profiles of exited process after
>> last refresh. It seems it only affects annotation.
>>
>> This patch clears existing entries before processing if -z option is
>> given. For this original decaying logic also moved before processing.
>
> So, this is two things bolted into one, i.e. it is not stated here why
> decaying needs to be done before resorting. I bet its because since
> we're zeroing everything, no need to decay anything, right?

Exactly.

>
> Stating more clearly what is the intent and the reason for changes helps
> reviewing.

Yep, will do better next time.

>
> Anyway, will add a note about that and apply the change.

Thank you!

>
> Also, the delete entries thing could zero total stats in struct hists,
> which is not a problem currently, because, IIRC, the collapse/resort
> logic will do that when it rotates the hists, but if we ever want to
> just delete events and then add a bunch of events without resorting, we
> will end up with bogus stats that will have the sum of the old events
> stats with the new ones.

Right. I'll send the fix.

Thanks,
Namhyung