aboutsummaryrefslogtreecommitdiff
path: root/www/chromium/files/patch-base_process_process__metrics__openbsd.cc
diff options
context:
space:
mode:
Diffstat (limited to 'www/chromium/files/patch-base_process_process__metrics__openbsd.cc')
-rw-r--r--www/chromium/files/patch-base_process_process__metrics__openbsd.cc41
1 files changed, 9 insertions, 32 deletions
diff --git a/www/chromium/files/patch-base_process_process__metrics__openbsd.cc b/www/chromium/files/patch-base_process_process__metrics__openbsd.cc
index 97102c7e4f92..7cf86d373978 100644
--- a/www/chromium/files/patch-base_process_process__metrics__openbsd.cc
+++ b/www/chromium/files/patch-base_process_process__metrics__openbsd.cc
@@ -1,20 +1,7 @@
---- base/process/process_metrics_openbsd.cc.orig 2022-03-25 21:59:56 UTC
+--- base/process/process_metrics_openbsd.cc.orig 2022-04-21 18:48:31 UTC
+++ base/process/process_metrics_openbsd.cc
-@@ -4,17 +4,36 @@
+@@ -6,14 +6,23 @@
- #include "base/process/process_metrics.h"
-
-+#include "base/files/file_util.h"
-+#include "base/logging.h"
-+#include "base/process/internal_linux.h"
-+#include "base/strings/string_number_conversions.h"
-+#include "base/strings/string_split.h"
-+#include "base/strings/string_tokenizer.h"
-+#include "base/strings/string_util.h"
-+#include "base/system/sys_info.h"
-+#include "base/threading/thread_restrictions.h"
-+#include "base/notreached.h"
-+
#include <stddef.h>
#include <stdint.h>
+#include <fcntl.h>
@@ -24,10 +11,10 @@
+#include <kvm.h>
+
- #include "base/cxx17_backports.h"
#include "base/memory/ptr_util.h"
#include "base/process/process_metrics_iocounters.h"
+#include "base/values.h"
++#include "base/notreached.h"
namespace base {
@@ -37,7 +24,7 @@
// static
std::unique_ptr<ProcessMetrics> ProcessMetrics::CreateProcessMetrics(
ProcessHandle process) {
-@@ -25,49 +44,24 @@ bool ProcessMetrics::GetIOCounters(IoCounters* io_coun
+@@ -24,49 +33,24 @@ bool ProcessMetrics::GetIOCounters(IoCounters* io_coun
return false;
}
@@ -49,18 +36,17 @@
- sizeof(struct kinfo_proc), 0 };
+ size_t length = sizeof(struct kinfo_proc);
-- if (sysctl(mib, base::size(mib), NULL, &length, NULL, 0) < 0)
+- if (sysctl(mib, std::size(mib), NULL, &length, NULL, 0) < 0)
- return -1;
+ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process_,
+ sizeof(struct kinfo_proc), 1 };
- mib[5] = (length / sizeof(struct kinfo_proc));
-+ if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0)
+-
+ if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0)
+- return 0;
+ return 0.0;
-- if (sysctl(mib, base::size(mib), &info, &length, NULL, 0) < 0)
-- return 0;
--
- return info.p_pctcpu;
+ return static_cast<double>((info.p_pctcpu * 100.0) / FSCALE);
}
@@ -94,16 +80,7 @@
size_t GetSystemCommitCharge() {
int mib[] = { CTL_VM, VM_METER };
int pagesize;
-@@ -75,7 +69,7 @@ size_t GetSystemCommitCharge() {
- unsigned long mem_total, mem_free, mem_inactive;
- size_t len = sizeof(vmtotal);
-
-- if (sysctl(mib, base::size(mib), &vmtotal, &len, NULL, 0) < 0)
-+ if (sysctl(mib, std::size(mib), &vmtotal, &len, NULL, 0) < 0)
- return 0;
-
- mem_total = vmtotal.t_vm;
-@@ -85,6 +79,129 @@ size_t GetSystemCommitCharge() {
+@@ -84,6 +68,129 @@ size_t GetSystemCommitCharge() {
pagesize = getpagesize();
return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize);