Add session metric pruning.

[ Merge of http://go/wvgerrit/65983 ]

Add support to drop closed metrics in order to save space for
long-running applications (and CdmEngine instances). The code now keeps
only a limited number of metrics collections after the session is closed.
As a session (and its metrics session) is closed, the oldest, closed metrics
session is dropped. This means those metrics will not be reported nor
accessible in the client.

Bug: http://b/118664842

Test: CDM Unit tests. Android Unit Test. Ran GPLay Manually.
Change-Id: I27d6e61a8fe4148ad1ef2a433c8e5f4cdd84cc72
This commit is contained in:
Adam Stone
2019-01-15 18:21:47 -08:00
parent 92e123d8ea
commit 700ee5160a
5 changed files with 270 additions and 284 deletions

View File

@@ -194,6 +194,7 @@ CdmResponseType CdmEngine::CloseSession(const CdmSessionId& session_id) {
LOGE("CdmEngine::CloseSession: session not found = %s", session_id.c_str());
return SESSION_NOT_FOUND_1;
}
metrics_.ConsolidateSessions();
return NO_ERROR;
}