diff --git a/logd/LogStatistics.cpp b/logd/LogStatistics.cpp index ddbb64fb1..6e63015ac 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 @@ LogStatistics::LogStatistics() : enable(false) { 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 @@ void LogStatistics::add(LogBufferElement *element) { // 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 8bf655b01..613771c8b 100644 --- a/logd/LogStatistics.h +++ b/logd/LogStatistics.h @@ -472,6 +472,7 @@ class LogStatistics { 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 @@ public: } 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 d300a2a43..70f24e4d9 100644 --- a/logd/LogUtils.h +++ b/logd/LogUtils.h @@ -33,7 +33,9 @@ namespace android { 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);