Index: bench/ResultsWriter.cpp |
diff --git a/bench/ResultsWriter.cpp b/bench/ResultsWriter.cpp |
index 08f11c190fbff926fd27f334dde10370b4cff665..0ba61cd28f9f810a675cc48e3eb1ff836c653986 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[]) { |
} |
} |
robertphillips
2014/06/26 16:17:32
SkString buildername -> const SkString& builderNam
kelvinly
2014/06/26 17:18:09
Done.
|
+Json::Value makeBuilderJSON(SkString buildername) { |
+ static const int kNumKeys = 6; |
robertphillips
2014/06/26 16:17:32
6 -> kNumKeys here ?
kelvinly
2014/06/26 17:18:09
Done.
|
+ static const char* kKeys[6] = { |
+ "role", "os", "model", "gpu", "arch", "configuration"}; |
+ Json::Value builderData; |
+ |
robertphillips
2014/06/26 16:17:32
if (!builderName.isEmpty()) { ?
kelvinly
2014/06/26 17:18:09
Done.
|
+ if (buildername.size() > 0) { |
+ SkTArray<SkString> splitBuilder; |
+ SkStrSplit(buildername.c_str(), "-", &splitBuilder); |
robertphillips
2014/06/26 16:17:32
SkASSERT(splitBuilder.count() >= kNumKeys); ?
++i
kelvinly
2014/06/26 17:18:09
Done.
|
+ for (int i = 0; i < kNumKeys && i < splitBuilder.count(); i++) { |
+ builderData[kKeys[i]] = splitBuilder[i].c_str(); |
+ } |
+ builderData["builderName"] = buildername.c_str(); |
+ if (kNumKeys < splitBuilder.count()) { |
+ SkString extras; |
robertphillips
2014/06/26 16:17:32
++i ?
kelvinly
2014/06/26 17:18:09
Done.
|
+ for (int i = kNumKeys; i < splitBuilder.count(); i++) { |
+ extras.append(splitBuilder[i]); |
+ if (i != splitBuilder.count() - 1) { |
+ extras.append("-"); |
+ } |
+ } |
+ builderData["badParams"] = extras.c_str(); |
+ } |
+ } |
+ return builderData; |
+} |