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

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: 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..f3ded8a27e5242c081587a24588e599e9cddc352 100644
--- a/chrome/browser/task_management/sampling/task_group_sampler.cc
+++ b/chrome/browser/task_management/sampling/task_group_sampler.cc
@@ -122,10 +122,13 @@ 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.
ncarter (slow) 2016/05/19 22:30:36 Did we ever do this?
afakhry 2016/05/20 00:34:35 We haven't. One reason was that Bruce's approach d
-
MemoryUsageStats memory_usage;
+#if defined(OS_MACOSX)
+ if (process_metrics_->GetMemoryBytes(&memory_usage.private_bytes,
+ &memory_usage.shared_bytes)) {
+ memory_usage.physical_bytes = memory_usage.private_bytes;
+ }
+#else
// Refreshing the physical/private/shared memory at one shot.
base::WorkingSetKBytes ws_usage;
if (process_metrics_->GetWorkingSetKBytes(&ws_usage)) {
@@ -144,11 +147,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