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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 if (statm_fd == -1) | 648 if (statm_fd == -1) |
649 return false; | 649 return false; |
650 const static size_t page_size = base::GetPageSize(); | 650 const static size_t page_size = base::GetPageSize(); |
651 uint64_t resident_pages; | 651 uint64_t resident_pages; |
652 uint64_t shared_pages; | 652 uint64_t shared_pages; |
653 bool success = GetResidentAndSharedPagesFromStatmFile( | 653 bool success = GetResidentAndSharedPagesFromStatmFile( |
654 statm_fd, &resident_pages, &shared_pages); | 654 statm_fd, &resident_pages, &shared_pages); |
655 if (!success) | 655 if (!success) |
656 return false; | 656 return false; |
657 | 657 |
658 // TODO(hjd): Implement swap in the next CL. | |
659 footprint.rss_anon_bytes = (resident_pages - shared_pages) * page_size; | 658 footprint.rss_anon_bytes = (resident_pages - shared_pages) * page_size; |
| 659 footprint.vm_swap_bytes = process_metrics_->GetVmSwapBytes(); |
660 #endif // defined(OS_LINUX) || defined(OS_ANDROID) | 660 #endif // defined(OS_LINUX) || defined(OS_ANDROID) |
661 | 661 |
662 #if !defined(OS_IOS) | 662 #if !defined(OS_IOS) |
663 peak_rss_bytes = process_metrics_->GetPeakWorkingSetSize(); | 663 peak_rss_bytes = process_metrics_->GetPeakWorkingSetSize(); |
664 #if defined(OS_LINUX) || defined(OS_ANDROID) | 664 #if defined(OS_LINUX) || defined(OS_ANDROID) |
665 if (is_rss_peak_resettable_) { | 665 if (is_rss_peak_resettable_) { |
666 std::string clear_refs_file = | 666 std::string clear_refs_file = |
667 "/proc/" + | 667 "/proc/" + |
668 (process_ == base::kNullProcessId ? "self" | 668 (process_ == base::kNullProcessId ? "self" |
669 : base::IntToString(process_)) + | 669 : base::IntToString(process_)) + |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 #endif | 742 #endif |
743 } | 743 } |
744 | 744 |
745 void ProcessMetricsMemoryDumpProvider::SuspendFastMemoryPolling() { | 745 void ProcessMetricsMemoryDumpProvider::SuspendFastMemoryPolling() { |
746 #if defined(OS_LINUX) || defined(OS_ANDROID) | 746 #if defined(OS_LINUX) || defined(OS_ANDROID) |
747 fast_polling_statm_fd_.reset(); | 747 fast_polling_statm_fd_.reset(); |
748 #endif | 748 #endif |
749 } | 749 } |
750 | 750 |
751 } // namespace tracing | 751 } // namespace tracing |
OLD | NEW |