OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/memory_dump_scheduler.h" | 5 #include "base/trace_event/memory_dump_scheduler.h" |
6 | 6 |
7 #include "base/process/process_metrics.h" | 7 #include "base/process/process_metrics.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "base/trace_event/memory_dump_manager.h" | 10 #include "base/trace_event/memory_dump_manager.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 level_of_detail = MemoryDumpLevelOfDetail::LIGHT; | 164 level_of_detail = MemoryDumpLevelOfDetail::LIGHT; |
165 if (periodic_state_->heavy_dumps_rate > 0 && | 165 if (periodic_state_->heavy_dumps_rate > 0 && |
166 periodic_state_->dump_count % periodic_state_->heavy_dumps_rate == 0) | 166 periodic_state_->dump_count % periodic_state_->heavy_dumps_rate == 0) |
167 level_of_detail = MemoryDumpLevelOfDetail::DETAILED; | 167 level_of_detail = MemoryDumpLevelOfDetail::DETAILED; |
168 ++periodic_state_->dump_count; | 168 ++periodic_state_->dump_count; |
169 | 169 |
170 mdm_->RequestGlobalDump(MemoryDumpType::PERIODIC_INTERVAL, level_of_detail); | 170 mdm_->RequestGlobalDump(MemoryDumpType::PERIODIC_INTERVAL, level_of_detail); |
171 } | 171 } |
172 | 172 |
173 void MemoryDumpScheduler::PollMemoryOnPollingThread() { | 173 void MemoryDumpScheduler::PollMemoryOnPollingThread() { |
174 if (polling_state_->current_state != PollingTriggerState::ENABLED) | 174 if (!polling_state_) |
Primiano Tucci (use gerrit)
2017/03/29 16:21:22
I think you need both checks, i.e.
if (!polling_st
ssid
2017/03/29 16:41:45
No the fix is correct as it is. As soon as disable
ssid
2017/03/29 16:46:38
Maybe a dcheck(enabled)
| |
175 return; | 175 return; |
176 | 176 |
177 uint64_t polled_memory = 0; | 177 uint64_t polled_memory = 0; |
178 bool res = mdm_->PollFastMemoryTotal(&polled_memory); | 178 bool res = mdm_->PollFastMemoryTotal(&polled_memory); |
179 DCHECK(res); | 179 DCHECK(res); |
180 if (polling_state_->level_of_detail == MemoryDumpLevelOfDetail::DETAILED) { | 180 if (polling_state_->level_of_detail == MemoryDumpLevelOfDetail::DETAILED) { |
181 TRACE_COUNTER1(MemoryDumpManager::kTraceCategory, "PolledMemoryMB", | 181 TRACE_COUNTER1(MemoryDumpManager::kTraceCategory, "PolledMemoryMB", |
182 polled_memory / 1024 / 1024); | 182 polled_memory / 1024 / 1024); |
183 } | 183 } |
184 | 184 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
317 last_memory_totals_kb[last_memory_totals_kb_index] * 1024; | 317 last_memory_totals_kb[last_memory_totals_kb_index] * 1024; |
318 } | 318 } |
319 num_polls_from_last_dump = 0; | 319 num_polls_from_last_dump = 0; |
320 for (uint32_t i = 0; i < kMaxNumMemorySamples; ++i) | 320 for (uint32_t i = 0; i < kMaxNumMemorySamples; ++i) |
321 last_memory_totals_kb[i] = 0; | 321 last_memory_totals_kb[i] = 0; |
322 last_memory_totals_kb_index = 0; | 322 last_memory_totals_kb_index = 0; |
323 } | 323 } |
324 | 324 |
325 } // namespace trace_event | 325 } // namespace trace_event |
326 } // namespace base | 326 } // namespace base |
OLD | NEW |