Source release 14.1.0
This commit is contained in:
@@ -106,7 +106,7 @@ class CounterMetric : public BaseCounterMetric {
|
||||
}
|
||||
|
||||
void ToProto(::google::protobuf::RepeatedPtrField<drm_metrics::CounterMetric>
|
||||
*counters);
|
||||
*counters) const;
|
||||
|
||||
private:
|
||||
friend class CounterMetricTest;
|
||||
@@ -121,7 +121,7 @@ template <>
|
||||
inline void CounterMetric<0, util::Unused, 0, util::Unused, 0, util::Unused, 0,
|
||||
util::Unused>::
|
||||
ToProto(::google::protobuf::RepeatedPtrField<drm_metrics::CounterMetric>
|
||||
*counters) {
|
||||
*counters) const {
|
||||
|
||||
const std::map<std::string, int64_t>* values = GetValues();
|
||||
for (std::map<std::string, int64_t>::const_iterator it = values->begin();
|
||||
@@ -135,7 +135,7 @@ template <int I1, typename F1, int I2, typename F2, int I3, typename F3, int I4,
|
||||
typename F4>
|
||||
inline void CounterMetric<I1, F1, I2, F2, I3, F3, I4, F4>::ToProto(
|
||||
::google::protobuf::RepeatedPtrField<drm_metrics::CounterMetric>
|
||||
*counters) {
|
||||
*counters) const {
|
||||
const std::map<std::string, int64_t>* values = GetValues();
|
||||
for (std::map<std::string, int64_t>::const_iterator it = values->begin();
|
||||
it != values->end(); it++) {
|
||||
|
||||
@@ -110,7 +110,7 @@ class EventMetric : public BaseEventMetric {
|
||||
|
||||
void ToProto(
|
||||
::google::protobuf::RepeatedPtrField<drm_metrics::DistributionMetric>
|
||||
*distributions_proto);
|
||||
*distributions_proto) const;
|
||||
|
||||
private:
|
||||
friend class EventMetricTest;
|
||||
@@ -118,7 +118,7 @@ class EventMetric : public BaseEventMetric {
|
||||
|
||||
inline void SetDistributionValues(
|
||||
const Distribution &distribution,
|
||||
drm_metrics::DistributionMetric *metric_proto) {
|
||||
drm_metrics::DistributionMetric *metric_proto) const {
|
||||
metric_proto->set_mean(distribution.Mean());
|
||||
metric_proto->set_operation_count(distribution.Count());
|
||||
if (distribution.Count() > 1) {
|
||||
@@ -140,7 +140,7 @@ inline void EventMetric<0, util::Unused, 0, util::Unused, 0, util::Unused, 0,
|
||||
util::Unused>::
|
||||
ToProto(
|
||||
::google::protobuf::RepeatedPtrField<drm_metrics::DistributionMetric>
|
||||
*distributions_proto) {
|
||||
*distributions_proto) const {
|
||||
const std::map<std::string, Distribution *>* distributions
|
||||
= GetDistributions();
|
||||
for (std::map<std::string, Distribution *>::const_iterator it =
|
||||
@@ -154,7 +154,7 @@ template <int I1, typename F1, int I2, typename F2, int I3, typename F3, int I4,
|
||||
typename F4>
|
||||
inline void EventMetric<I1, F1, I2, F2, I3, F3, I4, F4>::ToProto(
|
||||
::google::protobuf::RepeatedPtrField<drm_metrics::DistributionMetric>
|
||||
*distributions_proto) {
|
||||
*distributions_proto) const {
|
||||
const std::map<std::string, Distribution *>* distributions
|
||||
= GetDistributions();
|
||||
for (std::map<std::string, Distribution *>::const_iterator it =
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "counter_metric.h"
|
||||
#include "event_metric.h"
|
||||
#include "metrics.pb.h"
|
||||
#include "timer_metric.h"
|
||||
#include "value_metric.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
@@ -81,6 +82,8 @@ const int kKeyStatusTypeFieldNumber =
|
||||
::drm_metrics::Attributes::kKeyStatusTypeFieldNumber;
|
||||
const int kEventTypeFieldNumber =
|
||||
::drm_metrics::Attributes::kEventTypeFieldNumber;
|
||||
const int kKeyRequestTypeFieldNumber =
|
||||
::drm_metrics::Attributes::kKeyRequestTypeFieldNumber;
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
@@ -110,7 +113,8 @@ typedef enum OEMCryptoInitializationMode {
|
||||
// This class contains metrics for Crypto Session and OEM Crypto.
|
||||
class CryptoMetrics {
|
||||
public:
|
||||
void Serialize(drm_metrics::WvCdmMetrics::CryptoMetrics *crypto_metrics);
|
||||
void Serialize(drm_metrics::WvCdmMetrics::CryptoMetrics *crypto_metrics)
|
||||
const;
|
||||
|
||||
/* CRYPTO SESSION */
|
||||
// TODO(blueeyes): Convert this to crypto_session_default_security_level_.
|
||||
@@ -144,6 +148,8 @@ class CryptoMetrics {
|
||||
ValueMetric<uint32_t> crypto_session_system_id_;
|
||||
EventMetric<kErrorCodeFieldNumber, CdmResponseType>
|
||||
crypto_session_update_usage_information_;
|
||||
EventMetric<kErrorCodeFieldNumber, CdmResponseType>
|
||||
crypto_session_update_usage_entry_;
|
||||
ValueMetric<bool> crypto_session_usage_information_support_;
|
||||
/* OEMCRYPTO */
|
||||
ValueMetric<uint32_t> oemcrypto_api_version_;
|
||||
@@ -225,6 +231,8 @@ class CryptoMetrics {
|
||||
ValueMetric<CdmUsageSupportType> oemcrypto_usage_table_support_;
|
||||
CounterMetric<kOemCryptoResultFieldNumber, OEMCryptoResult>
|
||||
oemcrypto_update_usage_table_;
|
||||
CounterMetric<kOemCryptoResultFieldNumber, OEMCryptoResult>
|
||||
oemcrypto_update_usage_entry_;
|
||||
};
|
||||
|
||||
// This class contains session-scoped metrics. All properties and
|
||||
@@ -262,13 +270,17 @@ class SessionMetrics {
|
||||
CounterMetric<kErrorCodeFieldNumber, CdmResponseType>
|
||||
cdm_session_restore_usage_session_;
|
||||
|
||||
EventMetric<kKeyRequestTypeFieldNumber, CdmKeyRequestType>
|
||||
cdm_session_license_request_latency_ms_;
|
||||
|
||||
// Serialize the session metrics to the provided |metric_group|.
|
||||
// |metric_group| is owned by the caller and must not be null.
|
||||
void Serialize(drm_metrics::WvCdmMetrics::SessionMetrics *session_metrics);
|
||||
void Serialize(drm_metrics::WvCdmMetrics::SessionMetrics *session_metrics)
|
||||
const;
|
||||
|
||||
private:
|
||||
void SerializeSessionMetrics(
|
||||
drm_metrics::WvCdmMetrics::SessionMetrics *session_metrics);
|
||||
drm_metrics::WvCdmMetrics::SessionMetrics *session_metrics) const;
|
||||
CdmSessionId session_id_;
|
||||
bool completed_;
|
||||
CryptoMetrics crypto_metrics_;
|
||||
@@ -294,13 +306,14 @@ class OemCryptoDynamicAdapterMetrics {
|
||||
|
||||
// Serialize the session metrics to the provided |metric_group|.
|
||||
// |metric_group| is owned by the caller and must not be null.
|
||||
void Serialize(drm_metrics::WvCdmMetrics::EngineMetrics *engine_metrics);
|
||||
void Serialize(drm_metrics::WvCdmMetrics::EngineMetrics *engine_metrics)
|
||||
const;
|
||||
|
||||
// Clears the existing metric values.
|
||||
void Clear();
|
||||
|
||||
private:
|
||||
Lock adapter_lock_;
|
||||
mutable Lock adapter_lock_;
|
||||
ValueMetric<OEMCryptoInitializationMode> oemcrypto_initialization_mode_;
|
||||
ValueMetric<uint32_t> oemcrypto_l1_api_version_;
|
||||
ValueMetric<uint32_t> oemcrypto_l1_min_api_version_;
|
||||
@@ -346,7 +359,7 @@ class EngineMetrics {
|
||||
// void Serialize(drm_metrics::MetricsGroup* metric_group, bool
|
||||
// completed_only,
|
||||
// bool clear_serialized_sessions);
|
||||
void Serialize(drm_metrics::WvCdmMetrics *engine_metrics);
|
||||
void Serialize(drm_metrics::WvCdmMetrics *engine_metrics) const;
|
||||
|
||||
void SetAppPackageName(const std::string &app_package_name);
|
||||
|
||||
@@ -371,7 +384,6 @@ class EngineMetrics {
|
||||
cdm_engine_get_usage_info_;
|
||||
EventMetric<kErrorCodeFieldNumber, CdmResponseType>
|
||||
cdm_engine_handle_provisioning_response_;
|
||||
ValueMetric<double> cdm_engine_life_span_; // Milliseconds
|
||||
CounterMetric<kErrorCodeFieldNumber, CdmResponseType>
|
||||
cdm_engine_open_key_set_session_;
|
||||
CounterMetric<kErrorCodeFieldNumber, CdmResponseType>
|
||||
@@ -393,13 +405,15 @@ class EngineMetrics {
|
||||
cdm_engine_unprovision_;
|
||||
|
||||
private:
|
||||
Lock session_metrics_lock_;
|
||||
mutable Lock session_metrics_lock_;
|
||||
std::vector<metrics::SessionMetrics *> session_metrics_list_;
|
||||
// This is used to populate the engine lifespan metric
|
||||
metrics::TimerMetric life_span_internal_;
|
||||
CryptoMetrics crypto_metrics_;
|
||||
std::string app_package_name_;
|
||||
|
||||
void SerializeEngineMetrics(
|
||||
drm_metrics::WvCdmMetrics::EngineMetrics *engine_metrics);
|
||||
drm_metrics::WvCdmMetrics::EngineMetrics *engine_metrics) const;
|
||||
};
|
||||
|
||||
} // namespace metrics
|
||||
|
||||
@@ -9,13 +9,23 @@ namespace metrics {
|
||||
class TimerMetric {
|
||||
|
||||
public:
|
||||
// Starts the clock running. If the clock was previously set, this resets it.
|
||||
// IsStarted will return true after this call.
|
||||
void Start();
|
||||
// Returns whether or not the timer has started.
|
||||
bool IsStarted() const { return is_started_; };
|
||||
// Stops the clock and clears the current value. IsStarted will return false
|
||||
// after this call.
|
||||
void Clear();
|
||||
// Returns the current clock value as milliseconds (AsMs) or microseconds
|
||||
// (AsUs).
|
||||
double AsMs() const;
|
||||
double AsUs() const;
|
||||
|
||||
private:
|
||||
double sec_;
|
||||
double usec_;
|
||||
bool is_started_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ class ValueMetric {
|
||||
|
||||
// Returns a new ValueMetric proto containing the metric value or the
|
||||
// error code. If neither the error or value are set, it returns nullptr.
|
||||
drm_metrics::ValueMetric *ToProto() {
|
||||
drm_metrics::ValueMetric *ToProto() const {
|
||||
if (has_error_) {
|
||||
drm_metrics::ValueMetric *value_proto = new drm_metrics::ValueMetric;
|
||||
value_proto->set_error_code(error_code_);
|
||||
|
||||
Reference in New Issue
Block a user