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 | 9 |
10 #ifndef SkResultsWriter_DEFINED | 10 #ifndef SkResultsWriter_DEFINED |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // Inserted directly into the root. | 91 // Inserted directly into the root. |
92 virtual void property(const char name[], const char value[]) { | 92 virtual void property(const char name[], const char value[]) { |
93 fRoot[name] = value; | 93 fRoot[name] = value; |
94 } | 94 } |
95 virtual void bench(const char name[], int32_t x, int32_t y) { | 95 virtual void bench(const char name[], int32_t x, int32_t y) { |
96 SkString id = SkStringPrintf( "%s_%d_%d", name, x, y); | 96 SkString id = SkStringPrintf( "%s_%d_%d", name, x, y); |
97 fResults[id.c_str()] = Json::Value(Json::objectValue); | 97 fResults[id.c_str()] = Json::Value(Json::objectValue); |
98 fBench = &fResults[id.c_str()]; | 98 fBench = &fResults[id.c_str()]; |
99 } | 99 } |
100 virtual void config(const char name[]) { | 100 virtual void config(const char name[]) { |
101 SkASSERT(NULL != fBench); | 101 SkASSERT(fBench); |
102 fConfig = &(*fBench)[name]; | 102 fConfig = &(*fBench)[name]; |
103 } | 103 } |
104 virtual void configOption(const char name[], const char* value) { | 104 virtual void configOption(const char name[], const char* value) { |
105 (*fConfig)["options"][name] = value; | 105 (*fConfig)["options"][name] = value; |
106 } | 106 } |
107 virtual void timer(const char name[], double ms) { | 107 virtual void timer(const char name[], double ms) { |
108 // Don't record if nan, or -nan. | 108 // Don't record if nan, or -nan. |
109 if (sk_double_isnan(ms)) { | 109 if (sk_double_isnan(ms)) { |
110 return; | 110 return; |
111 } | 111 } |
112 SkASSERT(NULL != fConfig); | 112 SkASSERT(fConfig); |
113 (*fConfig)[name] = ms; | 113 (*fConfig)[name] = ms; |
114 } | 114 } |
115 | 115 |
116 private: | 116 private: |
117 SkString fFilename; | 117 SkString fFilename; |
118 Json::Value fRoot; | 118 Json::Value fRoot; |
119 Json::Value& fResults; | 119 Json::Value& fResults; |
120 Json::Value* fBench; | 120 Json::Value* fBench; |
121 Json::Value* fConfig; | 121 Json::Value* fConfig; |
122 }; | 122 }; |
123 | 123 |
124 | 124 |
125 #endif | 125 #endif |
OLD | NEW |