Merge "Included metrics for LRU replacement."

This commit is contained in:
Alex Dale
2019-12-18 18:38:34 +00:00
committed by Android (Google) Code Review
6 changed files with 74 additions and 3 deletions

View File

@@ -172,6 +172,11 @@ class CryptoMetrics {
EventMetric<kErrorCodeFieldNumber, CdmResponseType>
usage_table_header_update_entry_;
ValueMetric<size_t> usage_table_header_initial_size_;
/* UsageTableHeader - LRU */
ValueMetric<size_t> usage_table_header_lru_usage_info_count_;
ValueMetric<size_t> usage_table_header_lru_offline_license_count_;
ValueMetric<int64_t> usage_table_header_lru_evicted_entry_staleness_;
ValueMetric<int> usage_table_header_lru_evicted_entry_type_;
/* OEMCRYPTO */
ValueMetric<uint32_t> oemcrypto_api_version_;
CounterMetric<kOemCryptoResultFieldNumber, OEMCryptoResult>

View File

@@ -83,7 +83,6 @@ message ValueMetric {
optional string string_value = 4;
}
// This message contains the specific metrics captured by DrmMetrics. It is
// used for serializing and logging metrics.
// next id: 3.
@@ -94,7 +93,7 @@ message WvCdmMetrics {
// This contains metrics that were captured at the CryptoSession level. These
// include CryptoSession metrics and most OEMCrypto metrics.
// next id: 73
// next id: 77
message CryptoMetrics {
// Crypto Session Metrics.
optional ValueMetric crypto_session_security_level = 1;
@@ -119,6 +118,13 @@ message WvCdmMetrics {
repeated CounterMetric usage_table_header_delete_entry = 60;
repeated DistributionMetric usage_table_header_update_entry_time_us = 56;
repeated CounterMetric usage_table_header_load_entry = 61;
// Usage Table LRU Metrics
optional ValueMetric usage_table_header_lru_usage_info_count = 73;
optional ValueMetric usage_table_header_lru_offline_license_count = 74;
optional ValueMetric usage_table_header_lru_evicted_entry_staleness_s = 75;
// |usage_table_header_lru_evicted_entry_type| refers to the enumeration
// CdmUsageEntryStorageType in wv_cdm_types.h.
optional ValueMetric usage_table_header_lru_evicted_entry_type = 76;
// OemCrypto metrics.
optional ValueMetric oemcrypto_api_version = 16;

View File

@@ -79,6 +79,16 @@ void CryptoMetrics::Serialize(WvCdmMetrics::CryptoMetrics *crypto_metrics)
crypto_metrics->mutable_usage_table_header_load_entry());
crypto_metrics->set_allocated_usage_table_header_initial_size(
usage_table_header_initial_size_.ToProto());
/* USAGE TABLE HEADER - LRU */
crypto_metrics->set_allocated_usage_table_header_lru_usage_info_count(
usage_table_header_lru_usage_info_count_.ToProto());
crypto_metrics->set_allocated_usage_table_header_lru_offline_license_count(
usage_table_header_lru_offline_license_count_.ToProto());
crypto_metrics
->set_allocated_usage_table_header_lru_evicted_entry_staleness_s(
usage_table_header_lru_evicted_entry_staleness_.ToProto());
crypto_metrics->set_allocated_usage_table_header_lru_evicted_entry_type(
usage_table_header_lru_evicted_entry_type_.ToProto());
/* OEMCRYPTO */
crypto_metrics->set_allocated_oemcrypto_api_version(

View File

@@ -348,6 +348,12 @@ TEST_F(CryptoMetricsTest, AllCryptoMetrics) {
crypto_metrics.usage_table_header_delete_entry_.Increment(UNKNOWN_ERROR);
crypto_metrics.usage_table_header_update_entry_.Record(2.0, UNKNOWN_ERROR);
crypto_metrics.usage_table_header_load_entry_.Increment(UNKNOWN_ERROR);
// Usage table LRU metrics.
crypto_metrics.usage_table_header_lru_usage_info_count_.Record(150);
crypto_metrics.usage_table_header_lru_offline_license_count_.Record(50);
crypto_metrics.usage_table_header_lru_evicted_entry_staleness_.Record(259200);
crypto_metrics.usage_table_header_lru_evicted_entry_type_.Record(
kStorageUsageInfo);
// Oem crypto metrics.
crypto_metrics.oemcrypto_api_version_.Record(123);
@@ -462,6 +468,15 @@ TEST_F(CryptoMetricsTest, AllCryptoMetrics) {
EXPECT_GT(actual.usage_table_header_delete_entry_size(), 0);
EXPECT_GT(actual.usage_table_header_update_entry_time_us_size(), 0);
EXPECT_GT(actual.usage_table_header_load_entry_size(), 0);
// Usage table LRU metrics.
EXPECT_EQ(150, actual.usage_table_header_lru_usage_info_count().int_value());
EXPECT_EQ(50,
actual.usage_table_header_lru_offline_license_count().int_value());
EXPECT_EQ(
259200,
actual.usage_table_header_lru_evicted_entry_staleness_s().int_value());
EXPECT_EQ(kStorageUsageInfo,
actual.usage_table_header_lru_evicted_entry_type().int_value());
// Oem crypto metrics.
EXPECT_EQ(123, actual.oemcrypto_api_version().int_value());