Index: bench/ResultsWriter.cpp |
diff --git a/bench/ResultsWriter.cpp b/bench/ResultsWriter.cpp |
index 08f11c190fbff926fd27f334dde10370b4cff665..251d099e855bedcc29b916f33b105249d78aef31 100644 |
--- a/bench/ResultsWriter.cpp |
+++ b/bench/ResultsWriter.cpp |
@@ -8,6 +8,8 @@ |
*/ |
#include "ResultsWriter.h" |
+#include "SkString.h" |
+#include "SkTArray.h" |
Json::Value* SkFindNamedNode(Json::Value* root, const char name[]) { |
Json::Value* search_results = NULL; |
@@ -28,3 +30,29 @@ Json::Value* SkFindNamedNode(Json::Value* root, const char name[]) { |
} |
} |
+Json::Value makeBuilderJSON(SkString buildername) { |
robertphillips
2014/06/24 20:49:51
kNumKeys ?
kKeys ?
This should probably be:
static
kelvinly
2014/06/24 22:25:19
Done.
|
+ static const int numKeys = 6; |
+ static const char keys[6][32] = { |
+ "role", "os", "model", "gpu", "arch", "configuration"}; |
+ Json::Value builderData; |
+ |
robertphillips
2014/06/24 20:49:51
space after if ?
kelvinly
2014/06/24 22:25:19
Done.
|
+ if(buildername.size() > 0) { |
+ SkTArray<SkString> splitBuilder; |
+ SkStrSplit(buildername.c_str(), "-", &splitBuilder); |
+ for(int i = 0; i < numKeys && i < splitBuilder.count(); i++) { |
+ builderData[keys[i]] = splitBuilder[i].c_str(); |
+ } |
+ builderData["builderName"] = buildername.c_str(); |
robertphillips
2014/06/24 20:49:51
space after if ?
kelvinly
2014/06/24 22:25:19
Done.
|
+ if(numKeys < splitBuilder.count()) { |
+ SkString extras; |
robertphillips
2014/06/24 20:49:51
space after for ?
kelvinly
2014/06/24 22:25:19
Done.
|
+ for(int i = numKeys; i < splitBuilder.count(); i++) { |
+ extras.append(splitBuilder[i]); |
+ if(i != splitBuilder.count() - 1) { |
+ extras.append("-"); |
+ } |
+ } |
+ builderData["badParams"] = extras.c_str(); |
+ } |
+ } |
+ return builderData; |
+} |