Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: base/trace_event/memory_dump_scheduler.cc

Issue 2902413002: memory-infra: remove light dumps and increment default dump time to 5s (Closed)
Patch Set: Undo crrev.com/2815963002, fire first timer immediately Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/trace_event/trace_config.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 DCHECK_EQ(0u, light_dump_period_ms % min_period_ms); 67 DCHECK_EQ(0u, light_dump_period_ms % min_period_ms);
68 DCHECK_EQ(0u, heavy_dump_period_ms % min_period_ms); 68 DCHECK_EQ(0u, heavy_dump_period_ms % min_period_ms);
69 DCHECK(!config.callback.is_null()); 69 DCHECK(!config.callback.is_null());
70 callback_ = config.callback; 70 callback_ = config.callback;
71 period_ms_ = min_period_ms; 71 period_ms_ = min_period_ms;
72 tick_count_ = 0; 72 tick_count_ = 0;
73 light_dump_rate_ = light_dump_period_ms / min_period_ms; 73 light_dump_rate_ = light_dump_period_ms / min_period_ms;
74 heavy_dump_rate_ = heavy_dump_period_ms / min_period_ms; 74 heavy_dump_rate_ = heavy_dump_period_ms / min_period_ms;
75 75
76 // Trigger the first dump after |period_ms_| and not as soon as timer starts. 76 // Trigger the first dump immediately.
77 SequencedTaskRunnerHandle::Get()->PostDelayedTask( 77 SequencedTaskRunnerHandle::Get()->PostTask(
78 FROM_HERE, 78 FROM_HERE,
79 BindOnce(&MemoryDumpScheduler::Tick, Unretained(this), ++generation_), 79 BindOnce(&MemoryDumpScheduler::Tick, Unretained(this), ++generation_));
80 TimeDelta::FromMilliseconds(period_ms_));
81 } 80 }
82 81
83 void MemoryDumpScheduler::StopInternal() { 82 void MemoryDumpScheduler::StopInternal() {
84 period_ms_ = 0; 83 period_ms_ = 0;
85 generation_++; 84 generation_++;
86 callback_.Reset(); 85 callback_.Reset();
87 } 86 }
88 87
89 void MemoryDumpScheduler::Tick(uint32_t expected_generation) { 88 void MemoryDumpScheduler::Tick(uint32_t expected_generation) {
90 if (period_ms_ == 0 || generation_ != expected_generation) 89 if (period_ms_ == 0 || generation_ != expected_generation)
(...skipping 15 matching lines...) Expand all
106 callback_.Run(level_of_detail); 105 callback_.Run(level_of_detail);
107 } 106 }
108 107
109 MemoryDumpScheduler::Config::Config() {} 108 MemoryDumpScheduler::Config::Config() {}
110 MemoryDumpScheduler::Config::~Config() {} 109 MemoryDumpScheduler::Config::~Config() {}
111 MemoryDumpScheduler::Config::Config(const MemoryDumpScheduler::Config&) = 110 MemoryDumpScheduler::Config::Config(const MemoryDumpScheduler::Config&) =
112 default; 111 default;
113 112
114 } // namespace trace_event 113 } // namespace trace_event
115 } // namespace base 114 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/trace_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698