Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2218)

Unified Diff: chrome/browser/task_management/sampling/task_group_sampler.cc

Issue 1994653006: Fix the views Task Manager on Mac showing 0s for the Shared Memory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile errors Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/task_management/sampling/task_group_sampler.cc
diff --git a/chrome/browser/task_management/sampling/task_group_sampler.cc b/chrome/browser/task_management/sampling/task_group_sampler.cc
index 93b0c2e0bd1e2cde67cc0d789b4b653182604961..ca1c36ec9b1918f2e9f3c9fc37bf2bf9928e01c1 100644
--- a/chrome/browser/task_management/sampling/task_group_sampler.cc
+++ b/chrome/browser/task_management/sampling/task_group_sampler.cc
@@ -122,10 +122,18 @@ double TaskGroupSampler::RefreshCpuUsage() {
MemoryUsageStats TaskGroupSampler::RefreshMemoryUsage() {
DCHECK(worker_pool_sequenced_checker_.CalledOnValidSequencedThread());
- // TODO(afakhry): Integrate Bruce's CL for faster retrieval of physical memory
- // on Windows here.
-
MemoryUsageStats memory_usage;
+#if defined(OS_MACOSX)
+ memory_usage.physical_bytes =
+ static_cast<int64_t>(process_metrics_->GetWorkingSetSize());
+
+ size_t private_bytes = 0;
+ size_t shared_bytes = 0;
+ if (process_metrics_->GetMemoryBytes(&private_bytes, &shared_bytes)) {
+ memory_usage.private_bytes = static_cast<int64_t>(private_bytes);
+ memory_usage.shared_bytes = static_cast<int64_t>(shared_bytes);
+ }
+#else
// Refreshing the physical/private/shared memory at one shot.
base::WorkingSetKBytes ws_usage;
if (process_metrics_->GetWorkingSetKBytes(&ws_usage)) {
@@ -144,11 +152,13 @@ MemoryUsageStats TaskGroupSampler::RefreshMemoryUsage() {
static_cast<int64_t>(process_metrics_->GetWorkingSetSize());
memory_usage.physical_bytes -=
static_cast<int64_t>(ws_usage.shareable * 1024);
-#endif
+#endif // defined(OS_LINUX)
+
#if defined(OS_CHROMEOS)
memory_usage.swapped_bytes = ws_usage.swapped * 1024;
-#endif
+#endif // defined(OS_CHROMEOS)
}
+#endif // defined(OS_MACOSX)
return memory_usage;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698