| 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 | |
| 81 /** | 80 /** |
| 82 * This ResultsWriter handles writing out the results in JSON. | 81 * This ResultsWriter handles writing out the results in JSON. |
| 83 * | 82 * |
| 84 * The output looks like (except compressed to a single line): | 83 * The output looks like (except compressed to a single line): |
| 85 * | 84 * |
| 86 * { | 85 * { |
| 87 * "options" : { | 86 * "options" : { |
| 88 * "alpha" : "0xFF", | 87 * "alpha" : "0xFF", |
| 89 * "scale" : "0", | 88 * "scale" : "0", |
| 90 * ... | 89 * ... |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 } | 138 } |
| 140 private: | 139 private: |
| 141 | 140 |
| 142 SkString fFilename; | 141 SkString fFilename; |
| 143 Json::Value fRoot; | 142 Json::Value fRoot; |
| 144 Json::Value& fResults; | 143 Json::Value& fResults; |
| 145 Json::Value* fBench; | 144 Json::Value* fBench; |
| 146 Json::Value* fConfig; | 145 Json::Value* fConfig; |
| 147 }; | 146 }; |
| 148 | 147 |
| 149 #endif // SK_BUILD_JSON_WRITER | |
| 150 | |
| 151 /** | 148 /** |
| 152 * This ResultsWriter writes out to multiple ResultsWriters. | 149 * This ResultsWriter writes out to multiple ResultsWriters. |
| 153 */ | 150 */ |
| 154 class MultiResultsWriter : public ResultsWriter { | 151 class MultiResultsWriter : public ResultsWriter { |
| 155 public: | 152 public: |
| 156 MultiResultsWriter() : writers() { | 153 MultiResultsWriter() : writers() { |
| 157 }; | 154 }; |
| 158 void add(ResultsWriter* writer) { | 155 void add(ResultsWriter* writer) { |
| 159 writers.push_back(writer); | 156 writers.push_back(writer); |
| 160 } | 157 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 */ | 189 */ |
| 193 template <typename T> class CallEnd : SkNoncopyable { | 190 template <typename T> class CallEnd : SkNoncopyable { |
| 194 public: | 191 public: |
| 195 CallEnd(T& obj) : fObj(obj) {} | 192 CallEnd(T& obj) : fObj(obj) {} |
| 196 ~CallEnd() { fObj.end(); } | 193 ~CallEnd() { fObj.end(); } |
| 197 private: | 194 private: |
| 198 T& fObj; | 195 T& fObj; |
| 199 }; | 196 }; |
| 200 | 197 |
| 201 #endif | 198 #endif |
| OLD | NEW |