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
47 lines
1.7 KiB
C++
47 lines
1.7 KiB
C++
// Copyright 2017 Google Inc. All Rights Reserved.
|
|
//
|
|
// This file contains the declarations for the Metric class and related
|
|
// types.
|
|
#ifndef WVCDM_METRICS_METRIC_PUBLISHER_H_
|
|
#define WVCDM_METRICS_METRIC_PUBLISHER_H_
|
|
|
|
namespace wvcdm {
|
|
namespace metrics {
|
|
|
|
// The MetricNotification is implemented by the code that instantiates
|
|
// MetricPublisher instances. The caller provides this MetricNotification
|
|
// instance to MetricPublisher::Publish. In turn, Publish will make a call to
|
|
// UpdateMetric for each value to be published. The Metric may contain zero or
|
|
// more values to be updated.
|
|
class MetricNotification {
|
|
public:
|
|
virtual ~MetricNotification() {};
|
|
|
|
// The metric_id is the metric name, plus the metric part name, and the
|
|
// metric field name/value string. E.g.
|
|
// name: "drm/cdm/decrypt/duration"
|
|
// part: "mean"
|
|
// field name/value string: "{error_code:0&buffer_size:1024}"
|
|
// becomes: "drm/cdm/decrypt/duration/mean/{error_code:0&buffer_size:1024}".
|
|
virtual void UpdateString(const std::string& metric_id,
|
|
const std::string& value) = 0;
|
|
virtual void UpdateInt32(const std::string& metric_id, int32_t value) = 0;
|
|
virtual void UpdateInt64(const std::string& metric_id, int64_t value) = 0;
|
|
virtual void UpdateDouble(const std::string& metric_id, double value) = 0;
|
|
};
|
|
|
|
// This abstract class merely provides the definition for publishing the value
|
|
// of the metric.
|
|
class MetricPublisher {
|
|
public:
|
|
virtual ~MetricPublisher() { }
|
|
// Publish metric values to the MetricNotification. |subscriber| must
|
|
// not be null and is owned by the caller.
|
|
virtual void Publish(MetricNotification* subscriber) = 0;
|
|
};
|
|
|
|
} // namespace metrics
|
|
} // namespace wvcdm
|
|
|
|
#endif // WVCDM_METRICS_METRIC_PUBLISHER_H_
|