Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/tracing/common/process_metrics_memory_dump_provider.h" | 5 #include "components/tracing/common/process_metrics_memory_dump_provider.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 605 return res; | 605 return res; |
| 606 } | 606 } |
| 607 | 607 |
| 608 bool ProcessMetricsMemoryDumpProvider::DumpProcessTotals( | 608 bool ProcessMetricsMemoryDumpProvider::DumpProcessTotals( |
| 609 const base::trace_event::MemoryDumpArgs& args, | 609 const base::trace_event::MemoryDumpArgs& args, |
| 610 base::trace_event::ProcessMemoryDump* pmd) { | 610 base::trace_event::ProcessMemoryDump* pmd) { |
| 611 #if defined(OS_MACOSX) | 611 #if defined(OS_MACOSX) |
| 612 size_t private_bytes; | 612 size_t private_bytes; |
| 613 size_t shared_bytes; | 613 size_t shared_bytes; |
| 614 size_t resident_bytes; | 614 size_t resident_bytes; |
| 615 size_t wired_bytes; | |
| 615 if (!process_metrics_->GetMemoryBytes(&private_bytes, &shared_bytes, | 616 if (!process_metrics_->GetMemoryBytes(&private_bytes, &shared_bytes, |
| 616 &resident_bytes)) { | 617 &resident_bytes, &wired_bytes)) { |
| 617 return false; | 618 return false; |
| 618 } | 619 } |
| 619 uint64_t rss_bytes = resident_bytes; | 620 uint64_t rss_bytes = resident_bytes; |
| 620 pmd->process_totals()->SetExtraFieldInBytes("private_bytes", private_bytes); | 621 pmd->process_totals()->SetExtraFieldInBytes("private_bytes", private_bytes); |
| 621 pmd->process_totals()->SetExtraFieldInBytes("shared_bytes", shared_bytes); | 622 pmd->process_totals()->SetExtraFieldInBytes("shared_bytes", shared_bytes); |
| 623 pmd->process_totals()->SetExtraFieldInBytes("user_wired_bytes", wired_bytes); | |
|
Primiano Tucci (use gerrit)
2017/03/28 20:32:54
is the "user_" part important? just worrying about
erikchen
2017/03/30 00:03:14
Done.
| |
| 622 #else | 624 #else |
| 623 uint64_t rss_bytes = process_metrics_->GetWorkingSetSize(); | 625 uint64_t rss_bytes = process_metrics_->GetWorkingSetSize(); |
| 624 #endif // defined(OS_MACOSX) | 626 #endif // defined(OS_MACOSX) |
| 625 if (rss_bytes_for_testing) | 627 if (rss_bytes_for_testing) |
| 626 rss_bytes = rss_bytes_for_testing; | 628 rss_bytes = rss_bytes_for_testing; |
| 627 | 629 |
| 628 // rss_bytes will be 0 if the process ended while dumping. | 630 // rss_bytes will be 0 if the process ended while dumping. |
| 629 if (!rss_bytes) | 631 if (!rss_bytes) |
| 630 return false; | 632 return false; |
| 631 | 633 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 704 #endif | 706 #endif |
| 705 } | 707 } |
| 706 | 708 |
| 707 void ProcessMetricsMemoryDumpProvider::SuspendFastMemoryPolling() { | 709 void ProcessMetricsMemoryDumpProvider::SuspendFastMemoryPolling() { |
| 708 #if defined(OS_LINUX) || defined(OS_ANDROID) | 710 #if defined(OS_LINUX) || defined(OS_ANDROID) |
| 709 fast_polling_statm_fd_.reset(); | 711 fast_polling_statm_fd_.reset(); |
| 710 #endif | 712 #endif |
| 711 } | 713 } |
| 712 | 714 |
| 713 } // namespace tracing | 715 } // namespace tracing |
| OLD | NEW |