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

Side by Side Diff: base/debug/trace_event_synthetic_delay.cc

Issue 98953002: Configure synthetic delays through TraceLog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed test failure on ios_dbg_simulator Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « base/debug/trace_event_impl.cc ('k') | base/debug/trace_event_synthetic_delay_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/debug/trace_event_synthetic_delay.h" 5 #include "base/debug/trace_event_synthetic_delay.h"
6 #include "base/memory/singleton.h" 6 #include "base/memory/singleton.h"
7 7
8 namespace { 8 namespace {
9 const int kMaxSyntheticDelays = 32; 9 const int kMaxSyntheticDelays = 32;
10 } // namespace 10 } // namespace
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 return &delays_[delay_count]; 183 return &delays_[delay_count];
184 } 184 }
185 185
186 base::TimeTicks TraceEventSyntheticDelayRegistry::Now() { 186 base::TimeTicks TraceEventSyntheticDelayRegistry::Now() {
187 return base::TimeTicks::HighResNow(); 187 return base::TimeTicks::HighResNow();
188 } 188 }
189 189
190 void TraceEventSyntheticDelayRegistry::ResetAllDelays() { 190 void TraceEventSyntheticDelayRegistry::ResetAllDelays() {
191 AutoLock lock(lock_); 191 AutoLock lock(lock_);
192 int delay_count = base::subtle::Acquire_Load(&delay_count_); 192 int delay_count = base::subtle::Acquire_Load(&delay_count_);
193 for (int i = 0; i < delay_count; ++i) 193 for (int i = 0; i < delay_count; ++i) {
194 delays_[i].SetTargetDuration(base::TimeDelta()); 194 delays_[i].SetTargetDuration(base::TimeDelta());
195 delays_[i].SetClock(this);
196 }
195 } 197 }
196 198
197 void ResetTraceEventSyntheticDelays() { 199 void ResetTraceEventSyntheticDelays() {
198 TraceEventSyntheticDelayRegistry::GetInstance()->ResetAllDelays(); 200 TraceEventSyntheticDelayRegistry::GetInstance()->ResetAllDelays();
199 } 201 }
200 202
201 } // namespace debug 203 } // namespace debug
202 } // namespace base 204 } // namespace base
203 205
204 namespace trace_event_internal { 206 namespace trace_event_internal {
(...skipping 17 matching lines...) Expand all
222 if (!delay_impl) { 224 if (!delay_impl) {
223 delay_impl = base::debug::TraceEventSyntheticDelayRegistry::GetInstance() 225 delay_impl = base::debug::TraceEventSyntheticDelayRegistry::GetInstance()
224 ->GetOrCreateDelay(name); 226 ->GetOrCreateDelay(name);
225 base::subtle::NoBarrier_Store( 227 base::subtle::NoBarrier_Store(
226 impl_ptr, reinterpret_cast<base::subtle::AtomicWord>(delay_impl)); 228 impl_ptr, reinterpret_cast<base::subtle::AtomicWord>(delay_impl));
227 } 229 }
228 return delay_impl; 230 return delay_impl;
229 } 231 }
230 232
231 } // namespace trace_event_internal 233 } // namespace trace_event_internal
OLDNEW
« no previous file with comments | « base/debug/trace_event_impl.cc ('k') | base/debug/trace_event_synthetic_delay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698