1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:37:43 +00:00

Kernel: Prune uninteresting kernel frames from profiling samples

Start capturing the sample stacks at the EIP/EBP of the pre-empted
thread instead of capturing EBP in the sampling function itself.
This commit is contained in:
Andreas Kling 2021-01-17 10:53:18 +01:00
parent bf0719092f
commit 647cfcb641
3 changed files with 12 additions and 5 deletions

View file

@ -39,6 +39,16 @@ PerformanceEventBuffer::PerformanceEventBuffer()
}
KResult PerformanceEventBuffer::append(int type, FlatPtr arg1, FlatPtr arg2)
{
FlatPtr ebp;
asm volatile("movl %%ebp, %%eax"
: "=a"(ebp));
auto current_thread = Thread::current();
auto eip = current_thread->get_register_dump_from_stack().eip;
return append_with_eip_and_ebp(eip, ebp, type, arg1, arg2);
}
KResult PerformanceEventBuffer::append_with_eip_and_ebp(u32 eip, u32 ebp, int type, FlatPtr arg1, FlatPtr arg2)
{
if (count() >= capacity())
return KResult(-ENOBUFS);
@ -60,11 +70,7 @@ KResult PerformanceEventBuffer::append(int type, FlatPtr arg1, FlatPtr arg2)
return KResult(-EINVAL);
}
FlatPtr ebp;
asm volatile("movl %%ebp, %%eax"
: "=a"(ebp));
auto current_thread = Thread::current();
auto eip = current_thread->get_register_dump_from_stack().eip;
Vector<FlatPtr> backtrace;
{
SmapDisabler disabler;