kernel: Return CPU load in cpu_info

This commit is contained in:
Pawel Dziepak
2013-12-29 22:47:06 +01:00
parent ba4cf03951
commit 15a7f2046a
3 changed files with 10 additions and 1 deletions
+2
View File
@@ -81,6 +81,8 @@ void scheduler_new_thread_entry(Thread* thread);
void scheduler_set_cpu_enabled(int32 cpu, bool enabled);
int scheduler_get_cpu_load(int32 cpu);
void scheduler_add_listener(struct SchedulerListener* listener);
void scheduler_remove_listener(struct SchedulerListener* listener);
@@ -724,6 +724,13 @@ scheduler_set_cpu_enabled(int32 cpuID, bool enabled)
}
int
scheduler_get_cpu_load(int32 cpu)
{
return CPUEntry::GetCPU(cpu)->GetLoad() / 10;
}
static void
traverse_topology_tree(const cpu_topology_node* node, int packageID, int coreID)
{
+1 -1
View File
@@ -452,7 +452,7 @@ get_cpu_info(uint32 firstCPU, uint32 cpuCount, cpu_info* info)
memset(info, 0, sizeof(cpu_info) * count);
for (uint32 i = 0; i < count; i++) {
info[i].active_time = cpu_get_active_time(firstCPU + i);
// TODO: cpu_info::load
info[i].load = scheduler_get_cpu_load(firstCPU + i);
info[i].enabled = !gCPU[firstCPU + i].disabled;
}