ml_benchmark: Report benchmark_duration to Crosbolt.
Measure and report the duration of an actual driver run
without the test startup overhead.
BUG=b:175278410
TEST=tast run localhost:2222 platform.MLBenchmark.*_no_nnapi
Change-Id: I26dd5b9e6fbea38115c19c299d0b264f35c3e80b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2586426
Tested-by: Michael Pishchagin <mblsha@google.com>
Auto-Submit: Michael Pishchagin <mblsha@google.com>
Reviewed-by: Jim Pollock <jmpollock@chromium.org>
Commit-Queue: Michael Pishchagin <mblsha@google.com>
diff --git a/ml_benchmark/main.cc b/ml_benchmark/main.cc
index c1d64a5..1ca0686 100644
--- a/ml_benchmark/main.cc
+++ b/ml_benchmark/main.cc
@@ -70,6 +70,7 @@
const int64_t initial_memsize = ml_benchmark::GetVMSizeBytes();
const int64_t initial_rss_swap = ml_benchmark::GetSwapAndRSSBytes();
+ const auto start_time = base::Time::Now();
scoped_refptr<PeakMemorySampler> mem_sampler = new PeakMemorySampler();
PeakMemorySampler::StartSampling(mem_sampler);
@@ -96,6 +97,14 @@
AddMemoryMetric("initial_rss_swap", initial_rss_swap, &results);
AddMemoryMetric("peak_rss_swap", peak_rss_swap, &results);
+ auto* benchmark_duration = results.add_metrics();
+ benchmark_duration->set_name("benchmark_duration");
+ benchmark_duration->set_units(Metric::MS);
+ benchmark_duration->set_direction(Metric::SMALLER_IS_BETTER);
+ benchmark_duration->set_cardinality(Metric::SINGLE);
+ benchmark_duration->add_values(
+ (base::Time::Now() - start_time).InMillisecondsF());
+
PrintMetrics(results);
if (output_path) {