diff options
Diffstat (limited to 'www/chromium/files/patch-base_process_process__metrics__freebsd.cc')
-rw-r--r-- | www/chromium/files/patch-base_process_process__metrics__freebsd.cc | 78 |
1 files changed, 10 insertions, 68 deletions
diff --git a/www/chromium/files/patch-base_process_process__metrics__freebsd.cc b/www/chromium/files/patch-base_process_process__metrics__freebsd.cc index 5eb60b3d9b11..901fbbcb7254 100644 --- a/www/chromium/files/patch-base_process_process__metrics__freebsd.cc +++ b/www/chromium/files/patch-base_process_process__metrics__freebsd.cc @@ -1,4 +1,4 @@ ---- base/process/process_metrics_freebsd.cc.orig 2025-08-07 06:57:29 UTC +--- base/process/process_metrics_freebsd.cc.orig 2025-10-02 14:20:29 UTC +++ base/process/process_metrics_freebsd.cc @@ -3,41 +3,92 @@ // found in the LICENSE file. @@ -104,11 +104,10 @@ } size_t GetSystemCommitCharge() { -@@ -64,6 +115,176 @@ size_t GetSystemCommitCharge() { - pagesize = getpagesize(); +@@ -65,5 +116,118 @@ size_t GetSystemCommitCharge() { return mem_total - (mem_free * pagesize) - (mem_inactive * pagesize); -+} + } + +int64_t GetNumberOfThreads(ProcessHandle process) { + // Taken from FreeBSD top (usr.bin/top/machine.c) @@ -129,12 +128,12 @@ + return nproc; +} + -+bool GetSystemMemoryInfo(SystemMemoryInfoKB *meminfo) { ++bool GetSystemMemoryInfo(SystemMemoryInfo *meminfo) { + unsigned int mem_total, mem_free, swap_total, swap_used; + size_t length; -+ int pagesizeKB; ++ int pagesize; + -+ pagesizeKB = getpagesize() / 1024; ++ pagesize = getpagesize(); + + length = sizeof(mem_total); + if (sysctlbyname("vm.stats.vm.v_page_count", &mem_total, @@ -156,10 +155,10 @@ + != 0 || length != sizeof(swap_used)) + return false; + -+ meminfo->total = mem_total * pagesizeKB; -+ meminfo->free = mem_free * pagesizeKB; -+ meminfo->swap_total = swap_total * pagesizeKB; -+ meminfo->swap_free = (swap_total - swap_used) * pagesizeKB; ++ meminfo->total = ByteCount::FromUnsigned(mem_total * pagesize); ++ meminfo->free = ByteCount::FromUnsigned(mem_free * pagesize); ++ meminfo->swap_total = ByteCount::FromUnsigned(swap_total * pagesize); ++ meminfo->swap_free = ByteCount::FromUnsigned((swap_total - swap_used) * pagesize); + + return true; +} @@ -222,62 +221,5 @@ +SystemDiskInfo::SystemDiskInfo(const SystemDiskInfo& other) = default; + +SystemDiskInfo& SystemDiskInfo::operator=(const SystemDiskInfo&) = default; -+ -+Value::Dict SystemDiskInfo::ToDict() const { -+ Value::Dict res; -+ -+ // Write out uint64_t variables as doubles. -+ // Note: this may discard some precision, but for JS there's no other option. -+ res.Set("reads", static_cast<double>(reads)); -+ res.Set("reads_merged", static_cast<double>(reads_merged)); -+ res.Set("sectors_read", static_cast<double>(sectors_read)); -+ res.Set("read_time", static_cast<double>(read_time)); -+ res.Set("writes", static_cast<double>(writes)); -+ res.Set("writes_merged", static_cast<double>(writes_merged)); -+ res.Set("sectors_written", static_cast<double>(sectors_written)); -+ res.Set("write_time", static_cast<double>(write_time)); -+ res.Set("io", static_cast<double>(io)); -+ res.Set("io_time", static_cast<double>(io_time)); -+ res.Set("weighted_io_time", static_cast<double>(weighted_io_time)); -+ -+ NOTIMPLEMENTED(); -+ -+ return res; -+} -+ -+Value::Dict SystemMemoryInfoKB::ToDict() const { -+ Value::Dict res; -+ res.Set("total", total); -+ res.Set("free", free); -+ res.Set("available", available); -+ res.Set("buffers", buffers); -+ res.Set("cached", cached); -+ res.Set("active_anon", active_anon); -+ res.Set("inactive_anon", inactive_anon); -+ res.Set("active_file", active_file); -+ res.Set("inactive_file", inactive_file); -+ res.Set("swap_total", swap_total); -+ res.Set("swap_free", swap_free); -+ res.Set("swap_used", swap_total - swap_free); -+ res.Set("dirty", dirty); -+ res.Set("reclaimable", reclaimable); -+ -+ NOTIMPLEMENTED(); -+ -+ return res; -+} -+ -+Value::Dict VmStatInfo::ToDict() const { -+ Value::Dict res; -+ // TODO(crbug.com/1334256): Make base::Value able to hold uint64_t and remove -+ // casts below. -+ res.Set("pswpin", static_cast<int>(pswpin)); -+ res.Set("pswpout", static_cast<int>(pswpout)); -+ res.Set("pgmajfault", static_cast<int>(pgmajfault)); -+ -+ NOTIMPLEMENTED(); -+ -+ return res; - } } // namespace base |