OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 * Classes for writing out bench results in various formats. | 7 * Classes for writing out bench results in various formats. |
8 */ | 8 */ |
9 #ifndef SkResultsWriter_DEFINED | 9 #ifndef SkResultsWriter_DEFINED |
10 #define SkResultsWriter_DEFINED | 10 #define SkResultsWriter_DEFINED |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 fLogger.logProgress(SkStringPrintf(fTimeFormat, ms)); | 70 fLogger.logProgress(SkStringPrintf(fTimeFormat, ms)); |
71 } | 71 } |
72 virtual void end() { | 72 virtual void end() { |
73 fLogger.logProgress("\n"); | 73 fLogger.logProgress("\n"); |
74 } | 74 } |
75 private: | 75 private: |
76 SkBenchLogger& fLogger; | 76 SkBenchLogger& fLogger; |
77 const char* fTimeFormat; | 77 const char* fTimeFormat; |
78 }; | 78 }; |
79 | 79 |
| 80 #ifdef SK_BUILD_JSON_WRITER |
80 /** | 81 /** |
81 * This ResultsWriter handles writing out the results in JSON. | 82 * This ResultsWriter handles writing out the results in JSON. |
82 * | 83 * |
83 * The output looks like: | 84 * The output looks like: |
84 * | 85 * |
85 * { | 86 * { |
86 * "options" : { | 87 * "options" : { |
87 * "alpha" : "0xFF", | 88 * "alpha" : "0xFF", |
88 * "scale" : "0", | 89 * "scale" : "0", |
89 * ... | 90 * ... |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 stream.flush(); | 127 stream.flush(); |
127 } | 128 } |
128 private: | 129 private: |
129 SkString fFilename; | 130 SkString fFilename; |
130 Json::Value fRoot; | 131 Json::Value fRoot; |
131 Json::Value& fResults; | 132 Json::Value& fResults; |
132 Json::Value* fBench; | 133 Json::Value* fBench; |
133 Json::Value* fConfig; | 134 Json::Value* fConfig; |
134 }; | 135 }; |
135 | 136 |
| 137 #endif // SK_BUILD_JSON_WRITER |
136 /** | 138 /** |
137 * This ResultsWriter writes out to multiple ResultsWriters. | 139 * This ResultsWriter writes out to multiple ResultsWriters. |
138 */ | 140 */ |
139 class MultiResultsWriter : public ResultsWriter { | 141 class MultiResultsWriter : public ResultsWriter { |
140 public: | 142 public: |
141 MultiResultsWriter() : writers() { | 143 MultiResultsWriter() : writers() { |
142 }; | 144 }; |
143 void add(ResultsWriter* writer) { | 145 void add(ResultsWriter* writer) { |
144 writers.push_back(writer); | 146 writers.push_back(writer); |
145 } | 147 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 */ | 179 */ |
178 template <typename T> class CallEnd : SkNoncopyable { | 180 template <typename T> class CallEnd : SkNoncopyable { |
179 public: | 181 public: |
180 CallEnd(T& obj) : fObj(obj) {} | 182 CallEnd(T& obj) : fObj(obj) {} |
181 ~CallEnd() { fObj.end(); } | 183 ~CallEnd() { fObj.end(); } |
182 private: | 184 private: |
183 T& fObj; | 185 T& fObj; |
184 }; | 186 }; |
185 | 187 |
186 #endif | 188 #endif |
OLD | NEW |