Widevine Metrics System

This change is the complete Widevine metrics system. It will
measure and record runtime information about what is happening
in the CDM - such as errors and throughput.

Bug: 33745339
Bug: 26027857
Change-Id: Ic9a82074f1e2b72c72d751b235f8ae361232787d
This commit is contained in:
Aaron Vaage
2017-01-17 18:31:25 -08:00
parent ee5aff7706
commit edb9f00df7
39 changed files with 2969 additions and 258 deletions

View File

@@ -0,0 +1,60 @@
// Copyright 2017 Google Inc. All Rights Reserved.
//
// This file contains implementations for the BaseEventMetric.
#include "event_metric.h"
namespace wvcdm {
namespace metrics {
BaseEventMetric::~BaseEventMetric() {
AutoLock lock(internal_lock_);
for (std::map<std::string, Distribution*>::iterator it
= value_map_.begin(); it != value_map_.end(); it++) {
delete it->second;
}
}
void BaseEventMetric::Record(const std::string& field_names_values,
double value) {
AutoLock lock(internal_lock_);
Distribution* distribution;
if (value_map_.find(field_names_values) == value_map_.end()) {
distribution = new Distribution();
value_map_[field_names_values] = distribution;
} else {
distribution = value_map_[field_names_values];
}
distribution->Record(value);
}
void BaseEventMetric::Publish(MetricNotification* notification) {
AutoLock lock(internal_lock_);
for (std::map<std::string, Distribution*>::iterator it
= value_map_.begin(); it != value_map_.end(); it++) {
notification->UpdateInt64(
metric_name_ + "/count" + it->first,
it->second->Count());
notification->UpdateDouble(
metric_name_ + "/mean" + it->first,
it->second->Mean());
notification->UpdateDouble(
metric_name_ + "/variance" + it->first,
it->second->Variance());
notification->UpdateDouble(
metric_name_ + "/min" + it->first,
it->second->Min());
notification->UpdateDouble(
metric_name_ + "/max" + it->first,
it->second->Max());
}
}
} // namespace metrics
} // namespace wvcdm