Re: [Patch 5/6] statistics infrastructure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nikita Danilov wrote:
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.

Excellent idea. I will add the standard deviation.

Thanks, Martin

-
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/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux