Merge "logd: add android::sizesTotal() function"
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];
}
diff --git a/logd/LogStatistics.h b/logd/LogStatistics.h
index 8bf655b..613771c 100644
--- a/logd/LogStatistics.h
+++ b/logd/LogStatistics.h
@@ -472,6 +472,7 @@
size_t mDroppedElements[LOG_ID_MAX];
size_t mSizesTotal[LOG_ID_MAX];
size_t mElementsTotal[LOG_ID_MAX];
+ static size_t SizesTotal;
bool enable;
// uid to size list
@@ -554,6 +555,7 @@
}
size_t sizesTotal(log_id_t id) const { return mSizesTotal[id]; }
size_t elementsTotal(log_id_t id) const { return mElementsTotal[id]; }
+ static size_t sizesTotal() { return SizesTotal; }
std::string format(uid_t uid, pid_t pid, unsigned int logMask) const;
diff --git a/logd/LogUtils.h b/logd/LogUtils.h
index d300a2a..70f24e4 100644
--- a/logd/LogUtils.h
+++ b/logd/LogUtils.h
@@ -33,7 +33,9 @@
char *uidToName(uid_t uid);
void prdebug(const char *fmt, ...) __printflike(1, 2);
-// Furnished in LogStatistics.cpp. Caller must own and free returned value
+// Furnished in LogStatistics.cpp.
+size_t sizesTotal();
+// Caller must own and free returned value
char *pidToName(pid_t pid);
char *tidToName(pid_t tid);