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

Kernel: Don't log profile data before/after the process/thread lifetime

There were a few cases where we could end up logging profiling events
before or after the associated process or thread exists in the profile:

After enabling profiling we might end up with CPU samples before we
had a chance to synthesize process/thread creation events.

After a thread exits we would still log associated kmalloc/kfree
events. Instead we now just ignore those events.
This commit is contained in:
Gunnar Beutner 2021-05-30 16:24:53 +02:00 committed by Andreas Kling
parent d24dd7a3df
commit 01c75e3a34
8 changed files with 39 additions and 22 deletions

View file

@ -1131,6 +1131,9 @@ public:
return m_nested_profiler_calls.fetch_sub(1, AK::MemoryOrder::memory_order_acquire);
}
bool is_profiling_suppressed() const { return m_is_profiling_suppressed; }
void set_profiling_suppressed() { m_is_profiling_suppressed = true; }
private:
Thread(NonnullRefPtr<Process>, NonnullOwnPtr<Region>, NonnullRefPtr<Timer>);
@ -1273,6 +1276,8 @@ private:
RefPtr<Timer> m_block_timer;
bool m_is_profiling_suppressed { false };
void yield_without_holding_big_lock();
void donate_without_holding_big_lock(RefPtr<Thread>&, const char*);
void yield_while_not_holding_big_lock();