Differential D38165 Diff 118368 www/qt5-webengine/files/patch-src_3rdparty_chromium_base_process_process__metrics__freebsd.cc
Changeset View
Changeset View
Standalone View
Standalone View
www/qt5-webengine/files/patch-src_3rdparty_chromium_base_process_process__metrics__freebsd.cc
--- src/3rdparty/chromium/base/process/process_metrics_freebsd.cc.orig 2019-11-27 21:12:25 UTC | --- src/3rdparty/chromium/base/process/process_metrics_freebsd.cc.orig 2021-12-15 16:12:54 UTC | ||||
+++ src/3rdparty/chromium/base/process/process_metrics_freebsd.cc | +++ src/3rdparty/chromium/base/process/process_metrics_freebsd.cc | ||||
@@ -5,6 +5,7 @@ | @@ -3,8 +3,10 @@ | ||||
// found in the LICENSE file. | |||||
#include "base/process/process_metrics.h" | #include "base/process/process_metrics.h" | ||||
+#include "base/notreached.h" | |||||
#include <stddef.h> | #include <stddef.h> | ||||
+#include <sys/types.h> | +#include <sys/types.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/user.h> | #include <sys/user.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
@@ -14,11 +15,29 @@ | @@ -14,11 +16,29 @@ | ||||
#include "base/process/process_metrics_iocounters.h" | #include "base/process/process_metrics_iocounters.h" | ||||
#include "base/stl_util.h" | #include "base/stl_util.h" | ||||
+#include <unistd.h> /* getpagesize() */ | +#include <unistd.h> /* getpagesize() */ | ||||
+#include <fcntl.h> /* O_RDONLY */ | +#include <fcntl.h> /* O_RDONLY */ | ||||
+#include <kvm.h> | +#include <kvm.h> | ||||
+#include <libutil.h> | +#include <libutil.h> | ||||
+ | + | ||||
Show All 15 Lines | |||||
+ | + | ||||
ProcessMetrics::ProcessMetrics(ProcessHandle process) | ProcessMetrics::ProcessMetrics(ProcessHandle process) | ||||
- : process_(process), | - : process_(process), | ||||
- last_cpu_(0) {} | - last_cpu_(0) {} | ||||
+ : process_(process) {} | + : process_(process) {} | ||||
// static | // static | ||||
std::unique_ptr<ProcessMetrics> ProcessMetrics::CreateProcessMetrics( | std::unique_ptr<ProcessMetrics> ProcessMetrics::CreateProcessMetrics( | ||||
@@ -69,4 +88,216 @@ size_t GetSystemCommitCharge() { | @@ -69,4 +89,216 @@ size_t GetSystemCommitCharge() { | ||||
return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize); | return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize); | ||||
} | } | ||||
+int GetNumberOfThreads(ProcessHandle process) { | +int GetNumberOfThreads(ProcessHandle process) { | ||||
+ // Taken from FreeBSD top (usr.bin/top/machine.c) | + // Taken from FreeBSD top (usr.bin/top/machine.c) | ||||
+ | + | ||||
+ kvm_t* kd = kvm_open(NULL, "/dev/null", NULL, O_RDONLY, "kvm_open"); | + kvm_t* kd = kvm_open(NULL, "/dev/null", NULL, O_RDONLY, "kvm_open"); | ||||
+ if (kd == NULL) | + if (kd == NULL) | ||||
▲ Show 20 Lines • Show All 208 Lines • Show Last 20 Lines |