cpufreq: Rank modules and choose the best one
This commit is contained in:
parent
13a89839fc
commit
1e8ed5558d
@ -17,6 +17,8 @@ const int kCPUPerformanceScaleMax = 1000;
|
||||
typedef struct cpufreq_module_info {
|
||||
module_info info;
|
||||
|
||||
float rank;
|
||||
|
||||
status_t (*increase_performance)(int delta, bool allowBoost);
|
||||
status_t (*decrease_performance)(int delta);
|
||||
} cpufreq_module_info;
|
||||
|
@ -222,6 +222,8 @@ static cpufreq_module_info sIntelPStates = {
|
||||
std_ops,
|
||||
},
|
||||
|
||||
1.0f,
|
||||
|
||||
increase_performance,
|
||||
decrease_performance,
|
||||
};
|
||||
|
@ -63,13 +63,22 @@ load_cpufreq_module()
|
||||
while (true) {
|
||||
char name[B_FILE_NAME_LENGTH];
|
||||
size_t nameLength = sizeof(name);
|
||||
cpufreq_module_info* current = NULL;
|
||||
|
||||
if (read_next_module_name(cookie, name, &nameLength) != B_OK)
|
||||
break;
|
||||
|
||||
if (get_module(name, (module_info**)&sCPUPerformanceModule) == B_OK) {
|
||||
if (get_module(name, (module_info**)¤t) == B_OK) {
|
||||
dprintf("found cpufreq module: %s\n", name);
|
||||
break;
|
||||
|
||||
if (sCPUPerformanceModule != NULL) {
|
||||
if (sCPUPerformanceModule->rank < current->rank) {
|
||||
put_module(sCPUPerformanceModule->info.name);
|
||||
sCPUPerformanceModule = current;
|
||||
} else
|
||||
put_module(name);
|
||||
} else
|
||||
sCPUPerformanceModule = current;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user