1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:28:10 +00:00

Everywhere: Make tracking cpu usage independent from system ticks

This switches tracking CPU usage to more accurately measure time in
user and kernel land using either the TSC or another time source.
This will also come in handy when implementing a tickless kernel mode.
This commit is contained in:
Tom 2021-07-14 21:46:32 -06:00 committed by Andreas Kling
parent 7e77a2ec40
commit a635ff4e60
13 changed files with 174 additions and 85 deletions

View file

@ -469,8 +469,8 @@ private:
thread_object.add("tid", thread.tid().value());
thread_object.add("name", thread.name());
thread_object.add("times_scheduled", thread.times_scheduled());
thread_object.add("ticks_user", thread.ticks_in_user());
thread_object.add("ticks_kernel", thread.ticks_in_kernel());
thread_object.add("time_user", thread.time_in_user());
thread_object.add("time_kernel", thread.time_in_kernel());
thread_object.add("state", thread.state_string());
thread_object.add("cpu", thread.cpu());
thread_object.add("priority", thread.priority());
@ -497,9 +497,9 @@ private:
build_process(array, process);
}
auto total_ticks_scheduled = Scheduler::get_total_ticks_scheduled();
json.add("total_ticks", total_ticks_scheduled.total);
json.add("total_ticks_kernel", total_ticks_scheduled.total_kernel);
auto total_time_scheduled = Scheduler::get_total_time_scheduled();
json.add("total_time", total_time_scheduled.total);
json.add("total_time_kernel", total_time_scheduled.total_kernel);
}
return true;
}