logd: Add Pid statistics
- Optional class of statistics for PID
- Enhance pidToName
- Enhanced uidToName
- Enhance pidToUid
- template sort and iteration
Bug: 19608965
Change-Id: I04a1f02e9851b62987f9b176908134e455f22d1d
diff --git a/logd/LogBuffer.cpp b/logd/LogBuffer.cpp
index d11b129..a5844a3 100644
--- a/logd/LogBuffer.cpp
+++ b/logd/LogBuffer.cpp
@@ -16,7 +16,6 @@
#include <ctype.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include <sys/user.h>
#include <time.h>
@@ -281,15 +280,14 @@
size_t second_worst_sizes = 0;
if ((id != LOG_ID_CRASH) && mPrune.worstUidEnabled()) {
- const UidEntry **sorted = stats.sort(2, id);
+ std::unique_ptr<const UidEntry *[]> sorted = stats.sort(2, id);
- if (sorted) {
+ if (sorted.get()) {
if (sorted[0] && sorted[1]) {
worst = sorted[0]->getKey();
worst_sizes = sorted[0]->getSizes();
second_worst_sizes = sorted[1]->getSizes();
}
- delete [] sorted;
}
}