metrics: add per-version cumulative counters

This adds counters that accumulate some measurement across an OS version;
they are reset at version updates, but reported more frequently (for instance,
daily).

Such counts could be obtained by pseudonymous dremel queries, but this is
more convenient.

The code replaces the "tag" datum in the counters with two tags: a
"report tag" and a "reset tag".  When the report
tag changes, the count is reported but not reset.  When the reset tag
changes, the count is both reported and reset.

This also adds one usage of the new counter which tracks the total
number of kernel crashes since the most recent OS version update.

The state machine in counter.cc changes a bit because it's no longer
true that a counter is reset after reporting it.  That logic is
still rather confusing, and could use a rewrite.

BUG=chromium:339588
TEST=ran on target under various situations
BRANCH=none

Change-Id: I5f83731e1a3d6e055b6d0f89111c9ffc60ccfcb9
Reviewed-on: https://chromium-review.googlesource.com/185081
Reviewed-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
diff --git a/metrics/counter_mock.h b/metrics/counter_mock.h
index 267aaca..77272a1 100644
--- a/metrics/counter_mock.h
+++ b/metrics/counter_mock.h
@@ -17,7 +17,7 @@
  public:
   MOCK_METHOD3(Init, void(const char* filename,
                           Reporter reporter, void* reporter_handle));
-  MOCK_METHOD2(Update, void(int tag, int count));
+  MOCK_METHOD3(Update, void(uint32 report_tag, uint32 reset_tag, int32 count));
   MOCK_METHOD0(Flush, void());
 };
 
@@ -28,7 +28,7 @@
                           int min,
                           int max,
                           int nbuckets));
-  MOCK_METHOD2(Update, void(int32 tag, int32 count));
+  MOCK_METHOD3(Update, void(uint32 report_tag, uint32 reset_tag, int32 count));
   MOCK_METHOD0(Flush, void());
 };