Creates a new license request latency metric
Previously, we did not have a license request latency metric. This is a notable limitation in our metrics. This adds a metric that captures the timing between a GenerateKeyRequest and an AddKey operation. Bug: 72994956 Test: New unit tests. Google Play Change-Id: If99c187399c02f9b5d4c355732af7588bbbefb11
This commit is contained in:
@@ -72,6 +72,14 @@ void SetAttributeField<drm_metrics::Attributes::kSigningAlgorithmFieldNumber,
|
||||
attributes->set_signing_algorithm(signing_algorithm);
|
||||
}
|
||||
|
||||
template <>
|
||||
void SetAttributeField<drm_metrics::Attributes::kKeyRequestTypeFieldNumber,
|
||||
CdmKeyRequestType>(
|
||||
const CdmKeyRequestType &key_request_type,
|
||||
drm_metrics::Attributes *attributes) {
|
||||
attributes->set_key_request_type(key_request_type);
|
||||
}
|
||||
|
||||
template <>
|
||||
void SetAttributeField<0, util::Unused>(const util::Unused &,
|
||||
drm_metrics::Attributes *) {
|
||||
|
||||
@@ -44,6 +44,8 @@ message Attributes {
|
||||
optional uint32 key_status_type = 14;
|
||||
// Defined at ::android::hardware::drm::V1_0::EventType;
|
||||
optional uint32 event_type = 15;
|
||||
// Contains the CdmKeyRequestType defined in wv_cdm_types.h.
|
||||
optional uint32 key_request_type = 16;
|
||||
}
|
||||
|
||||
// The Counter message is used to store a count value with an associated
|
||||
@@ -153,7 +155,7 @@ message WvCdmMetrics {
|
||||
|
||||
// This contains metrics that were captured within a CdmSession. This contains
|
||||
// nested CryptoMetrics that were captured in the context of the session.
|
||||
// next id: 7
|
||||
// next id: 8
|
||||
message SessionMetrics {
|
||||
optional ValueMetric session_id = 1;
|
||||
optional CryptoMetrics crypto_metrics = 2;
|
||||
@@ -161,6 +163,7 @@ message WvCdmMetrics {
|
||||
repeated DistributionMetric cdm_session_renew_key_time_us = 4;
|
||||
repeated CounterMetric cdm_session_restore_offline_session = 5;
|
||||
repeated CounterMetric cdm_session_restore_usage_session = 6;
|
||||
repeated DistributionMetric cdm_session_license_request_latency_ms = 7;
|
||||
}
|
||||
|
||||
// These are metrics recorded at the Engine level. This includes CryptoSession
|
||||
|
||||
@@ -29,7 +29,8 @@ struct CompareSessionIds {
|
||||
namespace wvcdm {
|
||||
namespace metrics {
|
||||
|
||||
void CryptoMetrics::Serialize(WvCdmMetrics::CryptoMetrics *crypto_metrics) {
|
||||
void CryptoMetrics::Serialize(WvCdmMetrics::CryptoMetrics *crypto_metrics)
|
||||
const {
|
||||
/* CRYPTO SESSION */
|
||||
crypto_metrics->set_allocated_crypto_session_security_level(
|
||||
crypto_session_security_level_.ToProto());
|
||||
@@ -151,20 +152,16 @@ void CryptoMetrics::Serialize(WvCdmMetrics::CryptoMetrics *crypto_metrics) {
|
||||
crypto_metrics->mutable_oemcrypto_update_usage_entry());
|
||||
}
|
||||
|
||||
SessionMetrics::SessionMetrics()
|
||||
: cdm_session_life_span_(),
|
||||
cdm_session_renew_key_(),
|
||||
cdm_session_restore_offline_session_(),
|
||||
cdm_session_restore_usage_session_(),
|
||||
completed_(false) {}
|
||||
SessionMetrics::SessionMetrics() {}
|
||||
|
||||
void SessionMetrics::Serialize(WvCdmMetrics::SessionMetrics *session_metrics) {
|
||||
void SessionMetrics::Serialize(WvCdmMetrics::SessionMetrics *session_metrics)
|
||||
const {
|
||||
SerializeSessionMetrics(session_metrics);
|
||||
crypto_metrics_.Serialize(session_metrics->mutable_crypto_metrics());
|
||||
}
|
||||
|
||||
void SessionMetrics::SerializeSessionMetrics(
|
||||
WvCdmMetrics::SessionMetrics *session_metrics) {
|
||||
WvCdmMetrics::SessionMetrics *session_metrics) const {
|
||||
// If the session id was set, add it to the metrics. It's possible that
|
||||
// it's not set in some circumstances such as when provisioning is needed.
|
||||
if (!session_id_.empty()) {
|
||||
@@ -178,6 +175,8 @@ void SessionMetrics::SerializeSessionMetrics(
|
||||
session_metrics->mutable_cdm_session_restore_offline_session());
|
||||
cdm_session_restore_usage_session_.ToProto(
|
||||
session_metrics->mutable_cdm_session_restore_usage_session());
|
||||
cdm_session_license_request_latency_ms_.ToProto(
|
||||
session_metrics->mutable_cdm_session_license_request_latency_ms());
|
||||
}
|
||||
|
||||
OemCryptoDynamicAdapterMetrics::OemCryptoDynamicAdapterMetrics()
|
||||
@@ -202,7 +201,7 @@ void OemCryptoDynamicAdapterMetrics::SetL1MinApiVersion(uint32_t version) {
|
||||
}
|
||||
|
||||
void OemCryptoDynamicAdapterMetrics::Serialize(
|
||||
WvCdmMetrics::EngineMetrics *engine_metrics) {
|
||||
WvCdmMetrics::EngineMetrics *engine_metrics) const {
|
||||
AutoLock lock(adapter_lock_);
|
||||
|
||||
engine_metrics->set_allocated_oemcrypto_initialization_mode(
|
||||
@@ -264,7 +263,7 @@ void EngineMetrics::RemoveSession(wvcdm::CdmSessionId session_id) {
|
||||
session_metrics_list_.end());
|
||||
}
|
||||
|
||||
void EngineMetrics::Serialize(WvCdmMetrics *wv_metrics) {
|
||||
void EngineMetrics::Serialize(WvCdmMetrics *wv_metrics) const {
|
||||
AutoLock lock(session_metrics_lock_);
|
||||
WvCdmMetrics::EngineMetrics *engine_metrics =
|
||||
wv_metrics->mutable_engine_metrics();
|
||||
@@ -291,7 +290,7 @@ void EngineMetrics::SetAppPackageName(const std::string &app_package_name) {
|
||||
}
|
||||
|
||||
void EngineMetrics::SerializeEngineMetrics(
|
||||
WvCdmMetrics::EngineMetrics *engine_metrics) {
|
||||
WvCdmMetrics::EngineMetrics *engine_metrics) const {
|
||||
// Set the engine lifespan at the time of serialization.
|
||||
engine_metrics->mutable_cdm_engine_life_span_ms()->set_int_value(
|
||||
life_span_internal_.AsMs());
|
||||
|
||||
@@ -11,6 +11,13 @@ void TimerMetric::Start() {
|
||||
gettimeofday(&tv, NULL);
|
||||
sec_ = tv.tv_sec;
|
||||
usec_ = tv.tv_usec;
|
||||
is_started_ = true;
|
||||
}
|
||||
|
||||
void TimerMetric::Clear() {
|
||||
is_started_ = false;
|
||||
sec_ = 0;
|
||||
usec_ = 0;
|
||||
}
|
||||
|
||||
double TimerMetric::AsMs() const {
|
||||
|
||||
Reference in New Issue
Block a user