Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: bench/ResultsWriter.cpp

Issue 329993008: Make SKP bench JSON ouput better (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix stuff Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 * Helper functions for result writing operations. 7 * Helper functions for result writing operations.
8 */ 8 */
9 9
10 #include "ResultsWriter.h" 10 #include "ResultsWriter.h"
11 #include "SkString.h"
12 #include "SkTArray.h"
11 13
12 Json::Value* SkFindNamedNode(Json::Value* root, const char name[]) { 14 Json::Value* SkFindNamedNode(Json::Value* root, const char name[]) {
13 Json::Value* search_results = NULL; 15 Json::Value* search_results = NULL;
14 for(Json::Value::iterator iter = root->begin(); 16 for(Json::Value::iterator iter = root->begin();
15 iter!= root->end(); ++iter) { 17 iter!= root->end(); ++iter) {
16 if(SkString(name).equals((*iter)["name"].asCString())) { 18 if(SkString(name).equals((*iter)["name"].asCString())) {
17 search_results = &(*iter); 19 search_results = &(*iter);
18 break; 20 break;
19 } 21 }
20 } 22 }
21 23
22 if(search_results != NULL) { 24 if(search_results != NULL) {
23 return search_results; 25 return search_results;
24 } else { 26 } else {
25 Json::Value* new_val = &(root->append(Json::Value())); 27 Json::Value* new_val = &(root->append(Json::Value()));
26 (*new_val)["name"] = name; 28 (*new_val)["name"] = name;
27 return new_val; 29 return new_val;
28 } 30 }
29 } 31 }
30 32
robertphillips 2014/06/26 16:17:32 SkString buildername -> const SkString& builderNam
kelvinly 2014/06/26 17:18:09 Done.
33 Json::Value makeBuilderJSON(SkString buildername) {
34 static const int kNumKeys = 6;
robertphillips 2014/06/26 16:17:32 6 -> kNumKeys here ?
kelvinly 2014/06/26 17:18:09 Done.
35 static const char* kKeys[6] = {
36 "role", "os", "model", "gpu", "arch", "configuration"};
37 Json::Value builderData;
38
robertphillips 2014/06/26 16:17:32 if (!builderName.isEmpty()) { ?
kelvinly 2014/06/26 17:18:09 Done.
39 if (buildername.size() > 0) {
40 SkTArray<SkString> splitBuilder;
41 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.
42 for (int i = 0; i < kNumKeys && i < splitBuilder.count(); i++) {
43 builderData[kKeys[i]] = splitBuilder[i].c_str();
44 }
45 builderData["builderName"] = buildername.c_str();
46 if (kNumKeys < splitBuilder.count()) {
47 SkString extras;
robertphillips 2014/06/26 16:17:32 ++i ?
kelvinly 2014/06/26 17:18:09 Done.
48 for (int i = kNumKeys; i < splitBuilder.count(); i++) {
49 extras.append(splitBuilder[i]);
50 if (i != splitBuilder.count() - 1) {
51 extras.append("-");
52 }
53 }
54 builderData["badParams"] = extras.c_str();
55 }
56 }
57 return builderData;
58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698