From 75b5718d2054b2545a42303a47f5aaf200787c71 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Tue, 6 Dec 2016 10:53:52 -0800 Subject: 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 Commit-Queue: Ravi Mistry --- bench/ResultsWriter.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'bench/ResultsWriter.h') 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& 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& 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 { -- cgit v1.2.3