diff options
author | Mark Salyzyn <salyzyn@google.com> | 2014-04-04 16:35:59 -0700 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2014-04-25 10:46:27 -0700 |
commit | c8a576c637ae00577273b778498019dd609fcd15 (patch) | |
tree | f7a4009276e36d8068c6a41203211d4a5045b902 /logd/LogStatistics.h | |
parent | 72031ab8780ddbdfad84ea4a02ba7fe87566ee50 (diff) | |
download | system_core-c8a576c637ae00577273b778498019dd609fcd15.zip system_core-c8a576c637ae00577273b778498019dd609fcd15.tar.gz system_core-c8a576c637ae00577273b778498019dd609fcd15.tar.bz2 |
logd: Statistics improvements
- Drop in-place sorting.
- Add fast-track for uid sizes and elements.
- Add sort() for per-uid and per-pid statistics.
Change-Id: Ib8655d4cc0b3bd4e87534522987bcc7fc7a5251a
Diffstat (limited to 'logd/LogStatistics.h')
-rw-r--r-- | logd/LogStatistics.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/logd/LogStatistics.h b/logd/LogStatistics.h index 12c68d5..cd6ef7b 100644 --- a/logd/LogStatistics.h +++ b/logd/LogStatistics.h @@ -70,6 +70,9 @@ class UidStatistics { PidStatisticsCollection Pids; + size_t mSizes; + size_t mElements; + public: UidStatistics(uid_t uid); ~UidStatistics(); @@ -81,11 +84,17 @@ public: void add(unsigned short size, pid_t pid); void subtract(unsigned short size, pid_t pid); + void sort(); static const pid_t pid_all = (pid_t) -1; - size_t sizes(pid_t pid = pid_all); - size_t elements(pid_t pid = pid_all); + // fast track current value + size_t sizes() const { return mSizes; }; + size_t elements() const { return mElements; }; + + // statistical track + size_t sizes(pid_t pid); + size_t elements(pid_t pid); size_t sizesTotal(pid_t pid = pid_all); size_t elementsTotal(pid_t pid = pid_all); @@ -108,6 +117,7 @@ public: void add(unsigned short size, uid_t uid, pid_t pid); void subtract(unsigned short size, uid_t uid, pid_t pid); + void sort(); static const pid_t pid_all = (pid_t) -1; static const uid_t uid_all = (uid_t) -1; @@ -145,6 +155,7 @@ public: void add(unsigned short size, log_id_t log_id, uid_t uid, pid_t pid); void subtract(unsigned short size, log_id_t log_id, uid_t uid, pid_t pid); + void sort(); // fast track current value by id only size_t sizes(log_id_t id) const { return mSizes[id]; } |