shill: LinkMonitor: Add more metrics

LinkMonitorSecondsToFailure, LinkMonitorUnicastErrorsAtFailure,
and LinkMonitorBroadcastErrorsAtFailure.

BUG=chromium-os:32600
TEST=Unit tests.

Change-Id: I0a90deee5675ebfb665a76f8e7707eaaecc23ce9
Reviewed-on: https://gerrit.chromium.org/gerrit/29792
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/link_monitor.h b/link_monitor.h
index a3e0a79..60a4057 100644
--- a/link_monitor.h
+++ b/link_monitor.h
@@ -32,6 +32,11 @@
  public:
   typedef base::Closure FailureCallback;
 
+  // When the sum of consecutive unicast and broadcast failures
+  // equals this value, the failure callback is called, the counters
+  // are reset, and the link monitoring quiesces.  Needed by Metrics.
+  static const unsigned int kFailureThreshold;
+
   // The number of milliseconds between ARP requests.  Needed by Metrics.
   static const unsigned int kTestPeriodMilliseconds;
 
@@ -57,11 +62,6 @@
   friend class LinkMonitorForTest;
   friend class LinkMonitorTest;
 
-  // When the sum of consecutive unicast and broadcast failures
-  // equals this value, the failure callback is called, the counters
-  // are reset, and the link monitoring quiesces.
-  static const unsigned int kFailureThreshold;
-
   // The number of samples to compute a "strict" average over.  When
   // more samples than this number arrive, this determines how "slow"
   // our simple low-pass filter works.
@@ -119,6 +119,9 @@
   // void callback function SendRequestTask().
   base::CancelableClosure send_request_callback_;
 
+  // The time at which the link monitor started.
+  struct timeval started_monitoring_at_;
+
   // The time at which the last ARP request was sent.
   struct timeval sent_request_at_;
   Time *time_;