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" |
14 | 15 |
15 class BenchTimer; | 16 class BenchTimer; |
16 class SkBenchLogger; | 17 class SkBenchLogger; |
17 class SkPicture; | 18 class SkPicture; |
18 class SkString; | 19 class SkString; |
19 | 20 |
20 namespace sk_tools { | 21 namespace sk_tools { |
21 | 22 |
22 class PictureBenchmark { | 23 class PictureBenchmark { |
23 public: | 24 public: |
24 PictureBenchmark(); | 25 PictureBenchmark(); |
25 | 26 |
26 ~PictureBenchmark(); | 27 ~PictureBenchmark(); |
27 | 28 |
28 /** | 29 /** |
29 * Draw the provided SkPicture fRepeats times while collecting timing data,
and log the output | 30 * Draw the provided SkPicture fRepeats times while collecting timing data,
and log the output |
30 * via fLogger. | 31 * via fWriter. |
31 */ | 32 */ |
32 void run(SkPicture* pict); | 33 void run(SkPicture* pict); |
33 | 34 |
34 void setRepeats(int repeats) { | 35 void setRepeats(int repeats) { |
35 fRepeats = repeats; | 36 fRepeats = repeats; |
36 } | 37 } |
37 | 38 |
38 /** | 39 /** |
39 * If true, tells run to log separate timing data for each individual tile.
Each tile will be | 40 * If true, tells run to log separate timing data for each individual tile.
Each tile will be |
40 * drawn fRepeats times. Requires the PictureRenderer set by setRenderer to
be a | 41 * drawn fRepeats times. Requires the PictureRenderer set by setRenderer to
be a |
41 * TiledPictureRenderer. | 42 * TiledPictureRenderer. |
42 */ | 43 */ |
43 void setTimeIndividualTiles(bool indiv) { fTimeIndividualTiles = indiv; } | 44 void setTimeIndividualTiles(bool indiv) { fTimeIndividualTiles = indiv; } |
44 bool timeIndividualTiles() const { return fTimeIndividualTiles; } | 45 bool timeIndividualTiles() const { return fTimeIndividualTiles; } |
45 | 46 |
46 void setPurgeDecodedTex(bool purgeDecodedTex) { fPurgeDecodedTex = purgeDeco
dedTex; } | 47 void setPurgeDecodedTex(bool purgeDecodedTex) { fPurgeDecodedTex = purgeDeco
dedTex; } |
47 bool purgeDecodedText() const { return fPurgeDecodedTex; } | 48 bool purgeDecodedText() const { return fPurgeDecodedTex; } |
48 | 49 |
49 void setPreprocess(bool preprocess) { fPreprocess = preprocess; } | 50 void setPreprocess(bool preprocess) { fPreprocess = preprocess; } |
50 bool preprocess() const { return fPreprocess; } | 51 bool preprocess() const { return fPreprocess; } |
51 | 52 |
52 PictureRenderer* setRenderer(PictureRenderer*); | 53 PictureRenderer* setRenderer(PictureRenderer*); |
53 | 54 |
54 void setTimerResultType(TimerData::Result resultType) { fTimerResult = resul
tType; } | 55 void setTimerResultType(TimerData::Result resultType) { fTimerResult = resul
tType; } |
55 | 56 |
56 void setTimersToShow(bool wall, bool truncatedWall, bool cpu, bool truncated
Cpu, bool gpu); | 57 void setTimersToShow(bool wall, bool truncatedWall, bool cpu, bool truncated
Cpu, bool gpu); |
57 | 58 |
58 void setLogger(SkBenchLogger* logger) { fLogger = logger; } | 59 void setWriter(PictureResultsWriter* writer) { fWriter = writer; } |
59 | 60 |
60 private: | 61 private: |
61 int fRepeats; | 62 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 void logProgress(const char msg[]); | 70 PictureResultsWriter* fWriter; |
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 |