1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:17:34 +00:00

Kernel: Track performance events for context switches

This commit is contained in:
Gunnar Beutner 2021-05-14 07:48:53 +02:00 committed by Andreas Kling
parent c94440860e
commit 8b2ace0326
6 changed files with 29 additions and 2 deletions

View file

@ -85,6 +85,13 @@ public:
}
}
inline static void add_context_switch_perf_event(Thread& current_thread, Thread& next_thread)
{
if (auto* event_buffer = current_thread.process().current_perf_events_buffer()) {
[[maybe_unused]] auto res = event_buffer->append(PERF_EVENT_CONTEXT_SWITCH, next_thread.pid().value(), next_thread.tid().value(), nullptr);
}
}
inline static void timer_tick(RegisterState const& regs)
{
static Time last_wakeup;