OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 PictureBenchmark_DEFINED | 8 #ifndef PictureBenchmark_DEFINED |
9 #define PictureBenchmark_DEFINED | 9 #define PictureBenchmark_DEFINED |
10 | 10 |
11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
12 #include "PictureRenderer.h" | 12 #include "PictureRenderer.h" |
13 #include "TimerData.h" | 13 #include "TimerData.h" |
14 #include "PictureResultsWriter.h" | |
15 | 14 |
16 class BenchTimer; | 15 class BenchTimer; |
17 class SkBenchLogger; | 16 class SkBenchLogger; |
18 class SkPicture; | 17 class SkPicture; |
19 class SkString; | 18 class SkString; |
20 | 19 |
21 namespace sk_tools { | 20 namespace sk_tools { |
22 | 21 |
23 class PictureBenchmark { | 22 class PictureBenchmark { |
24 public: | 23 public: |
25 PictureBenchmark(); | 24 PictureBenchmark(); |
26 | 25 |
27 ~PictureBenchmark(); | 26 ~PictureBenchmark(); |
28 | 27 |
29 /** | 28 /** |
30 * Draw the provided SkPicture fRepeats times while collecting timing data,
and log the output | 29 * Draw the provided SkPicture fRepeats times while collecting timing data,
and log the output |
31 * via fWriter. | 30 * via fLogger. |
32 */ | 31 */ |
33 void run(SkPicture* pict); | 32 void run(SkPicture* pict); |
34 | 33 |
35 void setRepeats(int repeats) { | 34 void setRepeats(int repeats) { |
36 fRepeats = repeats; | 35 fRepeats = repeats; |
37 } | 36 } |
38 | 37 |
39 /** | 38 /** |
40 * If true, tells run to log separate timing data for each individual tile.
Each tile will be | 39 * If true, tells run to log separate timing data for each individual tile.
Each tile will be |
41 * drawn fRepeats times. Requires the PictureRenderer set by setRenderer to
be a | 40 * drawn fRepeats times. Requires the PictureRenderer set by setRenderer to
be a |
42 * TiledPictureRenderer. | 41 * TiledPictureRenderer. |
43 */ | 42 */ |
44 void setTimeIndividualTiles(bool indiv) { fTimeIndividualTiles = indiv; } | 43 void setTimeIndividualTiles(bool indiv) { fTimeIndividualTiles = indiv; } |
45 bool timeIndividualTiles() const { return fTimeIndividualTiles; } | 44 bool timeIndividualTiles() const { return fTimeIndividualTiles; } |
46 | 45 |
47 void setPurgeDecodedTex(bool purgeDecodedTex) { fPurgeDecodedTex = purgeDeco
dedTex; } | 46 void setPurgeDecodedTex(bool purgeDecodedTex) { fPurgeDecodedTex = purgeDeco
dedTex; } |
48 bool purgeDecodedText() const { return fPurgeDecodedTex; } | 47 bool purgeDecodedText() const { return fPurgeDecodedTex; } |
49 | 48 |
50 void setPreprocess(bool preprocess) { fPreprocess = preprocess; } | 49 void setPreprocess(bool preprocess) { fPreprocess = preprocess; } |
51 bool preprocess() const { return fPreprocess; } | 50 bool preprocess() const { return fPreprocess; } |
52 | 51 |
53 PictureRenderer* setRenderer(PictureRenderer*); | 52 PictureRenderer* setRenderer(PictureRenderer*); |
54 | 53 |
55 void setTimerResultType(TimerData::Result resultType) { fTimerResult = resul
tType; } | 54 void setTimerResultType(TimerData::Result resultType) { fTimerResult = resul
tType; } |
56 | 55 |
57 void setTimersToShow(bool wall, bool truncatedWall, bool cpu, bool truncated
Cpu, bool gpu); | 56 void setTimersToShow(bool wall, bool truncatedWall, bool cpu, bool truncated
Cpu, bool gpu); |
58 | 57 |
59 void setWriter(PictureResultsWriter* writer) { fWriter = writer; } | 58 void setLogger(SkBenchLogger* logger) { fLogger = logger; } |
60 | 59 |
61 private: | 60 private: |
62 int fRepeats; | 61 int fRepeats; |
| 62 SkBenchLogger* fLogger; |
63 PictureRenderer* fRenderer; | 63 PictureRenderer* fRenderer; |
64 TimerData::Result fTimerResult; | 64 TimerData::Result fTimerResult; |
65 uint32_t fTimerTypes; // bitfield of TimerData::TimerFlags values | 65 uint32_t fTimerTypes; // bitfield of TimerData::TimerFlags values |
66 bool fTimeIndividualTiles; | 66 bool fTimeIndividualTiles; |
67 bool fPurgeDecodedTex; | 67 bool fPurgeDecodedTex; |
68 bool fPreprocess; | 68 bool fPreprocess; |
69 | 69 |
70 PictureResultsWriter* fWriter; | 70 void logProgress(const char msg[]); |
71 | 71 |
72 BenchTimer* setupTimer(bool useGLTimer = true); | 72 BenchTimer* setupTimer(bool useGLTimer = true); |
73 }; | 73 }; |
74 | 74 |
75 } | 75 } |
76 | 76 |
77 #endif // PictureBenchmark_DEFINED | 77 #endif // PictureBenchmark_DEFINED |
OLD | NEW |