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:
53
libwvdrmengine/cdm/metrics/include/distribution.h
Normal file
53
libwvdrmengine/cdm/metrics/include/distribution.h
Normal file
@@ -0,0 +1,53 @@
|
||||
// Copyright 2017 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// This file contains the definition of a Distribution class which computes
|
||||
// the distribution values of a series of samples.
|
||||
|
||||
#ifndef WVCDM_METRICS_DISTRIBUTION_H_
|
||||
#define WVCDM_METRICS_DISTRIBUTION_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace wvcdm {
|
||||
namespace metrics {
|
||||
|
||||
// The Distribution class holds statistics about a series of values that the
|
||||
// client provides via the Record method. A caller will call Record once for
|
||||
// each of the values in a series. The Distribution instance will calculate the
|
||||
// mean, count, min, max and variance of the distribution.
|
||||
//
|
||||
// Example usage:
|
||||
// Distribution dist;
|
||||
// dist.Record(1);
|
||||
// dist.Record(2);
|
||||
// dist.Mean(); // Returns 1.5.
|
||||
// dist.Count(); // Returns 2.
|
||||
class Distribution {
|
||||
public:
|
||||
Distribution();
|
||||
|
||||
// Uses the provided sample value to update the computed statistics.
|
||||
void Record(double value);
|
||||
|
||||
// Return the value for each of the stats computed about the series of
|
||||
// values (min, max, count, etc.).
|
||||
const double Min() { return min_; }
|
||||
const double Max() { return max_; }
|
||||
const double Mean() { return mean_; }
|
||||
const int64_t Count() { return count_; }
|
||||
const double Variance() {
|
||||
return count_ == 0 ? 0.0 : sum_squared_deviation_ / count_;
|
||||
}
|
||||
|
||||
private:
|
||||
int64_t count_;
|
||||
double min_;
|
||||
double max_;
|
||||
double mean_;
|
||||
double sum_squared_deviation_;
|
||||
};
|
||||
|
||||
} // namespace metrics
|
||||
} // namespace wvcdm
|
||||
|
||||
#endif // WVCDM_METRICS_DISTRIBUTION_H_
|
||||
298
libwvdrmengine/cdm/metrics/include/event_metric.h
Normal file
298
libwvdrmengine/cdm/metrics/include/event_metric.h
Normal file
@@ -0,0 +1,298 @@
|
||||
// Copyright 2017 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// This file contains the declarations for the EventMetric class and related
|
||||
// types.
|
||||
#ifndef WVCDM_METRICS_EVENT_METRIC_H_
|
||||
#define WVCDM_METRICS_EVENT_METRIC_H_
|
||||
|
||||
#include <cstdarg>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "lock.h"
|
||||
|
||||
#include "distribution.h"
|
||||
#include "metric_publisher.h"
|
||||
|
||||
namespace wvcdm {
|
||||
namespace metrics {
|
||||
|
||||
class EventMetricTest;
|
||||
|
||||
// This base class provides the common defintion used by all templated
|
||||
// instances of EventMetric.
|
||||
class BaseEventMetric : public MetricPublisher {
|
||||
public:
|
||||
// Publish metric values to the MetricNotification. |subscriber| must
|
||||
// not be null and is owned by the caller.
|
||||
virtual void Publish(MetricNotification* subscriber);
|
||||
|
||||
protected:
|
||||
// Instantiates a BaseEventMetric.
|
||||
BaseEventMetric(const std::string& metric_name)
|
||||
: metric_name_(metric_name) {}
|
||||
|
||||
virtual ~BaseEventMetric();
|
||||
|
||||
// Record will look for an existing instance of the Distribution identified
|
||||
// by the field_names_values string and update it. If the instance does
|
||||
// not exist, this will create it.
|
||||
void Record(const std::string& field_names_values, double value);
|
||||
|
||||
private:
|
||||
friend class EventMetricTest;
|
||||
const std::string metric_name_;
|
||||
// value_map_ contains a mapping from the field name/value pairs to the
|
||||
// distribution instance which holds the metric information (min, max, sum,
|
||||
// etc.).
|
||||
std::map<std::string, Distribution*> value_map_;
|
||||
|
||||
/*
|
||||
* This locks the internal state of the event metric to ensure safety across
|
||||
* multiple threads preventing the caller from worrying about locking.
|
||||
*/
|
||||
Lock internal_lock_;
|
||||
};
|
||||
|
||||
// This is a placeholder type for unused type parameters.
|
||||
struct Unused {
|
||||
// Required for compilation. Should never be used.
|
||||
inline friend std::ostream& operator<< (std::ostream& out, const Unused&)
|
||||
{ return out; }
|
||||
};
|
||||
|
||||
|
||||
// This class converts the size_t value into the highest power of two
|
||||
// below the value. E.g. for 7, the value is 4. For 11, the value is 8.
|
||||
// This class is intended to simplify the use of EventMetric Fields that may
|
||||
// have many possible values, but we want to bucket them into a small set of
|
||||
// numbers (32 or 64).
|
||||
class Pow2Bucket {
|
||||
public:
|
||||
explicit Pow2Bucket(size_t value) : value_(GetLowerBucket(value)) {}
|
||||
|
||||
Pow2Bucket(const Pow2Bucket& value) : value_(value.value_) {}
|
||||
|
||||
// Support for converting to string.
|
||||
friend std::ostream& operator<<(std::ostream& os, const Pow2Bucket& log)
|
||||
{ return os << log.value_; }
|
||||
|
||||
private:
|
||||
inline size_t GetLowerBucket(size_t value) {
|
||||
if (!value) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t log = 0;
|
||||
while (value) {
|
||||
log++;
|
||||
value >>= 1;
|
||||
}
|
||||
|
||||
return 1 << (log - 1);
|
||||
}
|
||||
|
||||
size_t value_;
|
||||
};
|
||||
|
||||
// The EventMetric class is used to capture statistics about an event such as
|
||||
// a method call. EventMetric keeps track of the count, mean, min, max and
|
||||
// variance for the value being measured. For example, we may want to track the
|
||||
// latency of a particular operation. Each time the operation is run, the time
|
||||
// is calculated and provided to the EventMetric by using the
|
||||
// EventMetric::Record method to capture and maintain statistics about the
|
||||
// latency (max, min, count, mean, variance).
|
||||
//
|
||||
// The EventMetric class supports the ability to breakdown the statistics based
|
||||
// on certain "field" values. For example, if a particular operation can run in
|
||||
// one of two modes, it's useful to track the latency of the operation in each
|
||||
// mode separately. You can use Fields to define how to breakdown the
|
||||
// statistics. Each Field is a separate dimention. The statistics for each
|
||||
// combination of field values are tracked independently.
|
||||
//
|
||||
// Example usage:
|
||||
//
|
||||
// EventMetric<int, int> my_metric("multiple/fields/metric",
|
||||
// "request_type", "error_code", // Field names);
|
||||
//
|
||||
// my_metric.Record(1, 7, 23); // (latency value, request type, error code).
|
||||
//
|
||||
// A MetricNotification may be used to allow the EventMetric instance to
|
||||
// notify that an update occurred and provide the updated value.
|
||||
//
|
||||
// class MyMetricNotification : public MetricNotification {
|
||||
// // Add implementation here.
|
||||
// }
|
||||
//
|
||||
// MyMetricNotification notification;
|
||||
// my_metric.Publish(notification);
|
||||
template<typename F1=Unused,
|
||||
typename F2=Unused,
|
||||
typename F3=Unused,
|
||||
typename F4=Unused>
|
||||
class EventMetric : public BaseEventMetric {
|
||||
public:
|
||||
// Create an EventMetric instance with the name |metric_name|.
|
||||
EventMetric(const std::string& metric_name);
|
||||
|
||||
// Overloaded constructors with variable field name arguments. The number
|
||||
// of |field_name| arguments must match the number of used Field type
|
||||
// arguments.
|
||||
EventMetric(const std::string& metric_name,
|
||||
const char* field_name);
|
||||
EventMetric(const std::string& metric_name,
|
||||
const char* field_name1,
|
||||
const char* field_name2);
|
||||
EventMetric(const std::string& metric_name,
|
||||
const char* field_name1,
|
||||
const char* field_name2,
|
||||
const char* field_name3);
|
||||
EventMetric(const std::string& metric_name,
|
||||
const char* field_name1,
|
||||
const char* field_name2,
|
||||
const char* field_name3,
|
||||
const char* field_name4);
|
||||
|
||||
// Record will update the statistics of the EventMetric broken down by the
|
||||
// given field values.
|
||||
void Record(double value,
|
||||
F1 field1 = Unused(),
|
||||
F2 field2 = Unused(),
|
||||
F3 field3 = Unused(),
|
||||
F4 field4 = Unused());
|
||||
|
||||
private:
|
||||
friend class EventMetricTest;
|
||||
std::vector<std::string> field_names_;
|
||||
};
|
||||
|
||||
// This is an internal namespace for helper functions only.
|
||||
namespace impl {
|
||||
|
||||
// This method formats the collection of field name/value pairs.
|
||||
// The format of the string is:
|
||||
//
|
||||
// [{field:value[&field:value]*}]
|
||||
//
|
||||
// If there are no pairs, returns a blank string.
|
||||
//
|
||||
// TODO(blueeyes): Add a check for the count of field_names and the count
|
||||
// of field values (check that the fields are not type Unused).
|
||||
template<typename F1, typename F2, typename F3, typename F4>
|
||||
std::string MakeFieldNameString(const std::vector<std::string>& field_names,
|
||||
const F1 field1, const F2 field2,
|
||||
const F3 field3, const F4 field4) {
|
||||
std::stringstream field_name_and_values;
|
||||
std::vector<std::string>::const_iterator field_name_iterator =
|
||||
field_names.begin();
|
||||
if (field_name_iterator == field_names.end()) {
|
||||
return field_name_and_values.str();
|
||||
}
|
||||
// There is at least one name/value pair. prepend open brace.
|
||||
field_name_and_values << "{";
|
||||
field_name_and_values << *field_name_iterator << ':' << field1;
|
||||
if (++field_name_iterator == field_names.end()) {
|
||||
field_name_and_values << "}";
|
||||
return field_name_and_values.str();
|
||||
}
|
||||
field_name_and_values << '&' << *field_name_iterator << ':' << field2;
|
||||
if (++field_name_iterator == field_names.end()) {
|
||||
field_name_and_values << "}";
|
||||
return field_name_and_values.str();
|
||||
}
|
||||
field_name_and_values << '&' << *field_name_iterator << ':' << field3;
|
||||
if (++field_name_iterator == field_names.end()) {
|
||||
field_name_and_values << "}";
|
||||
return field_name_and_values.str();
|
||||
}
|
||||
field_name_and_values << '&' << *field_name_iterator << ':' << field4;
|
||||
field_name_and_values << "}";
|
||||
return field_name_and_values.str();
|
||||
}
|
||||
|
||||
// This specialization of the helper method is a shortcut for EventMetric
|
||||
// instances with no fields.
|
||||
template<>
|
||||
inline std::string MakeFieldNameString<Unused, Unused, Unused, Unused>(
|
||||
const std::vector<std::string>& field_names,
|
||||
const Unused unused1, const Unused unused2,
|
||||
const Unused unused3, const Unused unused4) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// This helper function appends the field names to a vector of strings.
|
||||
inline void AppendFieldNames(std::vector<std::string>* field_name_vector,
|
||||
int field_count, ...) {
|
||||
va_list field_names;
|
||||
|
||||
va_start(field_names, field_count);
|
||||
for (int x = 0; x < field_count; x++) {
|
||||
field_name_vector->push_back(va_arg(field_names, const char*));
|
||||
}
|
||||
va_end(field_names);
|
||||
}
|
||||
|
||||
} // namespace impl
|
||||
|
||||
// Overloaded template constructor implementations for EventMetric.
|
||||
template<typename F1, typename F2, typename F3, typename F4>
|
||||
EventMetric<F1, F2, F3, F4>::EventMetric(
|
||||
const std::string& metric_name)
|
||||
: BaseEventMetric(metric_name) {}
|
||||
|
||||
template<typename F1, typename F2, typename F3, typename F4>
|
||||
EventMetric<F1, F2, F3, F4>::EventMetric(
|
||||
const std::string& metric_name,
|
||||
const char* field_name)
|
||||
: BaseEventMetric(metric_name) {
|
||||
impl::AppendFieldNames(&field_names_, 1, field_name);
|
||||
}
|
||||
template<typename F1, typename F2, typename F3, typename F4>
|
||||
EventMetric<F1, F2, F3, F4>::EventMetric(
|
||||
const std::string& metric_name,
|
||||
const char* field_name1,
|
||||
const char* field_name2)
|
||||
: BaseEventMetric(metric_name) {
|
||||
impl::AppendFieldNames(&field_names_, 2, field_name1, field_name2);
|
||||
}
|
||||
template<typename F1, typename F2, typename F3, typename F4>
|
||||
EventMetric<F1, F2, F3, F4>::EventMetric(
|
||||
const std::string& metric_name,
|
||||
const char* field_name1,
|
||||
const char* field_name2,
|
||||
const char* field_name3)
|
||||
: BaseEventMetric(metric_name) {
|
||||
impl::AppendFieldNames(&field_names_,
|
||||
3, field_name1, field_name2, field_name3);
|
||||
}
|
||||
template<typename F1, typename F2, typename F3, typename F4>
|
||||
EventMetric<F1, F2, F3, F4>::EventMetric(
|
||||
const std::string& metric_name,
|
||||
const char* field_name1,
|
||||
const char* field_name2,
|
||||
const char* field_name3,
|
||||
const char* field_name4)
|
||||
: BaseEventMetric(metric_name) {
|
||||
impl::AppendFieldNames(&field_names_,
|
||||
4, field_name1, field_name2,
|
||||
field_name3, field_name4);
|
||||
}
|
||||
|
||||
template<typename F1, typename F2, typename F3, typename F4>
|
||||
void EventMetric<F1, F2, F3, F4>::Record(
|
||||
double value, F1 field1, F2 field2, F3 field3, F4 field4) {
|
||||
std::string field_name_values =
|
||||
impl::MakeFieldNameString(field_names_, field1, field2, field3, field4);
|
||||
BaseEventMetric::Record(field_name_values, value);
|
||||
}
|
||||
|
||||
} // namespace metrics
|
||||
} // namespace wvcdm
|
||||
|
||||
#endif // WVCDM_METRICS_EVENT_METRIC_H_
|
||||
46
libwvdrmengine/cdm/metrics/include/metric_publisher.h
Normal file
46
libwvdrmengine/cdm/metrics/include/metric_publisher.h
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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_
|
||||
56
libwvdrmengine/cdm/metrics/include/metrics_front_end.h
Normal file
56
libwvdrmengine/cdm/metrics/include/metrics_front_end.h
Normal file
@@ -0,0 +1,56 @@
|
||||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
|
||||
#ifndef WVCDM_METRICS_METRICS_FRONT_END_H_
|
||||
#define WVCDM_METRICS_METRICS_FRONT_END_H_
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "report.h"
|
||||
#include "timer_metric.h" /* needed for the macro */
|
||||
|
||||
namespace wvcdm {
|
||||
namespace metrics {
|
||||
|
||||
class MetricsFrontEnd {
|
||||
|
||||
public:
|
||||
|
||||
MetricsFrontEnd(Report* root);
|
||||
|
||||
MetricNotification* CreateSubscriber();
|
||||
|
||||
static MetricsFrontEnd& Instance();
|
||||
static void OverrideInstance(MetricsFrontEnd* instance);
|
||||
|
||||
private:
|
||||
|
||||
static MetricsFrontEnd* instance_;
|
||||
|
||||
Report* root_;
|
||||
|
||||
/* Disallow copy and assign. */
|
||||
MetricsFrontEnd(const MetricsFrontEnd&);
|
||||
void operator=(const MetricsFrontEnd&);
|
||||
};
|
||||
|
||||
} // namespace metrics
|
||||
} // namespace wvcdm
|
||||
|
||||
#define MFE wvcdm::metrics::MetricsFrontEnd::Instance()
|
||||
|
||||
#define M_RECORD(GROUP, METRIC, ...) \
|
||||
if ( GROUP ) { \
|
||||
( GROUP ) -> METRIC . Record( __VA_ARGS__ ); \
|
||||
}
|
||||
|
||||
#define M_TIME(CALL, GROUP, METRIC, ...) \
|
||||
if ( GROUP ) { \
|
||||
wvcdm::metrics::TimerMetric timer; \
|
||||
timer.Start(); \
|
||||
CALL; \
|
||||
( GROUP ) -> METRIC . Record(timer.AsUs(), ##__VA_ARGS__ ); \
|
||||
} else { \
|
||||
CALL; \
|
||||
}
|
||||
|
||||
#endif
|
||||
150
libwvdrmengine/cdm/metrics/include/metrics_group.h
Normal file
150
libwvdrmengine/cdm/metrics/include/metrics_group.h
Normal file
@@ -0,0 +1,150 @@
|
||||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
|
||||
#ifndef WVCDM_METRICS_METRICS_GROUP_H_
|
||||
#define WVCDM_METRICS_METRICS_GROUP_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "OEMCryptoCENC.h"
|
||||
#include "event_metric.h"
|
||||
#include "metric_publisher.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
namespace wvcdm {
|
||||
namespace metrics {
|
||||
|
||||
/*
|
||||
* The metrics group is the group of all metrics that be be recorded. They
|
||||
* are kept together to allow calls to be correlated to one another.
|
||||
*/
|
||||
class MetricsGroup {
|
||||
public:
|
||||
/* CDM ENGINE */
|
||||
EventMetric<CdmResponseType> cdm_engine_add_key_;
|
||||
EventMetric<> cdm_engine_close_key_set_session_;
|
||||
EventMetric<CdmResponseType> cdm_engine_close_session_;
|
||||
EventMetric<CdmResponseType> cdm_engine_decrypt_;
|
||||
EventMetric<bool> cdm_engine_find_session_for_key_;
|
||||
EventMetric<CdmResponseType> cdm_engine_generate_key_request_;
|
||||
EventMetric<CdmResponseType> cdm_engine_get_provisioning_request_;
|
||||
EventMetric<CdmResponseType> cdm_engine_get_usage_info_;
|
||||
EventMetric<CdmResponseType> cdm_engine_handle_provisioning_response_;
|
||||
EventMetric<> cdm_engine_life_span_;
|
||||
EventMetric<> cdm_engine_notify_resolution_;
|
||||
EventMetric<CdmResponseType> cdm_engine_open_key_set_session_;
|
||||
EventMetric<CdmResponseType> cdm_engine_open_session_;
|
||||
EventMetric<CdmResponseType> cdm_engine_query_key_status_;
|
||||
EventMetric<CdmResponseType> cdm_engine_query_oemcrypto_session_id_;
|
||||
EventMetric<CdmResponseType> cdm_engine_query_session_status_;
|
||||
EventMetric<CdmResponseType> cdm_engine_query_status_;
|
||||
EventMetric<CdmResponseType> cdm_engine_release_all_usage_info_;
|
||||
EventMetric<CdmResponseType> cdm_engine_release_usage_info_;
|
||||
EventMetric<CdmResponseType> cdm_engine_remove_keys_;
|
||||
EventMetric<CdmResponseType> cdm_engine_restore_key_;
|
||||
EventMetric<CdmResponseType, CdmSecurityLevel> cdm_engine_unprovision_;
|
||||
/* CDM SESSION */
|
||||
EventMetric<CdmResponseType> cdm_session_add_key_;
|
||||
EventMetric<CdmResponseType> cdm_session_decrypt_;
|
||||
EventMetric<> cdm_session_delete_license_;
|
||||
EventMetric<CdmResponseType> cdm_session_generate_key_request_;
|
||||
EventMetric<CdmResponseType> cdm_session_generate_release_request_;
|
||||
EventMetric<CdmResponseType> cdm_session_generate_renewal_request_;
|
||||
EventMetric<CdmResponseType, Pow2Bucket, CdmEncryptionAlgorithm> cdm_session_generic_decrypt_;
|
||||
EventMetric<CdmResponseType, Pow2Bucket, CdmEncryptionAlgorithm> cdm_session_generic_encrypt_;
|
||||
EventMetric<CdmResponseType, Pow2Bucket, CdmSigningAlgorithm> cdm_session_generic_sign_;
|
||||
EventMetric<CdmResponseType, Pow2Bucket, CdmSigningAlgorithm> cdm_session_generic_verify_;
|
||||
EventMetric<SecurityLevel> cdm_session_get_requested_security_level_;
|
||||
EventMetric<bool> cdm_session_is_key_loaded_;
|
||||
EventMetric<> cdm_session_life_span_;
|
||||
EventMetric<CdmResponseType> cdm_session_query_key_allowed_usage_;
|
||||
EventMetric<CdmResponseType> cdm_session_query_key_status_;
|
||||
EventMetric<CdmResponseType> cdm_session_query_oemcrypto_session_id_;
|
||||
EventMetric<CdmResponseType> cdm_session_query_status_;
|
||||
EventMetric<> cdm_session_release_crypto_;
|
||||
EventMetric<CdmResponseType> cdm_session_renew_key_;
|
||||
EventMetric<CdmResponseType> cdm_session_restore_offline_session_;
|
||||
EventMetric<CdmResponseType> cdm_session_restore_usage_session_;
|
||||
EventMetric<CdmResponseType> cdm_session_update_usage_information_;
|
||||
/* CRYPTO SESSION */
|
||||
EventMetric<> crypto_session_close_;
|
||||
EventMetric<CdmResponseType> crypto_session_decrypt_;
|
||||
EventMetric<CdmResponseType> crypto_session_delete_all_usage_reports_;
|
||||
EventMetric<CdmResponseType> crypto_session_delete_multiple_usage_information_;
|
||||
EventMetric<CdmResponseType, Pow2Bucket, CdmEncryptionAlgorithm> crypto_session_generic_decrypt_;
|
||||
EventMetric<CdmResponseType, Pow2Bucket, CdmEncryptionAlgorithm> crypto_session_generic_encrypt_;
|
||||
EventMetric<CdmResponseType, Pow2Bucket, CdmSigningAlgorithm> crypto_session_generic_sign_;
|
||||
EventMetric<CdmResponseType, Pow2Bucket, CdmSigningAlgorithm> crypto_session_generic_verify_;
|
||||
EventMetric<bool> crypto_session_get_api_version_;
|
||||
EventMetric<bool> crypto_session_get_device_unique_id_;
|
||||
EventMetric<bool> crypto_session_get_hdcp_capabilities_;
|
||||
EventMetric<bool> crypto_session_get_max_number_of_sessions_;
|
||||
EventMetric<bool> crypto_session_get_number_of_open_sessions_;
|
||||
EventMetric<bool> crypto_session_get_provisioning_id_;
|
||||
EventMetric<bool, Pow2Bucket> crypto_session_get_random_;
|
||||
EventMetric<CdmSecurityLevel> crypto_session_get_security_level_;
|
||||
EventMetric<bool, uint32_t> crypto_session_get_system_id_;
|
||||
EventMetric<bool> crypto_session_get_token_;
|
||||
EventMetric<> crypto_session_life_span_;
|
||||
EventMetric<bool> crypto_session_load_certificate_private_key_;
|
||||
EventMetric<CdmResponseType, SecurityLevel> crypto_session_open_;
|
||||
EventMetric<CdmResponseType> crypto_session_query_oemcrypto_session_id_;
|
||||
EventMetric<CdmResponseType> crypto_session_update_usage_information_;
|
||||
EventMetric<bool> crypto_session_usage_information_support_;
|
||||
/* OEMCRYPTO */
|
||||
EventMetric<uint32_t, SecurityLevel> oemcrypto_api_version_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_close_session_;
|
||||
EventMetric<OEMCryptoResult, SecurityLevel, Pow2Bucket> oemcrypto_copy_buffer_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_deactivate_usage_entry_;
|
||||
EventMetric<OEMCryptoResult, Pow2Bucket> oemcrypto_decrypt_cenc_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_delete_usage_entry_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_delete_usage_table_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_derive_keys_from_session_key_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_force_delete_usage_entry_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_generate_derived_keys_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_generate_nonce_;
|
||||
EventMetric<OEMCryptoResult, Pow2Bucket> oemcrypto_generate_rsa_signature_;
|
||||
EventMetric<OEMCryptoResult, Pow2Bucket> oemcrypto_generate_signature_;
|
||||
EventMetric<OEMCryptoResult, Pow2Bucket> oemcrypto_generic_decrypt_;
|
||||
EventMetric<OEMCryptoResult, Pow2Bucket> oemcrypto_generic_encrypt_;
|
||||
EventMetric<OEMCryptoResult, Pow2Bucket> oemcrypto_generic_sign_;
|
||||
EventMetric<OEMCryptoResult, Pow2Bucket> oemcrypto_generic_verify_;
|
||||
EventMetric<OEMCryptoResult, SecurityLevel> oemcrypto_get_device_id_;
|
||||
EventMetric<OEMCryptoResult, SecurityLevel> oemcrypto_get_hdcp_capability_;
|
||||
EventMetric<OEMCryptoResult, Pow2Bucket, SecurityLevel> oemcrypto_get_key_data_;
|
||||
EventMetric<OEMCryptoResult, SecurityLevel> oemcrypto_get_max_number_of_sessions_;
|
||||
EventMetric<OEMCryptoResult, SecurityLevel> oemcrypto_get_number_of_open_sessions_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_get_oem_public_certificate_;
|
||||
EventMetric<OEMCrypto_ProvisioningMethod, SecurityLevel> oemcrypto_get_provisioning_method_;
|
||||
EventMetric<OEMCryptoResult, Pow2Bucket> oemcrypto_get_random_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_initialize_;
|
||||
EventMetric<OEMCryptoResult, SecurityLevel> oemcrypto_install_keybox_;
|
||||
EventMetric<bool, SecurityLevel> oemcrypto_is_anti_rollback_hw_present_;
|
||||
EventMetric<OEMCryptoResult, SecurityLevel> oemcrypto_is_keybox_valid_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_load_device_rsa_key_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_load_keys_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_load_test_keybox_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_load_test_rsa_key_;
|
||||
EventMetric<OEMCryptoResult, SecurityLevel> oemcrypto_open_session_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_query_key_control_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_refresh_keys_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_report_usage_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_rewrap_device_rsa_key_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_rewrap_device_rsa_key_30_;
|
||||
EventMetric<std::string, SecurityLevel> oemcrypto_security_level_;
|
||||
EventMetric<uint8_t, SecurityLevel> oemcrypto_security_patch_level_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_select_key_;
|
||||
EventMetric<OEMCryptoResult, SecurityLevel> oemcrypto_supports_usage_table_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_update_usage_table_;
|
||||
EventMetric<OEMCryptoResult> oemcrypto_wrap_keybox_;
|
||||
|
||||
MetricsGroup();
|
||||
~MetricsGroup();
|
||||
|
||||
private:
|
||||
void Publish(MetricNotification* subscriber);
|
||||
|
||||
};
|
||||
} // namespace metrics
|
||||
} // namespace wvcdm
|
||||
#endif
|
||||
29
libwvdrmengine/cdm/metrics/include/report.h
Normal file
29
libwvdrmengine/cdm/metrics/include/report.h
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
|
||||
#ifndef WVCDM_METRICS_REPORT_H_
|
||||
#define WVCDM_METRICS_REPORT_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "event_metric.h"
|
||||
|
||||
namespace wvcdm {
|
||||
namespace metrics {
|
||||
|
||||
class Report : public MetricNotification {
|
||||
|
||||
public:
|
||||
|
||||
virtual ~Report() { }
|
||||
|
||||
/* Create a new report of the same type. The new report is not
|
||||
* a copy of this report. The pointer is to be owned by whoever
|
||||
* calls this function. */
|
||||
virtual Report* NewReport() const;
|
||||
|
||||
};
|
||||
|
||||
} // metrics
|
||||
} //wvcdm
|
||||
|
||||
#endif
|
||||
24
libwvdrmengine/cdm/metrics/include/timer_metric.h
Normal file
24
libwvdrmengine/cdm/metrics/include/timer_metric.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef WVCDM_METRICS_TIMER_METRIC_H_
|
||||
#define WVCDM_METRICS_TIMER_METRIC_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace wvcdm {
|
||||
namespace metrics {
|
||||
|
||||
class TimerMetric {
|
||||
|
||||
public:
|
||||
void Start();
|
||||
double AsMs() const;
|
||||
double AsUs() const;
|
||||
|
||||
private:
|
||||
double sec_;
|
||||
double usec_;
|
||||
|
||||
};
|
||||
|
||||
} // namespace metrics
|
||||
} // namespace wvcdm
|
||||
#endif
|
||||
Reference in New Issue
Block a user