From 3c3b384c807ebd58a4e437543debaf70b84aab39 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 13 May 2021 20:26:20 +0200 Subject: [PATCH] SystemMonitor: Boost main thread priority to maximum on startup It's frustrating when the system is under heavy load and you want to investigate using SystemMonitor, but SystemMonitor chokes on the lag. Let's at give it a fighting chance by maxing out the main thread prio. --- Userland/Applications/SystemMonitor/main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp index 827edbf454..9bc205c790 100644 --- a/Userland/Applications/SystemMonitor/main.cpp +++ b/Userland/Applications/SystemMonitor/main.cpp @@ -93,6 +93,16 @@ static bool can_access_pid(pid_t pid) int main(int argc, char** argv) { + { + // Before we do anything else, boost our process priority to the maximum allowed. + // It's very frustrating when the system is bogged down under load and you just want + // System Monitor to work. + sched_param param { + .sched_priority = THREAD_PRIORITY_MAX, + }; + sched_setparam(0, ¶m); + } + if (pledge("stdio proc recvfd sendfd accept rpath exec unix cpath fattr", nullptr) < 0) { perror("pledge"); return 1;