| Index: tools/VisualBench/VisualLightweightBenchModule.h
|
| diff --git a/tools/VisualBench/VisualLightweightBenchModule.h b/tools/VisualBench/VisualLightweightBenchModule.h
|
| index 1a30875c61b0d52f588eef1e56d138fa39243ed9..ffa109dc495df829c6f0e3b392c9942e259ba01a 100644
|
| --- a/tools/VisualBench/VisualLightweightBenchModule.h
|
| +++ b/tools/VisualBench/VisualLightweightBenchModule.h
|
| @@ -13,7 +13,7 @@
|
|
|
| #include "ResultsWriter.h"
|
| #include "SkPicture.h"
|
| -#include "Timer.h"
|
| +#include "TimingStateMachine.h"
|
| #include "VisualBench.h"
|
| #include "VisualBenchmarkStream.h"
|
|
|
| @@ -32,65 +32,21 @@ public:
|
| bool onHandleChar(SkUnichar c) override;
|
|
|
| private:
|
| - /*
|
| - * The heart of visual bench is an event driven timing loop.
|
| - * kWarmup_State: We run a dummy bench to let things settle on startup
|
| - * 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 {
|
| - kWarmup_State,
|
| - kPreWarmLoopsPerCanvasPreDraw_State,
|
| - kPreWarmLoops_State,
|
| - kTuneLoops_State,
|
| - kPreWarmTimingPerCanvasPreDraw_State,
|
| - kPreWarmTiming_State,
|
| - kTiming_State,
|
| - };
|
| void setTitle();
|
| bool setupBackend();
|
| void setupRenderTarget();
|
| void printStats();
|
| bool advanceRecordIfNecessary(SkCanvas*);
|
| inline void renderFrame(SkCanvas*);
|
| - inline void nextState(State);
|
| - void perCanvasPreDraw(SkCanvas*, State);
|
| - void preWarm(State nextState);
|
| - inline void tuneLoops();
|
| - inline void timing(SkCanvas*);
|
| - inline double elapsed();
|
| - void resetTimingState();
|
| - void postDraw(SkCanvas*);
|
| - void recordMeasurement();
|
| - void warmup(SkCanvas* canvas);
|
|
|
| struct Record {
|
| SkTArray<double> fMeasurements;
|
| };
|
| -
|
| int fCurrentSample;
|
| - int fCurrentFrame;
|
| - int fLoops;
|
| SkTArray<Record> fRecords;
|
| - WallTimer fTimer;
|
| - State fState;
|
| SkAutoTDelete<VisualBenchmarkStream> fBenchmarkStream;
|
| SkAutoTUnref<Benchmark> fBenchmark;
|
| + TimingStateMachine fTSM;
|
|
|
| // support framework
|
| SkAutoTUnref<VisualBench> fOwner;
|
|
|