mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:07:45 +00:00
Kernel+lsirq: Track per-CPU IRQ handler call counts
Each GenericInterruptHandler now tracks the number of calls that each CPU has serviced. This takes care of a FIXME in the /sys/kernel/interrupts generator. Also, the lsirq command line tool now displays per-CPU call counts.
This commit is contained in:
parent
94b514b981
commit
fb00d3ed25
4 changed files with 33 additions and 9 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Liav A. <liavalb@hotmail.co.il>
|
||||
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -20,17 +21,30 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
|
||||
TRY(Core::System::pledge("stdio"));
|
||||
|
||||
outln(" CPU0");
|
||||
auto file_contents = proc_interrupts->read_all();
|
||||
auto json = TRY(JsonValue::from_string(file_contents));
|
||||
json.as_array().for_each([](auto& value) {
|
||||
|
||||
auto cpu_count = json.as_array().at(0).as_object().get("per_cpu_call_counts"sv).as_array().size();
|
||||
|
||||
out(" "sv);
|
||||
for (size_t i = 0; i < cpu_count; ++i) {
|
||||
out("{:>10}", String::formatted("CPU{}", i));
|
||||
}
|
||||
outln("");
|
||||
|
||||
json.as_array().for_each([cpu_count](JsonValue const& value) {
|
||||
auto& handler = value.as_object();
|
||||
auto purpose = handler.get("purpose"sv).to_string();
|
||||
auto interrupt = handler.get("interrupt_line"sv).to_string();
|
||||
auto controller = handler.get("controller"sv).to_string();
|
||||
auto call_count = handler.get("call_count"sv).to_string();
|
||||
auto call_counts = handler.get("per_cpu_call_counts"sv).as_array();
|
||||
|
||||
outln("{:>4}: {:10} {:10} {:30}", interrupt, call_count, controller, purpose);
|
||||
out("{:>4}: ", interrupt);
|
||||
|
||||
for (size_t i = 0; i < cpu_count; ++i)
|
||||
out("{:>10}", call_counts[i].to_string());
|
||||
|
||||
outln(" {:10} {:30}", controller, purpose);
|
||||
});
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue