summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-05-07 01:38:50 -0700
committerAndreas Kling <kling@serenityos.org>2021-05-07 15:35:23 +0200
commit8bf4201f50e8ffa7686ef7519732a8f44b34b2e3 (patch)
tree9f5a64cd0950685aa399623a5dfc347e1eda252d /Kernel/Syscalls
parentccdcb6a63523c6862c873090c181c9b36e5a5c38 (diff)
downloadserenity-8bf4201f50e8ffa7686ef7519732a8f44b34b2e3.zip
Kernel: Move process creation perf events to PerformanceManager
Diffstat (limited to 'Kernel/Syscalls')
-rw-r--r--Kernel/Syscalls/execve.cpp6
-rw-r--r--Kernel/Syscalls/fork.cpp7
-rw-r--r--Kernel/Syscalls/profiling.cpp7
3 files changed, 8 insertions, 12 deletions
diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp
index 4aba395cf7..9d2924d9ac 100644
--- a/Kernel/Syscalls/execve.cpp
+++ b/Kernel/Syscalls/execve.cpp
@@ -11,7 +11,7 @@
#include <Kernel/Debug.h>
#include <Kernel/FileSystem/Custody.h>
#include <Kernel/FileSystem/FileDescription.h>
-#include <Kernel/PerformanceEventBuffer.h>
+#include <Kernel/PerformanceManager.h>
#include <Kernel/Process.h>
#include <Kernel/Random.h>
#include <Kernel/Time/TimeManagement.h>
@@ -636,9 +636,7 @@ KResult Process::do_exec(NonnullRefPtr<FileDescription> main_program_description
tss.cr3 = space().page_directory().cr3();
tss.ss2 = pid().value();
- if (auto* event_buffer = current_perf_events_buffer()) {
- event_buffer->add_process(*this, ProcessEventType::Exec);
- }
+ PerformanceManager::add_process_exec_event(*this);
{
ScopedSpinLock lock(g_scheduler_lock);
diff --git a/Kernel/Syscalls/fork.cpp b/Kernel/Syscalls/fork.cpp
index af6c265f30..274d449f2d 100644
--- a/Kernel/Syscalls/fork.cpp
+++ b/Kernel/Syscalls/fork.cpp
@@ -7,7 +7,7 @@
#include <Kernel/Debug.h>
#include <Kernel/FileSystem/Custody.h>
#include <Kernel/FileSystem/FileDescription.h>
-#include <Kernel/PerformanceEventBuffer.h>
+#include <Kernel/PerformanceManager.h>
#include <Kernel/Process.h>
#include <Kernel/VM/Region.h>
@@ -85,10 +85,7 @@ KResultOr<pid_t> Process::sys$fork(RegisterState& regs)
g_processes->prepend(child);
}
- if (g_profiling_all_threads) {
- VERIFY(g_global_perf_events);
- g_global_perf_events->add_process(*child, ProcessEventType::Create);
- }
+ PerformanceManager::add_process_created_event(*child);
ScopedSpinLock lock(g_scheduler_lock);
child_first_thread->set_affinity(Thread::current()->affinity());
diff --git a/Kernel/Syscalls/profiling.cpp b/Kernel/Syscalls/profiling.cpp
index 1c956faef0..ba7685488c 100644
--- a/Kernel/Syscalls/profiling.cpp
+++ b/Kernel/Syscalls/profiling.cpp
@@ -7,7 +7,7 @@
#include <Kernel/CoreDump.h>
#include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/FileSystem/VirtualFileSystem.h>
-#include <Kernel/PerformanceEventBuffer.h>
+#include <Kernel/PerformanceManager.h>
#include <Kernel/Process.h>
namespace Kernel {
@@ -27,12 +27,13 @@ KResultOr<int> Process::sys$profiling_enable(pid_t pid)
g_global_perf_events->clear();
else
g_global_perf_events = PerformanceEventBuffer::try_create_with_size(32 * MiB).leak_ptr();
+
ScopedSpinLock lock(g_processes_lock);
+ g_profiling_all_threads = true;
Process::for_each([](auto& process) {
- g_global_perf_events->add_process(process, ProcessEventType::Create);
+ PerformanceManager::add_process_created_event(process);
return IterationDecision::Continue;
});
- g_profiling_all_threads = true;
return 0;
}