aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/biomerge.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-25 23:24:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-25 23:24:05 -0400
commit0dd61be7ec1be1b6820af978f901b9ae2c244dc6 (patch)
tree1f49edaa21351034e7d1dff6511424e9a949cf6b /drivers/xen/biomerge.c
parent8dd90265ac0754da0df47d9c597f25187bb1c947 (diff)
parentab7798ffcf98b11a9525cf65bacdae3fd58d357f (diff)
Merge branch 'irq-cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'irq-cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (23 commits) genirq: Expand generic show_interrupts() gpio: Fold irq_set_chip/irq_set_handler to irq_set_chip_and_handler gpio: Cleanup genirq namespace arm: ep93xx: Add basic interrupt info arm/gpio: Remove three copies of broken and racy debug code xtensa: Use generic show_interrupts() xtensa: Convert genirq namespace xtensa: Use generic IRQ Kconfig and set GENERIC_HARDIRQS_NO_DEPRECATED xtensa: Convert s6000 gpio irq_chip to new functions xtensa: Convert main irq_chip to new functions um: Use generic show_interrupts() um: Convert genirq namespace m32r: Use generic show_interrupts() m32r: Convert genirq namespace h8300: Use generic show_interrupts() h8300: Convert genirq namespace avr32: Cleanup eic_set_irq_type() avr32: Use generic show_interrupts() avr: Cleanup genirq namespace avr32: Use generic IRQ config, enable GENERIC_HARDIRQS_NO_DEPRECATED ... Fix up trivial conflict in drivers/gpio/timbgpio.c
Diffstat (limited to 'drivers/xen/biomerge.c')
0 files changed, 0 insertions, 0 deletions
"hl ppc">#include <linux/average.h> #include <linux/kernel.h> #include <linux/bug.h> #include <linux/log2.h> /** * DOC: Exponentially Weighted Moving Average (EWMA) * * These are generic functions for calculating Exponentially Weighted Moving * Averages (EWMA). We keep a structure with the EWMA parameters and a scaled * up internal representation of the average value to prevent rounding errors. * The factor for scaling up and the exponential weight (or decay rate) have to * be specified thru the init fuction. The structure should not be accessed * directly but only thru the helper functions. */ /** * ewma_init() - Initialize EWMA parameters * @avg: Average structure * @factor: Factor to use for the scaled up internal value. The maximum value * of averages can be ULONG_MAX/(factor*weight). For performance reasons * factor has to be a power of 2. * @weight: Exponential weight, or decay rate. This defines how fast the * influence of older values decreases. For performance reasons weight has * to be a power of 2. * * Initialize the EWMA parameters for a given struct ewma @avg. */ void ewma_init(struct ewma *avg, unsigned long factor, unsigned long weight) { WARN_ON(!is_power_of_2(weight) || !is_power_of_2(factor)); avg->weight = ilog2(weight); avg->factor = ilog2(factor); avg->internal = 0; } EXPORT_SYMBOL(ewma_init); /** * ewma_add() - Exponentially weighted moving average (EWMA) * @avg: Average structure * @val: Current value * * Add a sample to the average. */ struct ewma *ewma_add(struct ewma *avg, unsigned long val) { avg->internal = avg->internal ? (((avg->internal << avg->weight) - avg->internal) + (val << avg->factor)) >> avg->weight : (val << avg->factor); return avg; } EXPORT_SYMBOL(ewma_add);