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 |
11 | 11 |
12 #include "SkBenchLogger.h" | 12 #include "SkBenchLogger.h" |
13 #include "SkJSONCPP.h" | 13 #include "SkJSONCPP.h" |
hal.canary
2014/05/15 14:29:36
For example:
#ifdef SK_BUILD_JSON_WRITER
#inc
scroggo
2014/05/15 20:00:54
Good thought. In the spirit of simplifying things
| |
14 #include "SkStream.h" | 14 #include "SkStream.h" |
15 #include "SkString.h" | 15 #include "SkString.h" |
16 #include "SkTArray.h" | 16 #include "SkTArray.h" |
17 #include "SkTypes.h" | 17 #include "SkTypes.h" |
18 | 18 |
19 | 19 |
20 /** | 20 /** |
21 * Base class for writing out the bench results. | 21 * Base class for writing out the bench results. |
22 * | 22 * |
23 * TODO(jcgregorio) Add info if tests fail to converge? | 23 * TODO(jcgregorio) Add info if tests fail to converge? |
(...skipping 46 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 // FIXME (scroggo): JSON is disabled in Android framework until we solve | |
81 // skbug.com/2448 | |
82 #ifndef SK_BUILD_FOR_ANDROID | |
hal.canary
2014/05/15 14:29:36
#ifdef SK_BUILD_JSON_WRITER
scroggo
2014/05/15 20:00:54
Done.
| |
80 /** | 83 /** |
81 * This ResultsWriter handles writing out the results in JSON. | 84 * This ResultsWriter handles writing out the results in JSON. |
82 * | 85 * |
83 * The output looks like: | 86 * The output looks like: |
84 * | 87 * |
85 * { | 88 * { |
86 * "options" : { | 89 * "options" : { |
87 * "alpha" : "0xFF", | 90 * "alpha" : "0xFF", |
88 * "scale" : "0", | 91 * "scale" : "0", |
89 * ... | 92 * ... |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 stream.flush(); | 129 stream.flush(); |
127 } | 130 } |
128 private: | 131 private: |
129 SkString fFilename; | 132 SkString fFilename; |
130 Json::Value fRoot; | 133 Json::Value fRoot; |
131 Json::Value& fResults; | 134 Json::Value& fResults; |
132 Json::Value* fBench; | 135 Json::Value* fBench; |
133 Json::Value* fConfig; | 136 Json::Value* fConfig; |
134 }; | 137 }; |
135 | 138 |
139 #endif // SK_BUILD_FOR_ANDROID_FRAMEWORK | |
136 /** | 140 /** |
137 * This ResultsWriter writes out to multiple ResultsWriters. | 141 * This ResultsWriter writes out to multiple ResultsWriters. |
138 */ | 142 */ |
139 class MultiResultsWriter : public ResultsWriter { | 143 class MultiResultsWriter : public ResultsWriter { |
140 public: | 144 public: |
141 MultiResultsWriter() : writers() { | 145 MultiResultsWriter() : writers() { |
142 }; | 146 }; |
143 void add(ResultsWriter* writer) { | 147 void add(ResultsWriter* writer) { |
144 writers.push_back(writer); | 148 writers.push_back(writer); |
145 } | 149 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 */ | 181 */ |
178 template <typename T> class CallEnd : SkNoncopyable { | 182 template <typename T> class CallEnd : SkNoncopyable { |
179 public: | 183 public: |
180 CallEnd(T& obj) : fObj(obj) {} | 184 CallEnd(T& obj) : fObj(obj) {} |
181 ~CallEnd() { fObj.end(); } | 185 ~CallEnd() { fObj.end(); } |
182 private: | 186 private: |
183 T& fObj; | 187 T& fObj; |
184 }; | 188 }; |
185 | 189 |
186 #endif | 190 #endif |
OLD | NEW |