diff options
-rw-r--r-- | bench/ResultsWriter.h | 13 | ||||
-rw-r--r-- | bench/nanobench.cpp | 1 |
2 files changed, 14 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 { diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index 5abecd64ee..9e641b909c 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -1288,6 +1288,7 @@ int nanobench_main() { benchStream.fillCurrentOptions(log.get()); target->fillOptions(log.get()); log->metric("min_ms", stats.min); + log->metrics("samples", samples); #if SK_SUPPORT_GPU if (gpuStatsDump) { // dump to json, only SKPBench currently returns valid keys / values |