diff options
author | 2015-07-17 09:09:23 -0700 | |
---|---|---|
committer | 2015-07-17 09:09:23 -0700 | |
commit | a2a6fe86998035f9930f31a84bce508ada044910 (patch) | |
tree | d8b11a37a72dce1547fdc25a84f18afb7e1f56a5 /tools/VisualBench/VisualBench.h | |
parent | 5150a77ee70b4ea07e3c1721f74b0f3c79a4bd58 (diff) |
Some cleanups of VisualBench
BUG=skia:
Review URL: https://codereview.chromium.org/1240633005
Diffstat (limited to 'tools/VisualBench/VisualBench.h')
-rw-r--r-- | tools/VisualBench/VisualBench.h | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/tools/VisualBench/VisualBench.h b/tools/VisualBench/VisualBench.h index b8cd2bdb77..9843693777 100644 --- a/tools/VisualBench/VisualBench.h +++ b/tools/VisualBench/VisualBench.h @@ -39,6 +39,34 @@ protected: void onSizeChange() override; private: + /* + * The heart of visual bench 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, + kTiming_State, + }; void setTitle(); bool setupBackend(); void resetContext(); @@ -47,19 +75,21 @@ private: void printStats(); bool advanceRecordIfNecessary(SkCanvas*); inline void renderFrame(SkCanvas*); + inline void nextState(State); + void perCanvasPreDraw(SkCanvas*, State); + void preWarm(State nextState); + void scaleLoops(double elapsedMs); + inline void tuneLoops(); + inline void timing(SkCanvas*); + inline double elapsed(); + void resetTimingState(); + void postDraw(SkCanvas*); + void recordMeasurement(); struct Record { SkTArray<double> fMeasurements; }; - enum State { - kPreWarmLoops_State, - kTuneLoops_State, - kPreWarmTiming_State, - kTiming_State, - }; - void preWarm(State nextState); - int fCurrentSample; int fCurrentFrame; int fFlushes; |