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 20:57:44 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-27 20:57:44 +0000
commit3089004cc88e919526e43a8122a74db8f0a7790b (patch)
tree2955a280e1fcc3c2c3ede19f673434c5c45281e9 /bench/ResultsWriter.h
parent44f41293ac94530d08fca2ce8484a7248e7a5e97 (diff)
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: R=bensong@google.com, jcgregorio@google.com Author: kelvinly@google.com Review URL: https://codereview.chromium.org/286903025 git-svn-id: http://skia.googlecode.com/svn/trunk@14906 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench/ResultsWriter.h')
-rw-r--r--bench/ResultsWriter.h26
1 files changed, 5 insertions, 21 deletions
diff --git a/bench/ResultsWriter.h b/bench/ResultsWriter.h
index a9eef802bd..c66593864f 100644
--- a/bench/ResultsWriter.h
+++ b/bench/ResultsWriter.h
@@ -101,26 +101,9 @@ private:
* },
* ...
*/
-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;
- }
- }
+Json::Value* SkFindNamedNode(Json::Value* root, const char name[]);
+class JSONResultsWriter : public ResultsWriter {
public:
explicit JSONResultsWriter(const char filename[])
: fFilename(filename)
@@ -138,12 +121,12 @@ public:
sk_name.appendS32(x);
sk_name.append("_");
sk_name.appendS32(y);
- Json::Value* bench_node = find_named_node(&fResults, sk_name.c_str());
+ Json::Value* bench_node = SkFindNamedNode(&fResults, sk_name.c_str());
fBench = &(*bench_node)["results"];
}
virtual void config(const char name[]) {
SkASSERT(NULL != fBench);
- fConfig = find_named_node(fBench, name);
+ fConfig = SkFindNamedNode(fBench, name);
}
virtual void timer(const char name[], double ms) {
SkASSERT(NULL != fConfig);
@@ -164,6 +147,7 @@ private:
};
#endif // SK_BUILD_JSON_WRITER
+
/**
* This ResultsWriter writes out to multiple ResultsWriters.
*/