Lines Matching refs:mm
36 static inline void minmax_init(struct minmax *mm) in minmax_init() argument
38 mm->min = -1ULL; in minmax_init()
39 mm->max = 0; in minmax_init()
40 mm->sum = 0; in minmax_init()
41 mm->sos = 0; in minmax_init()
42 mm->num = 0; in minmax_init()
45 static inline void minmax_account(struct minmax *mm, __u64 value) in minmax_account() argument
47 mm->sum += value; in minmax_account()
48 mm->sos += value * value; in minmax_account()
49 if (value < mm->min) in minmax_account()
50 mm->min = value; in minmax_account()
51 if (value > mm->max) in minmax_account()
52 mm->max = value; in minmax_account()
53 mm->num++; in minmax_account()
67 static inline void minmax_to_be(struct minmax *mm) in minmax_to_be() argument
69 mm->sum = cpu_to_be64(mm->sum); in minmax_to_be()
70 mm->sos = cpu_to_be64(mm->sos); in minmax_to_be()
71 mm->min = cpu_to_be64(mm->min); in minmax_to_be()
72 mm->max = cpu_to_be64(mm->max); in minmax_to_be()
73 mm->num = cpu_to_be64(mm->num); in minmax_to_be()
76 static inline double minmax_avg(struct minmax *mm) in minmax_avg() argument
78 if (!mm->num) in minmax_avg()
81 return (mm->sum / (double)mm->num); in minmax_avg()
84 static inline double minmax_var(struct minmax *mm) in minmax_var() argument
86 double num = (double)mm->num; in minmax_var()
88 if (!mm->num) in minmax_var()
91 return ((mm->sos - ((mm->sum * mm->sum) / num)) / num); in minmax_var()
94 static inline int minmax_print(FILE *fp, const char *s, struct minmax *mm) in minmax_print() argument
97 "avg %.1f, var %.1f\n", s, (unsigned long long)mm->num, in minmax_print()
98 (unsigned long long)mm->min, (unsigned long long)mm->max, in minmax_print()
99 (unsigned long long)mm->sum, (unsigned long long)mm->sos, in minmax_print()
100 minmax_avg(mm), minmax_var(mm)); in minmax_print()