mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:14:58 +00:00
Kernel+LibC: Add PERF_EVENT_SIGNPOST
This event will be used by userspace programs wanting to mark interesting high-level events in the profile. :^)
This commit is contained in:
parent
84053816d5
commit
0d997d48ea
4 changed files with 17 additions and 0 deletions
|
@ -137,6 +137,10 @@ KResult PerformanceEventBuffer::append_with_ip_and_bp(ProcessID pid, ThreadID ti
|
|||
break;
|
||||
case PERF_EVENT_SYSCALL:
|
||||
break;
|
||||
case PERF_EVENT_SIGNPOST:
|
||||
event.data.signpost.arg1 = arg1;
|
||||
event.data.signpost.arg2 = arg2;
|
||||
break;
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
|
@ -231,6 +235,11 @@ bool PerformanceEventBuffer::to_json_impl(Serializer& object) const
|
|||
case PERF_EVENT_SYSCALL:
|
||||
event_object.add("type", "syscall");
|
||||
break;
|
||||
case PERF_EVENT_SIGNPOST:
|
||||
event_object.add("type"sv, "signpost"sv);
|
||||
event_object.add("arg1"sv, event.data.signpost.arg1);
|
||||
event_object.add("arg2"sv, event.data.signpost.arg2);
|
||||
break;
|
||||
}
|
||||
event_object.add("pid", event.pid);
|
||||
event_object.add("tid", event.tid);
|
||||
|
|
|
@ -62,6 +62,11 @@ struct [[gnu::packed]] KFreePerformanceEvent {
|
|||
FlatPtr ptr;
|
||||
};
|
||||
|
||||
struct [[gnu::packed]] SignpostPerformanceEvent {
|
||||
FlatPtr arg1;
|
||||
FlatPtr arg2;
|
||||
};
|
||||
|
||||
struct [[gnu::packed]] PerformanceEvent {
|
||||
u16 type { 0 };
|
||||
u8 stack_size { 0 };
|
||||
|
@ -80,6 +85,7 @@ struct [[gnu::packed]] PerformanceEvent {
|
|||
ContextSwitchPerformanceEvent context_switch;
|
||||
KMallocPerformanceEvent kmalloc;
|
||||
KFreePerformanceEvent kfree;
|
||||
SignpostPerformanceEvent signpost;
|
||||
} data;
|
||||
static constexpr size_t max_stack_frame_count = 64;
|
||||
FlatPtr stack[max_stack_frame_count];
|
||||
|
|
|
@ -63,6 +63,7 @@ enum {
|
|||
PERF_EVENT_KFREE = 4096,
|
||||
PERF_EVENT_PAGE_FAULT = 8192,
|
||||
PERF_EVENT_SYSCALL = 16384,
|
||||
PERF_EVENT_SIGNPOST = 32768,
|
||||
};
|
||||
|
||||
#define WNOHANG 1
|
||||
|
|
|
@ -113,6 +113,7 @@ enum {
|
|||
PERF_EVENT_KFREE = 4096,
|
||||
PERF_EVENT_PAGE_FAULT = 8192,
|
||||
PERF_EVENT_SYSCALL = 16384,
|
||||
PERF_EVENT_SIGNPOST = 32768,
|
||||
};
|
||||
|
||||
#define PERF_EVENT_MASK_ALL (~0ull)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue