diff --git a/libwvdrmengine/src/WVDrmFactory.cpp b/libwvdrmengine/src/WVDrmFactory.cpp index 76c5c067..45df9eab 100644 --- a/libwvdrmengine/src/WVDrmFactory.cpp +++ b/libwvdrmengine/src/WVDrmFactory.cpp @@ -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(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) {