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,

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 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.

TEST=ran on target under various situations

Change-Id: I5f83731e1a3d6e055b6d0f89111c9ffc60ccfcb9
Reviewed-by: Daniel Erat <>
Commit-Queue: Luigi Semenzato <>
Tested-by: Luigi Semenzato <>
8 files changed
tree: c8ee8b06aafcbdc9a732536d84d9bf3fc1a5287b
  1. metrics/