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

Kernel: Add support for profiling kmalloc()/kfree()

This commit is contained in:
Gunnar Beutner 2021-05-13 13:09:00 +02:00 committed by Andreas Kling
parent 572bbf28cc
commit 277f333b2b
10 changed files with 84 additions and 2 deletions

View file

@ -92,6 +92,20 @@ public:
}
}
inline static void add_kmalloc_perf_event(Process& current_process, size_t size, FlatPtr ptr)
{
if (auto* event_buffer = current_process.current_perf_events_buffer()) {
[[maybe_unused]] auto res = event_buffer->append(PERF_EVENT_KMALLOC, size, ptr, nullptr);
}
}
inline static void add_kfree_perf_event(Process& current_process, size_t size, FlatPtr ptr)
{
if (auto* event_buffer = current_process.current_perf_events_buffer()) {
[[maybe_unused]] auto res = event_buffer->append(PERF_EVENT_KFREE, size, ptr, nullptr);
}
}
inline static void timer_tick(RegisterState const& regs)
{
static Time last_wakeup;