2 * lib/minmax.c: windowed min/max tracker by Kathleen Nichols.
8 #include <linux/types.h>
10 /* A single data point for our parameterized min-max tracker */
11 struct minmax_sample {
12 u32 t; /* time measurement was taken */
13 u32 v; /* value measured */
16 /* State for the parameterized min-max tracker */
18 struct minmax_sample s[3];
21 static inline u32 minmax_get(const struct minmax *m)
26 static inline u32 minmax_reset(struct minmax *m, u32 t, u32 meas)
28 struct minmax_sample val = { .t = t, .v = meas };
30 m->s[2] = m->s[1] = m->s[0] = val;
34 u32 minmax_running_max(struct minmax *m, u32 win, u32 t, u32 meas);
35 u32 minmax_running_min(struct minmax *m, u32 win, u32 t, u32 meas);