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

Side by Side Diff: cc/debug/lap_timer.h

Issue 1082103003: Make a couple of SurfaceAggregatorPerfTests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 | « cc/cc_tests.gyp ('k') | cc/debug/lap_timer.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 #ifndef CC_DEBUG_LAP_TIMER_H_ 5 #ifndef CC_DEBUG_LAP_TIMER_H_
6 #define CC_DEBUG_LAP_TIMER_H_ 6 #define CC_DEBUG_LAP_TIMER_H_
7 7
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "cc/base/cc_export.h" 9 #include "cc/base/cc_export.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 // LapTimer is used to calculate average times per "Lap" in perf tests. 13 // LapTimer is used to calculate average times per "Lap" in perf tests.
14 // Current() reports the time since the last call to Start(). 14 // Current() reports the time since the last call to Start().
15 // Store() adds the time since the last call to Start() to the accumulator, and 15 // Store() adds the time since the last call to Start() to the accumulator, and
16 // resets the start time to now. Stored() returns the accumulated time. 16 // resets the start time to now. Stored() returns the accumulated time.
17 // NextLap increments the lap counter, used in counting the per lap averages. 17 // NextLap increments the lap counter, used in counting the per lap averages.
18 // If you initialize the LapTimer with a non zero warmup_laps, it will ignore 18 // If you initialize the LapTimer with a non zero warmup_laps, it will ignore
19 // the times for that many laps at the start. 19 // the times for that many laps at the start.
20 // If you set the time_limit then you can use HasTimeLimitExpired() to see if 20 // If you set the time_limit then you can use HasTimeLimitExpired() to see if
21 // the current accumulated time has crossed that threshold, with an optimization 21 // the current accumulated time has crossed that threshold, with an optimization
22 // that it only tests this every check_interval laps. 22 // that it only tests this every check_interval laps.
23 class CC_EXPORT LapTimer { 23 class CC_EXPORT LapTimer {
24 public: 24 public:
25 LapTimer(int warmup_laps, base::TimeDelta time_limit, int check_interval); 25 LapTimer(int warmup_laps, base::TimeDelta time_limit, int check_interval);
26 // Create LapTimer with sensible default values.
27 LapTimer();
26 // Resets the timer back to it's starting state. 28 // Resets the timer back to it's starting state.
27 void Reset(); 29 void Reset();
28 // Sets the start point to now. 30 // Sets the start point to now.
29 void Start(); 31 void Start();
30 // Returns true if there are no more warmup laps to do. 32 // Returns true if there are no more warmup laps to do.
31 bool IsWarmedUp(); 33 bool IsWarmedUp();
32 // Advance the lap counter and update the accumulated time. 34 // Advance the lap counter and update the accumulated time.
33 // The accumulated time is only updated every check_interval laps. 35 // The accumulated time is only updated every check_interval laps.
34 // If accumulating then the start point will also be updated. 36 // If accumulating then the start point will also be updated.
35 void NextLap(); 37 void NextLap();
(...skipping 19 matching lines...) Expand all
55 int remaining_no_check_laps_; 57 int remaining_no_check_laps_;
56 base::TimeDelta time_limit_; 58 base::TimeDelta time_limit_;
57 int check_interval_; 59 int check_interval_;
58 60
59 DISALLOW_COPY_AND_ASSIGN(LapTimer); 61 DISALLOW_COPY_AND_ASSIGN(LapTimer);
60 }; 62 };
61 63
62 } // namespace cc 64 } // namespace cc
63 65
64 #endif // CC_DEBUG_LAP_TIMER_H_ 66 #endif // CC_DEBUG_LAP_TIMER_H_
OLDNEW
« no previous file with comments | « cc/cc_tests.gyp ('k') | cc/debug/lap_timer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698