summaryrefslogtreecommitdiffstats
path: root/logd/LogStatistics.cpp
Commit message (Collapse)AuthorAgeFilesLines
* logd: optimize code hotspotsMark Salyzyn2015-11-011-2/+2
| | | | | | | | | | | Discovered that we had a few libc hotspots. Adjust code to generally reduce or nullify the number of calls to malloc, free, strlen, strcmp, strncmp, memcmp & strncasecmp. Total gain looks to be about 3% of logd's processing time. malloc still contributes to 3%, but all others are now total 0.5%. Bug: 23685592 Change-Id: Ife721121667969260cdb8b055524ae90f5911278
* logd: switch to unordered_map from BasicHashtableMark Salyzyn2015-06-041-5/+4
| | | | | | | | | | | | (charry pick from commit 511338dd575572d567c04d69eaea60627b6c3452) BasicHashtable is relatively untested, move over to a C++ template library that has more bake time. Bug: 20419786 Bug: 21590652 Bug: 20500228 Change-Id: I926aaecdc8345eca75c08fdd561b0473504c5d95
* logd: Add TID statisticsMark Salyzyn2015-05-131-0/+60
| | | | | | | (cherry pick from commit 17ed6797df722464eb5cc6dfc3e1e32aec284b70) Bug: 19608965 Change-Id: Ifbf0b00c48ef12b5970b9f9f217bd1dd8f587f2c
* logd: CleanupMark Salyzyn2015-05-131-2/+1
| | | | | | | | | (cherry pick from commit 7718778793b106498b931dd708a466cf3a6f6a0f) - Android Coding Standard for Constructors - Side effects NONE Change-Id: I2cda9dd73f3ac3ab58f394015cb810820093d47b
* logd: Add klogdMark Salyzyn2015-05-131-4/+12
| | | | | | | | | | | | | | | | | | (cherry pick from commit ae4d928d816e30dbe57c2c321b0f0759d0567b3f) - Add a klogd to collect the kernel logs and place them into a new kernel log buffer - Parse priority, tag and message from the kernel log messages. - Turn off pruning for worst UID for the kernel log buffer - Sniff for 'PM: suspend exit', 'PM: suspend enter' and 'Suspended for' messages and correct the internal definition time correction against monotonic dynamically. - Discern if we have monotonic or real time (delineation 1980) in audit messages. - perform appropriate math to correct the timestamp to be real time - filter out any external sources of kernel logging Change-Id: I8d4c7c5ac19f1f3218079ee3a05a50e2ca55f60d
* logd: Add Tag statisticsMark Salyzyn2015-05-121-0/+55
| | | | | | | | | | | | | (cherry pick from commit 344bff4391dd434dda501e812f18f524290c5a7c) - Optional class of statistics for events Tags - export tagToName from LogBuffer (located in main.cp to address https://android-review.googlesource.com/#/c/110204) - Can not handle dropped because getTag() can not work, will need to be fixed if we start filtering. Bug: 19608965 Change-Id: I7b90607ca588bf37bab71f19b1570a290e772776
* logd: uidToName add dex2oat UIDMark Salyzyn2015-05-121-2/+7
| | | | | | | | | | | (cherry pick from commit 023f51f360472f6bb9bad495e55cdb32b5411bc5) - When searching for uidToName from /data/system/packages.list one must search for the uid % AID_USER; - If uid % AID_USER is greater than AID_SHARED_GID_START - AID_APP, then subract it and try again to pick up uidToName. Change-Id: I24df42957ff7e746fffa5d39484637b1b726b9c0
* logd: class hierarcy for Uid and Pid statistics.Mark Salyzyn2015-05-071-113/+12
| | | | | | | | | | | | | | (Cherry pick from commit 81b3eabc49736b89c4f99940f79785074955eaa5) Add EntryBase and EntryBaseDropped base classes for statistical entries to inherit from. Abstract add(), subtract() and drop() methods to common LogBufferElement in each for entry policy decisions. Some move of details out of LogStatistics.cpp and place them into LogStatistics.h. Add statistical add(), subtract() and drop() methods to hash table to call entries for policy. Bug: 19608965 Change-Id: Ib8a33a8fe28871ef165d1632c6546a5c606231e8
* logd: improve details on chatty recordsMark Salyzyn2015-04-301-1/+1
| | | | | | | | | | | | | (Cherry pick from commit 21fb7e0b753b2251369bfaa1c6f6a09e58e64437) - Report applications UID, TID/PID by name. - change wording to have an accurate connotation - drop privilege check since filtered upstream Bug: 19608965 Bug: 20334069 Bug: 20370119 Change-Id: I2b1c26580b4c2de293874214ff5ae745546f3cca
* logd: Statistics headersMark Salyzyn2015-04-211-8/+25
| | | | | | Answer to the question "Bytes or Lines?" Change-Id: I352737265aeac63ea8d89e778d4222a9123bdf07
* Merge "logd: syscall optimization"Mark Salyzyn2015-04-151-1/+1
|\
| * logd: syscall optimizationMark Salyzyn2015-04-011-1/+1
| | | | | | | | | | | | | | - prset(PR_SET_NAME) call once - No need to call getuid(), should be AID_LOGD Change-Id: I4dde0b178bc84e711b355cd7677b0dbf905a0634
* | logd: pidToUid incorrectMark Salyzyn2015-04-141-1/+1
| | | | | | | | Change-Id: I9b0e655780924db125568179771e57b01e80aaae
* | logd: disable worst uid prune for events bufferMark Salyzyn2015-04-101-1/+1
| | | | | | | | | | | | | | | | | | | | There is some usage statistics that would be hurt by pruning by UID, since _all_ usage statistics come from system_server. In other words we expect it to be chatty. Until we formulate and evaluate a better (eg: per-tag?) filtration mechanism, lets hold off pruning by UID. Bug: 19608965 Change-Id: Iddd45a671e13bdcf3394c20919ad1f2e4ef36616
* | logd: annotate worst-UID pruned entriesMark Salyzyn2015-04-101-14/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - internal dropped entries are associated by prune by worst UID and are applied by UID and by PID - track dropped entries by rewriting them in place - merge similar dropped entries together for same UID(implied), PID and TID so that blame can more clearly be placed - allow aging of dropped entries by the general backgound pruning - report individual dropped entries formatted to reader - add statistics to track dropped entries by UID, the combination of statistics and dropped logging can track over-the-top Chattiest clients. Bug: 19608965 Change-Id: Ibc68480df0c69c55703270cd70c6b26aea165853
* | logd: Build BreakageMark Salyzyn2015-04-081-2/+1
| | | | | | | | | | | | a change slipped in from a rebase conflict, repairing. Change-Id: Ib6479f88fb044f37b6721035c2f7cc75577c0411
* | logd: uidToName improvementMark Salyzyn2015-04-081-1/+5
| | | | | | | | | | | | | | | | - read packages.list to acquire package names - hijack the reinit handler as a privileged worker Bug: 19608965 Change-Id: If7becb34354d6415e5c387ecea7d4109a15259c9
* | logd: Add Pid statisticsMark Salyzyn2015-04-081-50/+166
|/ | | | | | | | | | | - Optional class of statistics for PID - Enhance pidToName - Enhanced uidToName - Enhance pidToUid - template sort and iteration Bug: 19608965 Change-Id: I04a1f02e9851b62987f9b176908134e455f22d1d
* logd: statistics: missing commaMark Salyzyn2015-03-201-1/+1
| | | | | | regression from statistics rewrite series resulted in build breakage Change-Id: I71b532b23437b9b5f3af47b18c9110f3d7dda48a
* logd: optimize statisticsMark Salyzyn2015-03-201-700/+164
| | | | | | | | | - Go back to basic requirements - Simplify - use hash tables to minimize memory impact Bug: 19608965 Change-Id: If7becb34354d6415e5c387ecea7d4109a15259c8
* Revert "logd: Add minimum time bucket statistics"Mark Salyzyn2015-03-041-109/+0
| | | | | | | | | | | | | This forward port reverts commit e457b74ce6ee6d799812dc2ec5e4b8b18bcd3e91 No longer as necessary once we add liblog: Instrument logging of logd write drops Although this provided an indication of how close statistically we were to overloading logd it is simpler to understand fails thus to hunt and peck a corrected value for /proc/sys/net/unix/max_dgram_qlen Change-Id: I2b30e0fc30625a48fd11a12c2d2cc6a41f26226f
* Add missing <malloc.h> and <string.h> includes.Elliott Hughes2015-01-281-0/+1
| | | | Change-Id: Ia41756e607663d056e7d2fdd7ecbec7e5841a913
* logd: LogStatistics leakMark Salyzyn2014-10-061-0/+4
| | | | | | - uid = -1 in subtract operation to match add Change-Id: I7d0b85b5334c5264fd04309cb78e0c9aec0ad261
* logd: kill(0,0) issueMark Salyzyn2014-10-061-1/+6
| | | | | | | | - Recognize pid=0 as special case (kernel or pre-init sourced) and refrain from treating it in the general case. Bug: 17526159 Change-Id: I74796043ac34753c6dd10018719ebc0bcd94e012
* logd: Add control statistics enable/disable.Mark Salyzyn2014-10-061-14/+24
| | | | | | | | | | - ro.build.type=user turn off statistics - ro.config.low_ram=true turn off statistics - logd.statistics override Bug: 17526159 Bug: 17526187 Change-Id: I74796043ac34753c6dd10018719ebc0bcd94e00f
* logd: cleanupMark Salyzyn2014-10-061-31/+31
| | | | | | | | | | | - simplify access and control exposure to class list - indent - compile warning - Follow standard naming convention for variables and methods - merge common fragments - Side Effects: none Change-Id: I74796043ac34753c6dd10018719ebc0bcd94e010
* logd: fix format-extra-args warning.Chih-Hung Hsieh2014-09-121-8/+14
| | | | Bug: 17409250 Change-Id: Id50ebb57754b12d69ed605d0e2901b8e05c607c6
* Fix for parenthesis errorArseniy Antonov2014-09-031-1/+1
| | | | | | | | Added parentheses as it was suggested by compiler. error: suggest parentheses around operand of '!' or change '&' to '&&' or '!' to '~' [-Werror=parentheses] Change-Id: Ic3746d9804488411d10d460ddfda11f1fad8efef Signed-off-by: Arseniy Antonov <arseniy.antonov@intel.com>
* logd: 64-bit compile issueMark Salyzyn2014-05-021-3/+3
| | | | | | | - ULONG_MAX is used against an uint32 - Add tv_sec_max and tv_nsec_max constants to log_time Change-Id: Ic86cd7b0680868ad0536198b71a34cb19134fc22
* logd: oneline statistics does not report PID goneMark Salyzyn2014-05-011-10/+26
| | | | | | | - oneline, add check for gone - Add pidGone() method, which caches the gone status Change-Id: I8f03daeafb58583c2b08ec6b540486c05da0872d
* logd: Statistics improvementsMark Salyzyn2014-04-251-25/+87
| | | | | | | | - Drop in-place sorting. - Add fast-track for uid sizes and elements. - Add sort() for per-uid and per-pid statistics. Change-Id: Ib8655d4cc0b3bd4e87534522987bcc7fc7a5251a
* logd: Statistics: Add up to 10 chattiest clientsMark Salyzyn2014-04-101-7/+108
| | | | | | | | | - embellish pid name - >1% of the logs - fix PID gone detection (EPERM) - some ? : cleanup Change-Id: Iba3b306e1fee43e53931165819a398693910514b
* Merge "logd: fix LogStatistics::format freeing wrong pointer"Greg Hackmann2014-04-071-1/+1
|\
| * logd: fix LogStatistics::format freeing wrong pointerGreg Hackmann2014-04-071-1/+1
| | | | | | | | | | | | | | | | Fixes a leak and use-after-free if a client passes in an already-allocated target buffer (currently none do) Change-Id: Ie20c30bd5ba31e1b6db73885bd9d2ebd7e40dc27 Signed-off-by: Greg Hackmann <ghackmann@google.com>
* | logd: Add pidToUid helperMark Salyzyn2014-04-071-0/+17
| | | | | | | | Change-Id: I23ebae1957c027bff6cbc2573a227bf0c44c08a2
* | logd: Add pidToName helperMark Salyzyn2014-04-071-5/+50
|/ | | | Change-Id: Idd8e804ab65feb8dc432150ae701464de1ad5302
* logd: Add minimum time bucket statisticsMark Salyzyn2014-04-011-3/+133
| | | | | | | | | | * Only enabled for dev builds because halves performance. - Used to establish if /proc/sys/net/unix/max_dgram_qlen is appropriate for the platform (see logd/LogStatistics.cpp comments) - enabled if logd.dgram_qlen.statistics is not zero/empty Change-Id: Ib8ecfeb75b6f0f954c099a6b1032b8afb5efcbd4
* logd: liblog: logcat: Add LogWhiteBlackListMark Salyzyn2014-03-131-18/+3
| | | | | | | | | | | | | | | - liblog android_logger_get_log_size and android_logger_get_readable_size adjusted to return long instead of int because of -G flag extending range NB: ifdef'd only for userdebug and eng builds - liblog Add android_logger_[sg]et_prune_list and android_logger_set_log_size - logcat Add -P, -p and -G flags - logd Add LogWhiteBlackList and configurable log size (cherry picked from commit 18a5432158ad43b8faefe4950b30e760200ce0b4) Change-Id: I1572338c1b34bd968ad7867857ef708156ec3b6a
* logd: liblog: logcat: Add StatisticsMark Salyzyn2014-03-131-0/+570
- logd add statistical collection and formatting - liblog add android_logger_get_statistics call - logcat add -S flag - logcat add -b all (cherry picked from commit 51a29c8dc445e4fb89860561933e54a231e6ffb4) Change-Id: I521753b1969ecd4590c956aeeb1557d101059d67