kernel: Return CPU load in cpu_info
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user