Do less work when skipping timing reports

For some tests, the overhead of building up the table during startup is
a significant part of the runtime of the test. This speeds up one test
by 57% for example.

Change-Id: I370237510f8fcfe1c8a18395293f25fe44932f9e
Signed-off-by: Brian Silverman <brian.silverman@bluerivertech.com>
diff --git a/aos/events/timing_statistics.h b/aos/events/timing_statistics.h
index ad0534a..4d9a524 100644
--- a/aos/events/timing_statistics.h
+++ b/aos/events/timing_statistics.h
@@ -18,6 +18,10 @@
 
   // Adds a sample to the statistic.
   void Add(float sample) {
+    if (!statistic_) {
+      return;
+    }
+
     ++count_;
     if (count_ == 1) {
       statistic_->mutate_average(sample);
@@ -39,6 +43,10 @@
 
   // Clears any accumulated statistics.
   void Reset() {
+    if (!statistic_) {
+      return;
+    }
+
     statistic_->mutate_average(std::numeric_limits<float>::quiet_NaN());
     statistic_->mutate_min(std::numeric_limits<float>::quiet_NaN());
     statistic_->mutate_max(std::numeric_limits<float>::quiet_NaN());