1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 15:17:46 +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

@ -87,6 +87,8 @@ enum {
PERF_EVENT_THREAD_CREATE = 256,
PERF_EVENT_THREAD_EXIT = 512,
PERF_EVENT_CONTEXT_SWITCH = 1024,
PERF_EVENT_KMALLOC = 2048,
PERF_EVENT_KFREE = 4096,
};
#define PERF_EVENT_MASK_ALL (~0ull)

View file

@ -40,6 +40,10 @@ int main(int argc, char** argv)
event_mask |= PERF_EVENT_SAMPLE;
else if (event_type == "context_switch")
event_mask |= PERF_EVENT_CONTEXT_SWITCH;
else if (event_type == "kmalloc")
event_mask |= PERF_EVENT_KMALLOC;
else if (event_type == "kfree")
event_mask |= PERF_EVENT_KFREE;
else {
warnln("Unknown event type '{}' specified.", event_type);
exit(1);
@ -49,7 +53,7 @@ int main(int argc, char** argv)
auto print_types = [] {
outln();
outln("Event type can be one of: sample and context_switch.");
outln("Event type can be one of: sample, context_switch, kmalloc and kfree.");
};
if (!args_parser.parse(argc, argv, false)) {