Re: [PATCH 03/14] perf hists: Convert hist entry functions to use struct he_stat

Arnaldo Carvalho de Melo
2013-11-04T23:46:06Z

Em Thu, Oct 31, 2013 at 03:56:05PM +0900, Namhyung Kim escreveu:

> -static void hist_entry__add_cpumode_period(struct hist_entry *he,
> +static void hist_entry__add_cpumode_period(struct he_stat *he_stat,
> unsigned int cpumode, u64 period)

So it is not anymore a 'struct hist_entry' method, but a 'struct
he_stat' one, thus these functions need to be renamed accordingly, in
the above case it should be:

-static void hist_entry__add_cpumode_period(struct hist_entry *he,
+static void he_stat__add_cpumode_period(struct he_stat *he_stat,
+ unsigned int cpumode, u64 period)

> {
> switch (cpumode) {
> case PERF_RECORD_MISC_KERNEL:
> - he->stat.period_sys += period;
> + he_stat->period_sys += period;
> break;
> case PERF_RECORD_MISC_USER:
> - he->stat.period_us += period;
> + he_stat->period_us += period;
> break;
> case PERF_RECORD_MISC_GUEST_KERNEL:
> - he->stat.period_guest_sys += period;
> + he_stat->period_guest_sys += period;
> break;
> case PERF_RECORD_MISC_GUEST_USER:
> - he->stat.period_guest_us += period;
> + he_stat->period_guest_us += period;
> break;
> default:
> break;
> @@ -223,10 +223,10 @@ static void he_stat__add_stat(struct he_stat *dest, struct he_stat *src)
> dest->weight += src->weight;
> }
>
> -static void hist_entry__decay(struct hist_entry *he)
> +static void hist_entry__decay(struct he_stat *he_stat)

Ditto

> {
> - he->stat.period = (he->stat.period * 7) / 8;
> - he->stat.nr_events = (he->stat.nr_events * 7) / 8;
> + he_stat->period = (he_stat->period * 7) / 8;