]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - include/linux/average.h
1 #ifndef _LINUX_AVERAGE_H
2 #define _LINUX_AVERAGE_H
4 /* Exponentially weighted moving average (EWMA) */
6 /* For more documentation see lib/average.c */
9 unsigned long internal
;
14 extern void ewma_init(struct ewma
*avg
, unsigned long factor
,
15 unsigned long weight
);
17 extern struct ewma
*ewma_add(struct ewma
*avg
, unsigned long val
);
20 * ewma_read() - Get average value
21 * @avg: Average structure
23 * Returns the average value held in @avg.
25 static inline unsigned long ewma_read(const struct ewma
*avg
)
27 return avg
->internal
>> avg
->factor
;
30 #endif /* _LINUX_AVERAGE_H */