Chromium Code Reviews| 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..8462970575d48a1cbdd2b22f6bdca13efe699c47 100644 |
| --- a/components/tracing/common/process_metrics_memory_dump_provider.cc |
| +++ b/components/tracing/common/process_metrics_memory_dump_provider.cc |
| @@ -596,9 +596,21 @@ bool ProcessMetricsMemoryDumpProvider::OnMemoryDump( |
| bool ProcessMetricsMemoryDumpProvider::DumpProcessTotals( |
| const base::trace_event::MemoryDumpArgs& args, |
| base::trace_event::ProcessMemoryDump* pmd) { |
| +#if defined(OS_MACOSX) |
| + size_t private_bytes; |
| + size_t shared_bytes; |
| + if (!process_metrics_->GetMemoryBytes(&private_bytes, &shared_bytes)) |
| + return false; |
| + const uint64_t rss_bytes = rss_bytes_for_testing |
| + ? rss_bytes_for_testing |
| + : private_bytes + shared_bytes; |
|
Mark Mentovai
2017/03/13 18:13:33
Same here.
erikchen
2017/03/13 21:00:42
Done.
|
| + pmd->process_totals()->SetExtraFieldInBytes("private_bytes", private_bytes); |
|
Primiano Tucci (use gerrit)
2017/03/13 13:59:34
does this shows up in the UI as is or we need an u
erikchen
2017/03/13 21:00:42
Yes it does.
I forgot to include this in the ori
|
| + pmd->process_totals()->SetExtraFieldInBytes("shared_bytes", shared_bytes); |
| +#else |
| const uint64_t rss_bytes = rss_bytes_for_testing |
| ? rss_bytes_for_testing |
| : process_metrics_->GetWorkingSetSize(); |
|
Primiano Tucci (use gerrit)
2017/03/13 13:59:34
maybe you can factor out the ? rss_bytes_for_testi
erikchen
2017/03/13 21:00:42
Done.
|
| +#endif // defined(OS_MACOSX) |
| // rss_bytes will be 0 if the process ended while dumping. |
| if (!rss_bytes) |
| @@ -625,12 +637,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) { |