Index: tools/VisualBench/TimingStateMachine.h |
diff --git a/tools/VisualBench/TimingStateMachine.h b/tools/VisualBench/TimingStateMachine.h |
index 5ec1313b1f65bf98f5998f487ad3240ed27493ea..7f7a5affb5dfeb29cf41523e2e687dd0a6d988bc 100644 |
--- a/tools/VisualBench/TimingStateMachine.h |
+++ b/tools/VisualBench/TimingStateMachine.h |
@@ -36,13 +36,7 @@ public: |
// reset |
}; |
- ParentEvents nextFrame(SkCanvas* canvas, Benchmark* benchmark); |
- |
- /* |
- * Before taking another sample, the owner can choose to prewarm or not |
- */ |
- void nextSampleWithPrewarm(); |
- void nextSample(); |
+ ParentEvents nextFrame(bool preWarmBetweenSamples); |
/* |
* The caller should call this when they are ready to move to the next benchmark. The caller |
@@ -50,7 +44,6 @@ public: |
*/ |
void nextBenchmark(SkCanvas*, Benchmark*); |
- |
/* |
* When TimingStateMachine returns kTimingFinished_ParentEvents, then the owner can call |
* lastMeasurement() to get the time |
@@ -60,43 +53,17 @@ public: |
int loops() const { return fLoops; } |
private: |
- /* |
- * The heart of the timing state machine is an event driven timing loop. |
- * kPreWarmLoopsPerCanvasPreDraw_State: Before we begin timing, Benchmarks have a hook to |
- * access the canvas. Then we prewarm before the autotune |
- * loops step. |
- * kPreWarmLoops_State: We prewarm the gpu before auto tuning to enter a steady |
- * work state |
- * kTuneLoops_State: Then we tune the loops of the benchmark to ensure we |
- * are doing a measurable amount of work |
- * kPreWarmTimingPerCanvasPreDraw_State: Because reset the context after tuning loops to ensure |
- * coherent state, we need to give the benchmark |
- * another hook |
- * kPreWarmTiming_State: We prewarm the gpu again to enter a steady state |
- * kTiming_State: Finally we time the benchmark. When finished timing |
- * if we have enough samples then we'll start the next |
- * benchmark in the kPreWarmLoopsPerCanvasPreDraw_State. |
- * otherwise, we enter the |
- * kPreWarmTimingPerCanvasPreDraw_State for another sample |
- * In either case we reset the context. |
- */ |
enum State { |
- kPreWarmLoopsPerCanvasPreDraw_State, |
- kPreWarmLoops_State, |
- kTuneLoops_State, |
- kPreWarmTimingPerCanvasPreDraw_State, |
- kPreWarmTiming_State, |
+ kPreWarm_State, |
kTiming_State, |
}; |
+ enum InnerState { |
+ kTuning_InnerState, |
+ kTiming_InnerState, |
+ }; |
- inline void nextState(State); |
- ParentEvents perCanvasPreDraw(SkCanvas*, Benchmark*, State); |
- ParentEvents preWarm(State nextState); |
- inline ParentEvents tuneLoops(); |
- inline ParentEvents timing(SkCanvas*, Benchmark*); |
inline double elapsed(); |
void resetTimingState(); |
- void postDraw(SkCanvas*, Benchmark*); |
void recordMeasurement(); |
int fCurrentFrame; |
@@ -104,6 +71,7 @@ private: |
double fLastMeasurement; |
WallTimer fTimer; |
State fState; |
+ InnerState fInnerState; |
}; |
#endif |