-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 336704 b: refs/heads/master c: 2aacdff h: refs/heads/master v: v3
- Loading branch information
viresh kumar
authored and
Rafael J. Wysocki
committed
Nov 14, 2012
1 parent
34d14e4
commit d56ead6
Showing
6 changed files
with
60 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 4b972f0b04eaae645b22d99479b9aea43c3d64e7 | ||
refs/heads/master: 2aacdfff9c6958723aa5076003247933cefc32ea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* drivers/cpufreq/cpufreq_governor.c | ||
* | ||
* CPUFREQ governors common code | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
*/ | ||
|
||
#include <asm/cputime.h> | ||
#include <linux/export.h> | ||
#include <linux/kernel_stat.h> | ||
#include <linux/tick.h> | ||
#include <linux/types.h> | ||
/* | ||
* Code picked from earlier governer implementations | ||
*/ | ||
static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall) | ||
{ | ||
u64 idle_time; | ||
u64 cur_wall_time; | ||
u64 busy_time; | ||
|
||
cur_wall_time = jiffies64_to_cputime64(get_jiffies_64()); | ||
|
||
busy_time = kcpustat_cpu(cpu).cpustat[CPUTIME_USER]; | ||
busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SYSTEM]; | ||
busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_IRQ]; | ||
busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SOFTIRQ]; | ||
busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_STEAL]; | ||
busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_NICE]; | ||
|
||
idle_time = cur_wall_time - busy_time; | ||
if (wall) | ||
*wall = jiffies_to_usecs(cur_wall_time); | ||
|
||
return jiffies_to_usecs(idle_time); | ||
} | ||
|
||
cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall) | ||
{ | ||
u64 idle_time = get_cpu_idle_time_us(cpu, NULL); | ||
|
||
if (idle_time == -1ULL) | ||
return get_cpu_idle_time_jiffy(cpu, wall); | ||
else | ||
idle_time += get_cpu_iowait_time_us(cpu, wall); | ||
|
||
return idle_time; | ||
} | ||
EXPORT_SYMBOL_GPL(get_cpu_idle_time); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters