2 * The following program is used to generate the constants for
3 * computing sched averages.
5 * ==============================================================
6 * C program (compile with -lm)
7 * ==============================================================
18 void calc_runnable_avg_yN_inv(void)
23 /* To silence -Wunused-but-set-variable warnings. */
24 printf("static const u32 runnable_avg_yN_inv[] __maybe_unused = {");
25 for (i
= 0; i
< HALFLIFE
; i
++) {
26 x
= ((1UL<<32)-1)*pow(y
, i
);
28 if (i
% 6 == 0) printf("\n\t");
36 void calc_runnable_avg_yN_sum(void)
40 printf("static const u32 runnable_avg_yN_sum[] = {\n\t 0,");
41 for (i
= 1; i
<= HALFLIFE
; i
++) {
59 void calc_converged_max(void)
61 long last
= 0, y_inv
= ((1UL<<32)-1)*y
;
65 max
= ((max
*y_inv
)>>SHIFT
) + 1024;
67 * This is the same as:
77 printf("#define LOAD_AVG_PERIOD %d\n", HALFLIFE
);
78 printf("#define LOAD_AVG_MAX %ld\n", max
);
79 // printf("#define LOAD_AVG_MAX_N %d\n\n", n);
82 void calc_accumulated_sum_32(void)
86 printf("static const u32 __accumulated_sum_N32[] = {\n\t 0,");
87 for (i
= 1; i
<= n
/HALFLIFE
+1; i
++) {
101 printf("/* Generated by Documentation/scheduler/sched-pelt; do not modify. */\n\n");
103 y
= pow(0.5, 1/(double)HALFLIFE
);
105 calc_runnable_avg_yN_inv();
106 // calc_runnable_avg_yN_sum();
107 calc_converged_max();
108 // calc_accumulated_sum_32();