Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 | 8 |
| 9 #ifndef VisualLightweightBenchModule_DEFINED | 9 #ifndef VisualLightweightBenchModule_DEFINED |
| 10 #define VisualLightweightBenchModule_DEFINED | 10 #define VisualLightweightBenchModule_DEFINED |
| 11 | 11 |
| 12 #include "VisualModule.h" | 12 #include "VisualStreamTimingModule.h" |
| 13 | 13 |
| 14 #include "ResultsWriter.h" | 14 #include "ResultsWriter.h" |
| 15 #include "SkPicture.h" | 15 #include "SkPicture.h" |
| 16 #include "TimingStateMachine.h" | |
| 17 #include "VisualBench.h" | 16 #include "VisualBench.h" |
| 18 #include "VisualBenchmarkStream.h" | |
| 19 | 17 |
| 20 class SkCanvas; | 18 class SkCanvas; |
| 21 | 19 |
| 22 /* | 20 /* |
|
robertphillips
2015/10/06 12:19:46
New comment ?
joshualitt
2015/10/07 19:33:52
This is still true though.
| |
| 23 * This module is designed to be a minimal overhead timing module for VisualBenc h | 21 * This module is designed to be a minimal overhead timing module for VisualBenc h |
| 24 */ | 22 */ |
| 25 class VisualLightweightBenchModule : public VisualModule { | 23 class VisualLightweightBenchModule : public VisualStreamTimingModule { |
| 26 public: | 24 public: |
| 27 // TODO get rid of backpointer | 25 // TODO get rid of backpointer |
| 28 VisualLightweightBenchModule(VisualBench* owner); | 26 VisualLightweightBenchModule(VisualBench* owner); |
| 29 | 27 |
| 30 void draw(SkCanvas* canvas) override; | |
| 31 | |
| 32 bool onHandleChar(SkUnichar c) override; | 28 bool onHandleChar(SkUnichar c) override; |
| 33 | 29 |
| 34 private: | 30 private: |
| 35 void setTitle(); | 31 void renderFrame(SkCanvas*, Benchmark*, int loops) override; |
| 36 bool setupBackend(); | 32 bool timingFinished(Benchmark*, int loops, double measurement) override; |
| 37 void setupRenderTarget(); | 33 void printStats(Benchmark*, int loops); |
| 38 void printStats(); | |
| 39 bool advanceRecordIfNecessary(SkCanvas*); | |
| 40 inline void renderFrame(SkCanvas*); | |
| 41 | 34 |
| 42 struct Record { | 35 struct Record { |
| 43 SkTArray<double> fMeasurements; | 36 SkTArray<double> fMeasurements; |
| 44 }; | 37 }; |
| 45 int fCurrentSample; | 38 int fCurrentSample; |
| 46 SkTArray<Record> fRecords; | 39 SkTArray<Record> fRecords; |
| 47 SkAutoTDelete<VisualBenchmarkStream> fBenchmarkStream; | |
| 48 SkAutoTUnref<Benchmark> fBenchmark; | |
| 49 TimingStateMachine fTSM; | |
| 50 bool fHasBeenReset; | |
| 51 | 40 |
| 52 // support framework | 41 // support framework |
| 53 SkAutoTUnref<VisualBench> fOwner; | |
| 54 SkAutoTDelete<ResultsWriter> fResults; | 42 SkAutoTDelete<ResultsWriter> fResults; |
| 55 | 43 |
| 56 typedef VisualModule INHERITED; | 44 typedef VisualStreamTimingModule INHERITED; |
| 57 }; | 45 }; |
| 58 | 46 |
| 59 #endif | 47 #endif |
| OLD | NEW |