mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:47:34 +00:00
Kernel: Make sure we only log profiling events when m_profiling is true
Previously the process' m_profiling flag was ignored for all event types other than CPU samples. The kfree tracing code relies on temporarily disabling tracing during exec. This didn't work for per-process profiles and would instead panic. This updates the profiling code so that the m_profiling flag isn't ignored.
This commit is contained in:
parent
a8ca4751b9
commit
0688e02339
4 changed files with 15 additions and 16 deletions
|
@ -54,18 +54,8 @@ public:
|
|||
|
||||
inline static void add_cpu_sample_event(Thread& current_thread, const RegisterState& regs, u32 lost_time)
|
||||
{
|
||||
PerformanceEventBuffer* perf_events = nullptr;
|
||||
|
||||
if (g_profiling_all_threads) {
|
||||
VERIFY(g_global_perf_events);
|
||||
perf_events = g_global_perf_events;
|
||||
} else if (current_thread.process().is_profiling()) {
|
||||
VERIFY(current_thread.process().perf_events());
|
||||
perf_events = current_thread.process().perf_events();
|
||||
}
|
||||
|
||||
if (perf_events) {
|
||||
[[maybe_unused]] auto rc = perf_events->append_with_eip_and_ebp(
|
||||
if (auto* event_buffer = current_thread.process().current_perf_events_buffer()) {
|
||||
[[maybe_unused]] auto rc = event_buffer->append_with_eip_and_ebp(
|
||||
current_thread.pid(), current_thread.tid(),
|
||||
regs.eip, regs.ebp, PERF_EVENT_SAMPLE, lost_time, 0, 0, nullptr);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue