diff options
Diffstat (limited to 'base/process/process_metrics.h')
-rw-r--r-- | base/process/process_metrics.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/base/process/process_metrics.h b/base/process/process_metrics.h index 33cb64e244..1562e7b156 100644 --- a/base/process/process_metrics.h +++ b/base/process/process_metrics.h @@ -27,6 +27,10 @@ #include "base/process/port_provider_mac.h" #endif +#if defined(OS_WIN) +#include "base/win/scoped_handle.h" +#endif + namespace base { #if defined(OS_WIN) @@ -63,8 +67,12 @@ struct IoCounters { // shareable: 0 // swapped Pages swapped out to zram. // -// On OS X: TODO(thakis): Revise. -// priv: Memory. +// On macOS: +// priv: Resident size (RSS) including shared memory. Warning: This +// does not include compressed size and does not always +// accurately account for shared memory due to things like +// copy-on-write. TODO(erikchen): Revamp this with something +// more accurate. // shared: 0 // shareable: 0 // @@ -154,10 +162,13 @@ class BASE_EXPORT ProcessMetrics { // system call. bool GetCommittedAndWorkingSetKBytes(CommittedKBytes* usage, WorkingSetKBytes* ws_usage) const; - // Returns private, shared, and total resident bytes. + // Returns private, shared, and total resident bytes. |locked_bytes| refers to + // bytes that must stay resident. |locked_bytes| only counts bytes locked by + // this task, not bytes locked by the kernel. bool GetMemoryBytes(size_t* private_bytes, size_t* shared_bytes, - size_t* resident_bytes) const; + size_t* resident_bytes, + size_t* locked_bytes) const; #endif // Returns the CPU usage in percent since the last time this method or @@ -213,7 +224,11 @@ class BASE_EXPORT ProcessMetrics { int CalculateIdleWakeupsPerSecond(uint64_t absolute_idle_wakeups); #endif +#if defined(OS_WIN) + win::ScopedHandle process_; +#else ProcessHandle process_; +#endif int processor_count_; |