summaryrefslogtreecommitdiff
path: root/Kernel/PerformanceManager.h
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-05-13 13:09:00 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-19 22:51:42 +0200
commit277f333b2bbf2ca24d0d4c7695edbaed21dc0ba3 (patch)
tree8b66ccf59698ae554250ccf9163f9d42ec0e4ae4 /Kernel/PerformanceManager.h
parent572bbf28ccd1cd5f8e4f17a38d0fbd989b1d56bf (diff)
downloadserenity-277f333b2bbf2ca24d0d4c7695edbaed21dc0ba3.zip
Kernel: Add support for profiling kmalloc()/kfree()
Diffstat (limited to 'Kernel/PerformanceManager.h')
-rw-r--r--Kernel/PerformanceManager.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/Kernel/PerformanceManager.h b/Kernel/PerformanceManager.h
index cdf699e61d..57fd9d7ea3 100644
--- a/Kernel/PerformanceManager.h
+++ b/Kernel/PerformanceManager.h
@@ -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;