test: Show the average time per test
Show the average duration of a test, so we can keep track of how it is
trending. Report the suite with the longest average test to encourage
people to improve it.
Add a function to update the stats based on the results from a single
suite and another to show the summary information.
Make this optional, since sandbox's SPL tests do not have a timer driver
and people may want to print results without times.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/include/test/test.h b/include/test/test.h
index 25c7712..877fda8 100644
--- a/include/test/test.h
+++ b/include/test/test.h
@@ -33,6 +33,8 @@
* @cur: Statistics for the current run
* @total: Statistics for all test runs
* @run_count: Number of times ut_run_list() has been called
+ * @worst: Sute which had the first per-text run time
+ * @worst_ms: Time taken by that test
* @start: Store the starting mallinfo when doing leak test
* @of_live: true to use livetree if available, false to use flattree
* @of_root: Record of the livetree root node (used for setting up tests)
@@ -56,6 +58,8 @@
struct ut_stats cur;
struct ut_stats total;
int run_count;
+ const struct suite *worst;
+ int worst_ms;
struct mallinfo start;
struct device_node *of_root;
bool of_live;