Merge "Include metric history in dumpsys." into udc-dev

This commit is contained in:
Alex Dale
2023-04-29 00:15:57 +00:00
committed by Android (Google) Code Review

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) {