aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2014-08-20 11:45:00 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-20 11:45:00 -0700
commit1915b62637bea20e1471a8a358b22e9e47a4a385 (patch)
tree029df75c507944e54a0791c9da32016b2cad7cea /tools
parent1a17f7aeb2c735db64c977e2dd7910b00afc23a5 (diff)
Add --properties for things like gitHash that describe the current nanobench run.
--key describes the type of run (describes the line on the chart), --properties describes the run itself (describes the dot on the chart). We'll pass --properties gitHash <git hash> build_number <build number> --key ... to nanobench from the bots. And... delete a whole lot of dead code. Example: nanobench --properties gitHash foo build_number 1234 --key bar baz { "build_number" : "1234", "gitHash" : "foo", "key" : { "bar" : "baz" }, "results" : { .... Friends with https://codereview.chromium.org/491943002 BUG=skia: R=jcgregorio@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/488213002
Diffstat (limited to 'tools')
-rw-r--r--tools/PictureResultsWriter.h38
1 files changed, 33 insertions, 5 deletions
diff --git a/tools/PictureResultsWriter.h b/tools/PictureResultsWriter.h
index f3b2da8409..9ef1666ee1 100644
--- a/tools/PictureResultsWriter.h
+++ b/tools/PictureResultsWriter.h
@@ -174,7 +174,7 @@ private:
class PictureJSONResultsWriter : public PictureResultsWriter {
public:
- PictureJSONResultsWriter(const char filename[],
+ PictureJSONResultsWriter(const char filename[],
const char builderName[],
int buildNumber,
int timestamp,
@@ -186,7 +186,7 @@ public:
fTimestamp = timestamp;
fGitHash = SkString(gitHash);
fGitNumber = gitNumber;
- fBuilderData = SkMakeBuilderJSON(fBuilderName);
+ fBuilderData = this->makeBuilderJson();
}
virtual void bench(const char name[], int32_t x, int32_t y) SK_OVERRIDE {
@@ -234,7 +234,7 @@ public:
vals++) {
times.push_back((*vals).asDouble());
}
- qsort(static_cast<void*>(times.begin()), times.count(),
+ qsort(static_cast<void*>(times.begin()), times.count(),
sizeof(double), PictureJSONResultsWriter::CompareDoubles);
data["value"] = times[static_cast<int>(times.count() * 0.25f)];
data["params"]["measurementType"] = iter.key().asString();
@@ -245,12 +245,40 @@ public:
fStream.flush();
}
private:
+ Json::Value makeBuilderJson() const {
+ static const int kNumKeys = 6;
+ static const char* kKeys[kNumKeys] = {
+ "role", "os", "model", "gpu", "arch", "configuration"};
+ Json::Value builderData;
+
+ if (!fBuilderName.isEmpty()) {
+ SkTArray<SkString> splitBuilder;
+ SkStrSplit(fBuilderName.c_str(), "-", &splitBuilder);
+ SkASSERT(splitBuilder.count() >= kNumKeys);
+ for (int i = 0; i < kNumKeys && i < splitBuilder.count(); ++i) {
+ builderData[kKeys[i]] = splitBuilder[i].c_str();
+ }
+ builderData["builderName"] = fBuilderName.c_str();
+ if (kNumKeys < splitBuilder.count()) {
+ SkString extras;
+ 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;
+ }
+
static int CompareDoubles(const void* p1, const void* p2) {
if(*static_cast<const double*>(p1) < *static_cast<const double*>(p2)) {
return -1;
- } else if(*static_cast<const double*>(p1) ==
+ } else if(*static_cast<const double*>(p1) ==
*static_cast<const double*>(p2)) {
- return 0;
+ return 0;
} else {
return 1;
}