1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47: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:
Andreas Kling 2022-11-18 22:07:57 +01:00
parent 94b514b981
commit fb00d3ed25
4 changed files with 33 additions and 9 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -34,9 +35,12 @@ ErrorOr<void> SysFSInterrupts::try_generate(KBufferBuilder& builder)
TRY(obj.add("purpose"sv, handler.purpose()));
TRY(obj.add("interrupt_line"sv, handler.interrupt_number()));
TRY(obj.add("controller"sv, handler.controller()));
TRY(obj.add("cpu_handler"sv, 0)); // FIXME: Determine the responsible CPU for each interrupt handler.
TRY(obj.add("device_sharing"sv, (unsigned)handler.sharing_devices_count()));
TRY(obj.add("call_count"sv, handler.call_count()));
auto per_cpu_call_counts = TRY(obj.add_array("per_cpu_call_counts"sv));
for (auto call_count : handler.per_cpu_call_counts()) {
TRY(per_cpu_call_counts.add(call_count));
}
TRY(per_cpu_call_counts.finish());
TRY(obj.finish());
return {};
})();