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

Side by Side Diff: tools/VisualBench/TimingStateMachine.cpp

Issue 1382883003: move visual bench interactive module to timing state machine (Closed) Base URL: https://skia.googlesource.com/skia.git@vb
Patch Set: Created 5 years, 2 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 | « tools/VisualBench/TimingStateMachine.h ('k') | tools/VisualBench/VisualInteractiveModule.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 this->resetTimingState(); 94 this->resetTimingState();
95 return kReset_ParentEvents; 95 return kReset_ParentEvents;
96 } 96 }
97 } 97 }
98 98
99 void TimingStateMachine::recordMeasurement() { 99 void TimingStateMachine::recordMeasurement() {
100 fLastMeasurement = this->elapsed() / (FLAGS_frames * fLoops); 100 fLastMeasurement = this->elapsed() / (FLAGS_frames * fLoops);
101 } 101 }
102 102
103 void TimingStateMachine::nextBenchmark(SkCanvas* canvas, Benchmark* benchmark) {
104 benchmark->postDraw(canvas);
105 benchmark->perCanvasPostDraw(canvas);
106 fLoops = 1;
107 this->nextState(kPreWarmLoopsPerCanvasPreDraw_State);
108 }
109
110 inline TimingStateMachine::ParentEvents TimingStateMachine::timing(SkCanvas* can vas, 103 inline TimingStateMachine::ParentEvents TimingStateMachine::timing(SkCanvas* can vas,
111 Benchmark* be nchmark) { 104 Benchmark* be nchmark) {
112 if (fCurrentFrame >= FLAGS_frames) { 105 if (fCurrentFrame >= FLAGS_frames) {
113 this->recordMeasurement(); 106 this->recordMeasurement();
114 this->resetTimingState(); 107 this->resetTimingState();
115 this->nextState(kPreWarmTimingPerCanvasPreDraw_State);
116 return kTimingFinished_ParentEvents; 108 return kTimingFinished_ParentEvents;
117 } else { 109 } else {
118 fCurrentFrame++; 110 fCurrentFrame++;
119 return kTiming_ParentEvents; 111 return kTiming_ParentEvents;
120 } 112 }
121 } 113 }
122 114
115 void TimingStateMachine::nextBenchmark(SkCanvas* canvas, Benchmark* benchmark) {
116 benchmark->postDraw(canvas);
117 benchmark->perCanvasPostDraw(canvas);
118 fLoops = 1;
119 this->nextState(kPreWarmLoopsPerCanvasPreDraw_State);
120 }
121
122 void TimingStateMachine::nextSampleWithPrewarm() {
123 this->nextState(kPreWarmTimingPerCanvasPreDraw_State);
124 }
125
126 void TimingStateMachine::nextSample() {
127 fTimer.start();
128 }
OLDNEW
« no previous file with comments | « tools/VisualBench/TimingStateMachine.h ('k') | tools/VisualBench/VisualInteractiveModule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698