Hi Jiri,

On Tue, 22 Apr 2014 16:51:03 +0200, Jiri Olsa wrote:
> On Tue, Apr 22, 2014 at 05:49:43PM +0900, Namhyung Kim wrote:
>> Those stats are counted counted in multiple places so that they can
>> confuse readers of the code.  This is a preparation of later change
>> and do not intend any functional difference.

[SNIP]
>> +    rep->nr_samples++;
>> +    if (he->stat.nr_events == 1) {
>> +            /* count new entries only */
>> +            rep->nr_entries++;
>> +    }
>
> smeels like we could use function for this ^^^
>
> also it took me a while to figure out the reason for the condition,
> maybe there could be more comment about that

Okay, so I changed it like below:

static void report__inc_stats(struct report *rep, struct hist_entry *he)
{
        /*
         * The @he is either of a newly created one or an existing one
         * merging current sample.  We only want to count a new one so
         * checking ->nr_events being 1.
         */
        if (he->stat.nr_events == 1)
                rep->nr_entries++;
}

This also eliminated the unneeded nr_samples field.

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 via email to