From 0fb0d75433191ce8056ff1b32ae371f4c4b0a6e0 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Mon, 5 Jun 2023 10:04:05 +1000 Subject: Fix Linux running tasks count in the Tasks Meter, a recent regression The recent split of machine-wide metric gathering from process metrics gathering introduced a regression in the Linux running task accounting. The way we extract this value from /proc/stat (which typically is used for machine-wide metrics) conspired with a now-incorrectly placed init- to-zero at the start of the per-process sampling, caused this value to always be zero by the time the Tasks Meter used it. Fix this by making it much more clear that Linux has this special case handling of runningTasks. Resolves #1256 --- linux/LinuxProcessList.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'linux/LinuxProcessList.c') diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c index e0a33e28..cd3a2607 100644 --- a/linux/LinuxProcessList.c +++ b/linux/LinuxProcessList.c @@ -1312,6 +1312,9 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_ const ScreenSettings* ss = settings->ss; const struct dirent* entry; + /* set runningTasks from /proc/stat (from Machine_scanCPUTime) */ + pl->runningTasks = lhost->runningTasks; + #ifdef HAVE_OPENAT int dirFd = openat(parentFd, dirname, O_RDONLY | O_DIRECTORY | O_NOFOLLOW); if (dirFd < 0) -- cgit v1.2.3