13 #include <linux/kernel.h>
16 #include <linux/time.h>
18 #include <linux/hrtimer.h>
20 #include <linux/sched.h>
22 #include <linux/module.h>
26 #define RESOLUTION 1024
28 #define MAX_INTERESTING 50000
29 #define STDDEV_THRESH 400
126 #define LOAD_INT(x) ((x) >> FSHIFT)
127 #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
129 static int get_loadavg(
void)
137 static inline int which_bucket(
unsigned int duration)
156 if (duration < 10000)
158 if (duration < 100000)
170 static inline int performance_multiplier(
void)
176 mult += 2 * get_loadavg();
191 return div_u64(dividend + (divisor / 2), divisor);
209 avg = avg / INTERVALS;
239 int power_usage = -1;
245 menu_update(drv, dev);
257 t = ktime_to_timespec(tick_nohz_get_sleep_length());
264 multiplier = performance_multiplier();
277 detect_repeating_patterns(data);
340 unsigned int last_idle_us = cpuidle_get_last_residency(dev);
342 unsigned int measured_us;
354 measured_us = last_idle_us;
360 if (measured_us > data->
exit_us)
367 * (DECAY - 1) / DECAY;
411 .enable = menu_enable_device,
412 .select = menu_select,
413 .reflect = menu_reflect,
420 static int __init init_menu(
void)
428 static void __exit exit_menu(
void)