mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-06 11:12:54 +00:00
Previously calls to perf_event() would end up in a process-specific perfcore file even though global profiling was enabled. This changes the behavior for perf_event() so that these events are stored into the global profile instead.
23 lines
559 B
C++
23 lines
559 B
C++
/*
|
|
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <Kernel/PerformanceEventBuffer.h>
|
|
#include <Kernel/Process.h>
|
|
|
|
namespace Kernel {
|
|
|
|
KResultOr<int> Process::sys$perf_event(int type, FlatPtr arg1, FlatPtr arg2)
|
|
{
|
|
auto events_buffer = current_perf_events_buffer();
|
|
if (!events_buffer) {
|
|
if (!create_perf_events_buffer_if_needed())
|
|
return ENOMEM;
|
|
events_buffer = perf_events();
|
|
}
|
|
return events_buffer->append(type, arg1, arg2, nullptr);
|
|
}
|
|
|
|
}
|