Re: [Patch 5/6] statistics infrastructure

From: Nikita Danilov
Date: Thu May 25 2006 - 04:09:24 EST


Martin Peschke writes:
> This patch adds statistics infrastructure as common code.
>

[...]

> +
> +static void statistic_add_util(struct statistic *stat, int cpu,
> + s64 value, u64 incr)
> +{
> + struct statistic_entry_util *util = stat->pdata->ptrs[cpu];
> + util->num += incr;
> + util->acc += value * incr;
> + if (unlikely(value < util->min))
> + util->min = value;
> + if (unlikely(value > util->max))
> + util->max = value;

One useful aggregate that can be calculated here is a standard
deviation. Something like

util->acc_sq += value * incr * value * incr; /* sum of squares */

And in statistic_fdata_util() squared standard deviation is

std_dev = util->acc_sq;
/*
* Difference of averaged square and squared average.
*/
std_dev = do_div(std_dev, util->num) - whole * whole;

> +}

Nikita.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/