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

Side by Side Diff: tools/VisualBench/VisualStreamTimingModule.h

Issue 1442643007: Add visualbench option to not reset between samples (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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
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 #ifndef VisualStreamTimingModule_DEFINED 8 #ifndef VisualStreamTimingModule_DEFINED
9 #define VisualStreamTimingModule_DEFINED 9 #define VisualStreamTimingModule_DEFINED
10 10
11 #include "VisualModule.h" 11 #include "VisualModule.h"
12 12
13 #include "TimingStateMachine.h" 13 #include "TimingStateMachine.h"
14 #include "VisualBench.h" 14 #include "VisualBench.h"
15 #include "VisualBenchmarkStream.h" 15 #include "VisualBenchmarkStream.h"
16 16
17 class SkCanvas; 17 class SkCanvas;
18 18
19 /* 19 /*
20 * VisualStreamTimingModule is the base class for modules which want to time a s tream of Benchmarks. 20 * VisualStreamTimingModule is the base class for modules which want to time a s tream of Benchmarks.
21 * 21 *
22 * Subclasses should implement renderFrame, which is called for each frame, and timingFinished, 22 * Subclasses should implement renderFrame, which is called for each frame, and timingFinished,
23 * which is called when a sample has finished timing. 23 * which is called when a sample has finished timing.
24 */ 24 */
25 class VisualStreamTimingModule : public VisualModule { 25 class VisualStreamTimingModule : public VisualModule {
26 public: 26 public:
27 VisualStreamTimingModule(VisualBench* owner, bool preWarmBeforeSample); 27 VisualStreamTimingModule(VisualBench* owner);
28 void draw(SkCanvas* canvas) override; 28 void draw(SkCanvas* canvas) override;
29 29
30 private: 30 private:
31 virtual void renderFrame(SkCanvas*, Benchmark*, int loops)=0; 31 virtual void renderFrame(SkCanvas*, Benchmark*, int loops)=0;
32 32
33 // subclasses should return true to advance the stream 33 // subclasses should return true to advance the stream
34 virtual bool timingFinished(Benchmark*, int loops, double measurement)=0; 34 virtual bool timingFinished(Benchmark*, int loops, double measurement)=0;
35 35
36 inline void handleInitState(SkCanvas*); 36 inline void handleInitState(SkCanvas*);
37 inline void handleTimingEvent(SkCanvas*, TimingStateMachine::ParentEvents); 37 inline void handleTimingEvent(SkCanvas*, TimingStateMachine::ParentEvents);
38 38
39 TimingStateMachine fTSM; 39 TimingStateMachine fTSM;
40 SkAutoTDelete<VisualBenchmarkStream> fBenchmarkStream; 40 SkAutoTDelete<VisualBenchmarkStream> fBenchmarkStream;
41 enum InitState { 41 enum InitState {
42 kNone_InitState, 42 kNone_InitState,
43 kReset_InitState, 43 kReset_InitState,
44 kNewBenchmark_InitState, 44 kNewBenchmark_InitState,
45 }; 45 };
46 InitState fInitState; 46 InitState fInitState;
47 bool fPreWarmBeforeSample;
48 47
49 // support framework 48 // support framework
50 VisualBench* fOwner; 49 VisualBench* fOwner;
51 50
52 typedef VisualModule INHERITED; 51 typedef VisualModule INHERITED;
53 }; 52 };
54 53
55 #endif 54 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698