OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "TimingStateMachine.h" | 8 #include "TimingStateMachine.h" |
9 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 if (1 << 30 == fLoops) { | 41 if (1 << 30 == fLoops) { |
42 // We're about to wrap. Something's wrong with the benc
h. | 42 // We're about to wrap. Something's wrong with the benc
h. |
43 SkDebugf("InnerLoops wrapped\n"); | 43 SkDebugf("InnerLoops wrapped\n"); |
44 fLoops = 1; | 44 fLoops = 1; |
45 } else { | 45 } else { |
46 double elapsedMs = this->elapsed(); | 46 double elapsedMs = this->elapsed(); |
47 if (elapsedMs < FLAGS_loopMs) { | 47 if (elapsedMs < FLAGS_loopMs) { |
48 fLoops *= 2; | 48 fLoops *= 2; |
49 } else { | 49 } else { |
50 fInnerState = kTiming_InnerState; | 50 fInnerState = kTiming_InnerState; |
51 fState = kPreWarm_State; | |
52 } | 51 } |
| 52 fState = kPreWarm_State; |
53 this->resetTimingState(); | 53 this->resetTimingState(); |
54 parentEvent = kReset_ParentEvents; | 54 parentEvent = kReset_ParentEvents; |
55 } | 55 } |
56 break; | 56 break; |
57 } | 57 } |
58 case kTiming_InnerState: { | 58 case kTiming_InnerState: { |
59 if (fCurrentFrame >= FLAGS_frames) { | 59 if (fCurrentFrame >= FLAGS_frames) { |
60 this->recordMeasurement(); | 60 this->recordMeasurement(); |
61 this->resetTimingState(); | 61 this->resetTimingState(); |
62 parentEvent = kTimingFinished_ParentEvents; | 62 parentEvent = kTimingFinished_ParentEvents; |
(...skipping 28 matching lines...) Expand all Loading... |
91 fLastMeasurement = this->elapsed() / (FLAGS_frames * fLoops); | 91 fLastMeasurement = this->elapsed() / (FLAGS_frames * fLoops); |
92 } | 92 } |
93 | 93 |
94 void TimingStateMachine::nextBenchmark(SkCanvas* canvas, Benchmark* benchmark) { | 94 void TimingStateMachine::nextBenchmark(SkCanvas* canvas, Benchmark* benchmark) { |
95 benchmark->postDraw(canvas); | 95 benchmark->postDraw(canvas); |
96 benchmark->perCanvasPostDraw(canvas); | 96 benchmark->perCanvasPostDraw(canvas); |
97 fLoops = 1; | 97 fLoops = 1; |
98 fInnerState = kTuning_InnerState; | 98 fInnerState = kTuning_InnerState; |
99 fState = kPreWarm_State; | 99 fState = kPreWarm_State; |
100 } | 100 } |
OLD | NEW |