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 "base/trace_event/process_memory_totals_dump_provider.h" | 5 #include "base/trace_event/process_memory_totals_dump_provider.h" |
6 | 6 |
7 #include "base/process/process_metrics.h" | 7 #include "base/process/process_metrics.h" |
8 #include "base/trace_event/process_memory_dump.h" | 8 #include "base/trace_event/process_memory_dump.h" |
9 #include "base/trace_event/process_memory_totals.h" | 9 #include "base/trace_event/process_memory_totals.h" |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 ProcessMemoryTotalsDumpProvider::ProcessMemoryTotalsDumpProvider() | 47 ProcessMemoryTotalsDumpProvider::ProcessMemoryTotalsDumpProvider() |
48 : process_metrics_(CreateProcessMetricsForCurrentProcess()) { | 48 : process_metrics_(CreateProcessMetricsForCurrentProcess()) { |
49 } | 49 } |
50 | 50 |
51 ProcessMemoryTotalsDumpProvider::~ProcessMemoryTotalsDumpProvider() { | 51 ProcessMemoryTotalsDumpProvider::~ProcessMemoryTotalsDumpProvider() { |
52 } | 52 } |
53 | 53 |
54 // Called at trace dump point time. Creates a snapshot the memory counters for | 54 // Called at trace dump point time. Creates a snapshot the memory counters for |
55 // the current process. | 55 // the current process. |
56 bool ProcessMemoryTotalsDumpProvider::OnMemoryDump(ProcessMemoryDump* pmd) { | 56 bool ProcessMemoryTotalsDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, |
| 57 ProcessMemoryDump* pmd) { |
57 const uint64 rss_bytes = rss_bytes_for_testing | 58 const uint64 rss_bytes = rss_bytes_for_testing |
58 ? rss_bytes_for_testing | 59 ? rss_bytes_for_testing |
59 : process_metrics_->GetWorkingSetSize(); | 60 : process_metrics_->GetWorkingSetSize(); |
60 | 61 |
61 uint64 peak_rss_bytes = 0; | 62 uint64 peak_rss_bytes = 0; |
62 | 63 |
63 #if !defined(OS_IOS) | 64 #if !defined(OS_IOS) |
64 peak_rss_bytes = process_metrics_->GetPeakWorkingSetSize(); | 65 peak_rss_bytes = process_metrics_->GetPeakWorkingSetSize(); |
65 #if defined(OS_LINUX) || defined(OS_ANDROID) | 66 #if defined(OS_LINUX) || defined(OS_ANDROID) |
66 if (kernel_supports_rss_peak_reset) { | 67 if (kernel_supports_rss_peak_reset) { |
(...skipping 17 matching lines...) Expand all Loading... |
84 pmd->process_totals()->set_peak_resident_set_bytes(peak_rss_bytes); | 85 pmd->process_totals()->set_peak_resident_set_bytes(peak_rss_bytes); |
85 pmd->set_has_process_totals(); | 86 pmd->set_has_process_totals(); |
86 return true; | 87 return true; |
87 } | 88 } |
88 | 89 |
89 return false; | 90 return false; |
90 } | 91 } |
91 | 92 |
92 } // namespace trace_event | 93 } // namespace trace_event |
93 } // namespace base | 94 } // namespace base |
OLD | NEW |