CDM Metrics Protocol buffer serialization.

An implementation that serializes metrics to a protocol buffer.

This is a merge from wvgerrit/28440.

I intend to submit 2048751, 2048750, and 2048509 together.

Bug: 36217927
Bug: 36220975
Test: Added unit tests to cover modified code.
Change-Id: Ie8b9d8b91d2602b015f5568890a16c0419c126df
This commit is contained in:
Adam Stone
2017-03-30 10:26:58 -07:00
parent a34e279d0f
commit b851dd8cfd
7 changed files with 706 additions and 19 deletions

View File

@@ -43,15 +43,18 @@ void BaseEventMetric::Serialize(MetricSerializer* serializer) {
serializer->SetDouble(
metric_name_ + "/mean" + it->first,
it->second->Mean());
serializer->SetDouble(
metric_name_ + "/variance" + it->first,
it->second->Variance());
serializer->SetDouble(
metric_name_ + "/min" + it->first,
it->second->Min());
serializer->SetDouble(
metric_name_ + "/max" + it->first,
it->second->Max());
// Only publish additional information if there was more than one sample.
if (it->second->Count() > 1) {
serializer->SetDouble(
metric_name_ + "/variance" + it->first,
it->second->Variance());
serializer->SetDouble(
metric_name_ + "/min" + it->first,
it->second->Min());
serializer->SetDouble(
metric_name_ + "/max" + it->first,
it->second->Max());
}
}
}