aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/ResultsWriter.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-27 21:51:38 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-27 21:51:38 +0000
commit293a4b367ae5b89384c364737ef76099fd3f0101 (patch)
treec3d734dab256af6de77f7ee2f8b039c77c35ce93 /bench/ResultsWriter.h
parent466f5f3e44e703ca58b43ac1c4ac3bfa0e1ff024 (diff)
Revert of PictureBenchmark JSON logging (https://codereview.chromium.org/286903025/)
Reason for revert: Broke some Windows builds; see http://skbug.com/2609 ('certain Windows Build-* bots failing since r14905'). Before re-landing with a fix, please send to some of the trybots that failed the first time. Original issue's description: > Add JSON logging support to bench_pictures by adding a PictureResultsWriter class (in tools/PictureResultsWriter.h) to process logging information, using a very similar style as bench/ResultsWriter.h > > JSON format described in code, above PictureJSONResultsWriter class > > BUG=skia: > > Committed: http://code.google.com/p/skia/source/detail?r=14906 R=bensong@google.com, jcgregorio@google.com, kelvinly@google.com TBR=bensong@google.com, jcgregorio@google.com, kelvinly@google.com NOTREECHECKS=true NOTRY=true BUG=skia:2609 Author: epoger@google.com Review URL: https://codereview.chromium.org/306483010 git-svn-id: http://skia.googlecode.com/svn/trunk@14910 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench/ResultsWriter.h')
-rw-r--r--bench/ResultsWriter.h26
1 files changed, 21 insertions, 5 deletions
diff --git a/bench/ResultsWriter.h b/bench/ResultsWriter.h
index c66593864f..a9eef802bd 100644
--- a/bench/ResultsWriter.h
+++ b/bench/ResultsWriter.h
@@ -101,9 +101,26 @@ private:
* },
* ...
*/
-
-Json::Value* SkFindNamedNode(Json::Value* root, const char name[]);
class JSONResultsWriter : public ResultsWriter {
+private:
+ Json::Value* find_named_node(Json::Value* root, const char name[]) {
+ Json::Value* search_results = NULL;
+ for(Json::Value::iterator iter = root->begin();
+ iter!= root->end(); ++iter) {
+ if(SkString(name).equals((*iter)["name"].asCString())) {
+ search_results = &(*iter);
+ break;
+ }
+ }
+
+ if(search_results != NULL) {
+ return search_results;
+ } else {
+ Json::Value* new_val = &(root->append(Json::Value()));
+ (*new_val)["name"] = name;
+ return new_val;
+ }
+ }
public:
explicit JSONResultsWriter(const char filename[])
: fFilename(filename)
@@ -121,12 +138,12 @@ public:
sk_name.appendS32(x);
sk_name.append("_");
sk_name.appendS32(y);
- Json::Value* bench_node = SkFindNamedNode(&fResults, sk_name.c_str());
+ Json::Value* bench_node = find_named_node(&fResults, sk_name.c_str());
fBench = &(*bench_node)["results"];
}
virtual void config(const char name[]) {
SkASSERT(NULL != fBench);
- fConfig = SkFindNamedNode(fBench, name);
+ fConfig = find_named_node(fBench, name);
}
virtual void timer(const char name[], double ms) {
SkASSERT(NULL != fConfig);
@@ -147,7 +164,6 @@ private:
};
#endif // SK_BUILD_JSON_WRITER
-
/**
* This ResultsWriter writes out to multiple ResultsWriters.
*/