Merge "Include metric history in dumpsys." into udc-dev am: 7b32faf9f8

Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/22794477

Change-Id: I1bb402c80a36f0fdc8b05d7510990193805a1681
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Alex Dale
2023-04-29 01:06:36 +00:00
committed by Automerger Merge Worker

View File

@@ -246,7 +246,7 @@ void WVDrmFactory::printCdmMetrics(int fd) {
if (result != wvcdm::NO_ERROR) {
dprintf(fd, " live_metrics:\n");
dprintf(fd, " error_message: \"%s\"\n", result.ToString().c_str());
dprintf(fd, " error_code: %d\n", static_cast<int>(result.code()));
dprintf(fd, " error_code: %d\n", result.ToInt());
} else if (snapshots.empty()) {
// YAML does not support empty property values.
const char kNoMetricsMessage[] =
@@ -266,7 +266,24 @@ void WVDrmFactory::printCdmMetrics(int fd) {
FormatWvMetricsSnapshotItem(fd, 2, snapshots[i], i);
}
}
// TODO(b/270166158): Print metrics history.
// Saved metrics.
snapshots.clear();
result = cdm->GetAllSavedMetricsSnapshots(&snapshots);
if (result != wvcdm::NO_ERROR) {
dprintf(fd, " past_metrics:\n");
dprintf(fd, " error_message: \"%s\"\n", result.ToString().c_str());
dprintf(fd, " error_code: %d\n", result.ToInt());
} else if (snapshots.empty()) {
// YAML does not support empty property values.
const char kNoMetricsMessage[] =
"Metrics not available, no instances have been created.";
dprintf(fd, " past_metrics: [] # %s\n", kNoMetricsMessage);
} else {
dprintf(fd, " past_metrics: # count = %zu\n", snapshots.size());
for (size_t i = 0; i < snapshots.size(); i++) {
FormatWvMetricsSnapshotItem(fd, 2, snapshots[i], i);
}
}
}
void WVDrmFactory::printCdmProperties(int fd) {