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 "chrome/browser/task_manager/sampling/task_group_sampler.h" | 5 #include "chrome/browser/task_manager/sampling/task_group_sampler.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 MemoryUsageStats TaskGroupSampler::RefreshMemoryUsage() { | 124 MemoryUsageStats TaskGroupSampler::RefreshMemoryUsage() { |
125 DCHECK(worker_pool_sequenced_checker_.CalledOnValidSequence()); | 125 DCHECK(worker_pool_sequenced_checker_.CalledOnValidSequence()); |
126 | 126 |
127 MemoryUsageStats memory_usage; | 127 MemoryUsageStats memory_usage; |
128 #if defined(OS_MACOSX) | 128 #if defined(OS_MACOSX) |
129 size_t private_bytes = 0; | 129 size_t private_bytes = 0; |
130 size_t shared_bytes = 0; | 130 size_t shared_bytes = 0; |
131 size_t resident_bytes = 0; | 131 size_t resident_bytes = 0; |
132 if (process_metrics_->GetMemoryBytes(&private_bytes, &shared_bytes, | 132 if (process_metrics_->GetMemoryBytes(&private_bytes, &shared_bytes, |
133 &resident_bytes)) { | 133 &resident_bytes, nullptr)) { |
134 memory_usage.private_bytes = static_cast<int64_t>(private_bytes); | 134 memory_usage.private_bytes = static_cast<int64_t>(private_bytes); |
135 memory_usage.shared_bytes = static_cast<int64_t>(shared_bytes); | 135 memory_usage.shared_bytes = static_cast<int64_t>(shared_bytes); |
136 memory_usage.physical_bytes = resident_bytes; | 136 memory_usage.physical_bytes = resident_bytes; |
137 } | 137 } |
138 #else | 138 #else |
139 // Refreshing the physical/private/shared memory at one shot. | 139 // Refreshing the physical/private/shared memory at one shot. |
140 base::WorkingSetKBytes ws_usage; | 140 base::WorkingSetKBytes ws_usage; |
141 if (process_metrics_->GetWorkingSetKBytes(&ws_usage)) { | 141 if (process_metrics_->GetWorkingSetKBytes(&ws_usage)) { |
142 memory_usage.private_bytes = static_cast<int64_t>(ws_usage.priv * 1024); | 142 memory_usage.private_bytes = static_cast<int64_t>(ws_usage.priv * 1024); |
143 memory_usage.shared_bytes = static_cast<int64_t>(ws_usage.shared * 1024); | 143 memory_usage.shared_bytes = static_cast<int64_t>(ws_usage.shared * 1024); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 DCHECK(worker_pool_sequenced_checker_.CalledOnValidSequence()); | 183 DCHECK(worker_pool_sequenced_checker_.CalledOnValidSequence()); |
184 #if defined(OS_MACOSX) | 184 #if defined(OS_MACOSX) |
185 return process_.IsProcessBackgrounded( | 185 return process_.IsProcessBackgrounded( |
186 content::BrowserChildProcessHost::GetPortProvider()); | 186 content::BrowserChildProcessHost::GetPortProvider()); |
187 #else | 187 #else |
188 return process_.IsProcessBackgrounded(); | 188 return process_.IsProcessBackgrounded(); |
189 #endif // defined(OS_MACOSX) | 189 #endif // defined(OS_MACOSX) |
190 } | 190 } |
191 | 191 |
192 } // namespace task_manager | 192 } // namespace task_manager |
OLD | NEW |