mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:48:12 +00:00
Kernel: Generate page fault events from the kernel profiler
Hook the kernel page fault handler and capture page fault events when the fault has a current thread attached in TLS. We capture the eip and ebp so we can unwind the stack and locate which pieces of code are generating the most page faults. Co-authored-by: Gunnar Beutner <gbeutner@serenityos.org>
This commit is contained in:
parent
6ac1ca5a9a
commit
83fc591cea
7 changed files with 47 additions and 2 deletions
|
@ -1120,6 +1120,16 @@ public:
|
|||
void set_idle_thread() { m_is_idle_thread = true; }
|
||||
bool is_idle_thread() const { return m_is_idle_thread; }
|
||||
|
||||
ALWAYS_INLINE u32 enter_profiler()
|
||||
{
|
||||
return m_nested_profiler_calls.fetch_add(1, AK::MemoryOrder::memory_order_acq_rel);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE u32 leave_profiler()
|
||||
{
|
||||
return m_nested_profiler_calls.fetch_sub(1, AK::MemoryOrder::memory_order_acquire);
|
||||
}
|
||||
|
||||
private:
|
||||
Thread(NonnullRefPtr<Process>, NonnullOwnPtr<Region> kernel_stack_region);
|
||||
|
||||
|
@ -1257,6 +1267,7 @@ private:
|
|||
bool m_in_block { false };
|
||||
bool m_is_idle_thread { false };
|
||||
Atomic<bool> m_have_any_unmasked_pending_signals { false };
|
||||
Atomic<u32> m_nested_profiler_calls { 0 };
|
||||
|
||||
void yield_without_holding_big_lock();
|
||||
void donate_without_holding_big_lock(RefPtr<Thread>&, const char*);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue