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

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

Issue 1385073002: Create VisualStreamTimingModule (Closed) Base URL: https://skia.googlesource.com/skia.git@vb3a
Patch Set: feedback inc 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
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 *
7 */ 6 */
8 7
9 #ifndef VisualLightweightBenchModule_DEFINED 8 #ifndef VisualLightweightBenchModule_DEFINED
10 #define VisualLightweightBenchModule_DEFINED 9 #define VisualLightweightBenchModule_DEFINED
11 10
12 #include "VisualModule.h" 11 #include "VisualStreamTimingModule.h"
13 12
14 #include "ResultsWriter.h" 13 #include "ResultsWriter.h"
15 #include "SkPicture.h" 14 #include "SkPicture.h"
16 #include "TimingStateMachine.h"
17 #include "VisualBench.h" 15 #include "VisualBench.h"
18 #include "VisualBenchmarkStream.h"
19 16
20 class SkCanvas; 17 class SkCanvas;
21 18
22 /* 19 /*
23 * This module is designed to be a minimal overhead timing module for VisualBenc h 20 * This module is designed to be a minimal overhead timing module for VisualBenc h
24 */ 21 */
25 class VisualLightweightBenchModule : public VisualModule { 22 class VisualLightweightBenchModule : public VisualStreamTimingModule {
26 public: 23 public:
27 // TODO get rid of backpointer 24 // TODO get rid of backpointer
28 VisualLightweightBenchModule(VisualBench* owner); 25 VisualLightweightBenchModule(VisualBench* owner);
29 26
30 void draw(SkCanvas* canvas) override;
31
32 bool onHandleChar(SkUnichar c) override; 27 bool onHandleChar(SkUnichar c) override;
33 28
34 private: 29 private:
35 void setTitle(); 30 void renderFrame(SkCanvas*, Benchmark*, int loops) override;
36 bool setupBackend(); 31 bool timingFinished(Benchmark*, int loops, double measurement) override;
37 void setupRenderTarget(); 32 void printStats(Benchmark*, int loops);
38 void printStats();
39 bool advanceRecordIfNecessary(SkCanvas*);
40 inline void renderFrame(SkCanvas*);
41 33
42 struct Record { 34 struct Record {
43 SkTArray<double> fMeasurements; 35 SkTArray<double> fMeasurements;
44 }; 36 };
45 int fCurrentSample; 37 int fCurrentSample;
46 SkTArray<Record> fRecords; 38 SkTArray<Record> fRecords;
47 SkAutoTDelete<VisualBenchmarkStream> fBenchmarkStream;
48 SkAutoTUnref<Benchmark> fBenchmark;
49 TimingStateMachine fTSM;
50 bool fHasBeenReset;
51 39
52 // support framework 40 // support framework
53 SkAutoTUnref<VisualBench> fOwner;
54 SkAutoTDelete<ResultsWriter> fResults; 41 SkAutoTDelete<ResultsWriter> fResults;
55 42
56 typedef VisualModule INHERITED; 43 typedef VisualStreamTimingModule INHERITED;
57 }; 44 };
58 45
59 #endif 46 #endif
OLDNEW
« no previous file with comments | « tools/VisualBench/VisualInteractiveModule.cpp ('k') | tools/VisualBench/VisualLightweightBenchModule.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698