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

Unified Diff: components/tracing/common/process_metrics_memory_dump_provider.cc

Issue 2740423002: mac: Fix calulation for number of resident pages in a process. (Closed)
Patch Set: comments from mark. Created 3 years, 9 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 | « chrome/browser/task_manager/sampling/task_group_sampler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/tracing/common/process_metrics_memory_dump_provider.cc
diff --git a/components/tracing/common/process_metrics_memory_dump_provider.cc b/components/tracing/common/process_metrics_memory_dump_provider.cc
index e181786552df1571bf873c68db81bb9cefe17f17..147e8b33fde1d3f5eaaf2c0879f46cc48e1a9dee 100644
--- a/components/tracing/common/process_metrics_memory_dump_provider.cc
+++ b/components/tracing/common/process_metrics_memory_dump_provider.cc
@@ -596,9 +596,22 @@ bool ProcessMetricsMemoryDumpProvider::OnMemoryDump(
bool ProcessMetricsMemoryDumpProvider::DumpProcessTotals(
const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) {
- const uint64_t rss_bytes = rss_bytes_for_testing
- ? rss_bytes_for_testing
- : process_metrics_->GetWorkingSetSize();
+#if defined(OS_MACOSX)
+ size_t private_bytes;
+ size_t shared_bytes;
+ size_t resident_bytes;
+ if (!process_metrics_->GetMemoryBytes(&private_bytes, &shared_bytes,
+ &resident_bytes)) {
+ return false;
+ }
+ uint64_t rss_bytes = resident_bytes;
+ pmd->process_totals()->SetExtraFieldInBytes("private_bytes", private_bytes);
+ pmd->process_totals()->SetExtraFieldInBytes("shared_bytes", shared_bytes);
+#else
+ uint64_t rss_bytes = process_metrics_->GetWorkingSetSize();
+#endif // defined(OS_MACOSX)
+ if (rss_bytes_for_testing)
+ rss_bytes = rss_bytes_for_testing;
// rss_bytes will be 0 if the process ended while dumping.
if (!rss_bytes)
@@ -625,12 +638,6 @@ bool ProcessMetricsMemoryDumpProvider::DumpProcessTotals(
}
close(clear_refs_fd);
}
-#elif defined(MACOSX)
- size_t private_bytes;
- bool res = process_metrics_->GetMemoryBytes(&private_bytes,
- nullptr /* shared_bytes */);
- if (res)
- pmd->process_totals()->SetExtraFieldInBytes("private_bytes", private_bytes);
#elif defined(OS_WIN)
if (args.level_of_detail ==
base::trace_event::MemoryDumpLevelOfDetail::DETAILED) {
« no previous file with comments | « chrome/browser/task_manager/sampling/task_group_sampler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698