summaryrefslogtreecommitdiffstats
path: root/logd/LogStatistics.h
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2015-04-20 13:35:15 -0700
committerMark Salyzyn <salyzyn@google.com>2015-05-13 09:23:01 -0700
commit654904f0f9c42458cae2b1931265f97f8fb6cb95 (patch)
tree9c6e749b9f0cd6ac1eaff346cf0e5fddd458235c /logd/LogStatistics.h
parent66091f11f427587bf810d89b0f64be556e1cd168 (diff)
downloadsystem_core-654904f0f9c42458cae2b1931265f97f8fb6cb95.tar.gz
system_core-654904f0f9c42458cae2b1931265f97f8fb6cb95.tar.bz2
system_core-654904f0f9c42458cae2b1931265f97f8fb6cb95.zip
logd: Add TID statistics
(cherry pick from commit 17ed6797df722464eb5cc6dfc3e1e32aec284b70) Bug: 19608965 Change-Id: Ifbf0b00c48ef12b5970b9f9f217bd1dd8f587f2c
Diffstat (limited to 'logd/LogStatistics.h')
-rw-r--r--logd/LogStatistics.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/logd/LogStatistics.h b/logd/LogStatistics.h
index d21a75bfe..f60f3edb6 100644
--- a/logd/LogStatistics.h
+++ b/logd/LogStatistics.h
@@ -209,6 +209,58 @@ struct PidEntry : public EntryBaseDropped {
}
};
+struct TidEntry : public EntryBaseDropped {
+ const pid_t tid;
+ uid_t uid;
+ char *name;
+
+ TidEntry(pid_t t):
+ EntryBaseDropped(),
+ tid(t),
+ uid(android::pidToUid(t)),
+ name(android::tidToName(tid)) { }
+ TidEntry(LogBufferElement *e):
+ EntryBaseDropped(e),
+ tid(e->getTid()),
+ uid(e->getUid()),
+ name(android::tidToName(e->getTid())) { }
+ TidEntry(const TidEntry &c):
+ EntryBaseDropped(c),
+ tid(c.tid),
+ uid(c.uid),
+ name(c.name ? strdup(c.name) : NULL) { }
+ ~TidEntry() { free(name); }
+
+ const pid_t&getKey() const { return tid; }
+ const uid_t&getUid() const { return uid; }
+ const char*getName() const { return name; }
+
+ inline void add(pid_t t) {
+ if (name && !strncmp(name, "zygote", 6)) {
+ free(name);
+ name = NULL;
+ }
+ if (!name) {
+ char *n = android::tidToName(t);
+ if (n) {
+ name = n;
+ }
+ }
+ }
+
+ inline void add(LogBufferElement *e) {
+ uid_t u = e->getUid();
+ if (getUid() != u) {
+ uid = u;
+ free(name);
+ name = android::tidToName(e->getTid());
+ } else {
+ add(e->getTid());
+ }
+ EntryBaseDropped::add(e);
+ }
+};
+
struct TagEntry : public EntryBase {
const uint32_t tag;
uid_t uid;
@@ -247,6 +299,10 @@ class LogStatistics {
typedef LogHashtable<pid_t, PidEntry> pidTable_t;
pidTable_t pidTable;
+ // tid to uid list
+ typedef LogHashtable<pid_t, TidEntry> tidTable_t;
+ tidTable_t tidTable;
+
// tag list
typedef LogHashtable<uint32_t, TagEntry> tagTable_t;
tagTable_t tagTable;