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 printf("static const u32 runnable_avg_yN_inv[] = {");
24 for (i
= 0; i
< HALFLIFE
; i
++) {
25 x
= ((1UL<<32)-1)*pow(y
, i
);
27 if (i
% 6 == 0) printf("\n\t");
35 void calc_runnable_avg_yN_sum(void)
39 printf("static const u32 runnable_avg_yN_sum[] = {\n\t 0,");
40 for (i
= 1; i
<= HALFLIFE
; i
++) {
58 void calc_converged_max(void)
60 long last
= 0, y_inv
= ((1UL<<32)-1)*y
;
64 max
= ((max
*y_inv
)>>SHIFT
) + 1024;
66 * This is the same as:
76 printf("#define LOAD_AVG_PERIOD %d\n", HALFLIFE
);
77 printf("#define LOAD_AVG_MAX %ld\n", max
);
78 // printf("#define LOAD_AVG_MAX_N %d\n\n", n);
81 void calc_accumulated_sum_32(void)
85 printf("static const u32 __accumulated_sum_N32[] = {\n\t 0,");
86 for (i
= 1; i
<= n
/HALFLIFE
+1; i
++) {
100 printf("/* Generated by Documentation/scheduler/sched-pelt; do not modify. */\n\n");
102 y
= pow(0.5, 1/(double)HALFLIFE
);
104 calc_runnable_avg_yN_inv();
105 // calc_runnable_avg_yN_sum();
106 calc_converged_max();
107 // calc_accumulated_sum_32();