logd: add android::sizesTotal() function
Test: gTest liblog-unit-tests, logd-unit-tests and logcat-unit-tests
Bug: 31456426
Change-Id: I6fb6cd589227fc43d22f9336e01f1bf7e3feb24c
diff --git a/logd/LogStatistics.cpp b/logd/LogStatistics.cpp
index ddbb64f..6e63015 100644
--- a/logd/LogStatistics.cpp
+++ b/logd/LogStatistics.cpp
@@ -27,6 +27,8 @@
#include "LogStatistics.h"
+size_t LogStatistics::SizesTotal;
+
LogStatistics::LogStatistics() : enable(false) {
log_id_for_each(id) {
mSizes[id] = 0;
@@ -39,6 +41,8 @@
namespace android {
+size_t sizesTotal() { return LogStatistics::sizesTotal(); }
+
// caller must own and free character string
char *pidToName(pid_t pid) {
char *retval = NULL;
@@ -80,6 +84,7 @@
// elements, but we must recognize the manufactured dropped
// entry as not contributing to the lifetime totals.
mSizesTotal[log_id] += size;
+ SizesTotal += size;
++mElementsTotal[log_id];
}