aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/ResultsWriter.h
diff options
context:
space:
mode:
authorGravatar George Burgess IV <gbiv@google.com>2016-12-06 10:53:52 -0800
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-06 21:48:42 +0000
commit75b5718d2054b2545a42303a47f5aaf200787c71 (patch)
treeb951f1dd85d5489f025d43d3b79b26fdc0f473ef /bench/ResultsWriter.h
parentc57c7c948a851fe792a504207fcf530da573cc59 (diff)
nanobench: Add per-run time reporting.
This patch adds per-benchmark-iteration times to our JSON output. Given that we already collect these statistics, giving them to the user would be nice. No unit-test provided, since `rgrep -i json tests` yielded nothing. Happy to add one if someone wants. BUG=None. TEST=nanobench now writes per-run timinings with the output JSON. Change-Id: I910f1d97fd3e0ee69fc8e78e011e67b9c866f18d Reviewed-on: https://skia-review.googlesource.com/5617 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Ravi Mistry <rmistry@google.com>
Diffstat (limited to 'bench/ResultsWriter.h')
-rw-r--r--bench/ResultsWriter.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/bench/ResultsWriter.h b/bench/ResultsWriter.h
index dc50ace560..1d6dc3eef1 100644
--- a/bench/ResultsWriter.h
+++ b/bench/ResultsWriter.h
@@ -47,6 +47,9 @@ public:
// Record a single test metric.
virtual void metric(const char name[], double ms) {}
+ // Record a list of test metrics.
+ virtual void metrics(const char name[], const SkTArray<double>& array) {}
+
// Flush to storage now please.
virtual void flush() {}
};
@@ -114,6 +117,16 @@ public:
SkASSERT(fConfig);
(*fConfig)[name] = ms;
}
+ void metrics(const char name[], const SkTArray<double>& array) override {
+ SkASSERT(fConfig);
+ Json::Value value = Json::Value(Json::arrayValue);
+ value.resize(array.count());
+ for (int i = 0; i < array.count(); i++) {
+ // Don't care about nan-ness.
+ value[i] = array[i];
+ }
+ (*fConfig)[name] = std::move(value);
+ }
// Flush to storage now please.
void flush() override {