History log of /system/core/logd/LogStatistics.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c4e4823b00a94627e922eada1172688818471b0c 04-May-2017 Mark Salyzyn <salyzyn@google.com> logd: validate and fill in socket credentials

- android::pidToUid() additional checking. Make sure if we have to
convert a PID to an UID that the parse of /proc/<pid>/status
requires a trailing space after the number
- android::tidToPid() added, in the same vein as android::pidToUid().
- stats.tidToPid() added
- If no credentials, set PID to 0 and UID to DEFAULT_OVERFLOWUID
- If credentialed PID is 0, use stats.tidToPid()
- If credentialed UID is DEFAULT_OVERFLOWUID, use stats.pidToUid()

Test: remove +passcred from logd.rc for daemon and confirm very few
UID=65534 or PID=0 cases actually show up
Bug: 37985222
Change-Id: I7d20506e70e67beb3043d1537cf9450ab58dc278
/system/core/logd/LogStatistics.cpp
f99a7d602a6fe90058e47d5e6140dfc9b30f7481 19-Apr-2017 Mark Salyzyn <salyzyn@google.com> logd: add Chattiest LOG_TAG statistics

Report global LOG_TAG usage.

Switch NULL to nullptr and use const more accurately.

Test: gTest liblog-unit-tests, logd-unit-tests & logcat-unit-tests
Test: manual: inspect logcat -S results around 'Chattiest TAGs'
Test: logcat -b all -c ; logcat -b all -S ; then confirm clear
Bug: 37254265
Change-Id: I3696c0d8da3ba24f99f670aafba1e45f8cb3ab14
/system/core/logd/LogStatistics.cpp
afd7e70553a32f00ef2c880c04af466d16682518 24-Apr-2017 Mark Salyzyn <salyzyn@google.com> Revert "logd: add Chattiest LOG_TAG statistics"

This reverts commit 903156ddaaad85f89210d809dddc17a9000342a4.

Test: compile
Bug: 37254265
Change-Id: If9af79684119861ceecf4f88a4a4c84f991b188a
/system/core/logd/LogStatistics.cpp
903156ddaaad85f89210d809dddc17a9000342a4 19-Apr-2017 Mark Salyzyn <salyzyn@google.com> logd: add Chattiest LOG_TAG statistics

Report global LOG_TAG usage.

Test: gTest liblog-unit-tests, logd-unit-tests & logcat-unit-tests
Test: manual: inspect logcat -S results around 'Chattiest TAGs'
Bug: 37254265
Change-Id: I32473a1d9131c87e4fb7841d5cc0ea9cc14c63cd
/system/core/logd/LogStatistics.cpp
3c501b50b41086cde59a6811f4aa5cd3e736f5f2 18-Apr-2017 Mark Salyzyn <salyzyn@google.com> logd: reader/writer element locks

Switch to a reader writer lock for the Element List lock. Also setup
for a reader writer lock for the Times list, but continue to use a
mutex where rdlock() and wrlock() are the same implementation for now.

This should improve general reader performance and prevent blocking of
other reader operations or exit by a single hung logd.reader.per
thread. For example, a full length logcat of an empty buffer (eg:
crash log buffer) will hold a lock while the iterator scans the entire
list.

Test: gTest liblog-unit-tests, logd-unit-tests, logcat-unit-tests
Bug: 37378309
Bug: 37483775
Change-Id: If5723ff4a978e17d828a75321e8f0ba91d4a09e0
/system/core/logd/LogStatistics.cpp
03bb7593e40e8f56d7c5f021bab579674fcc5c8c 14-Apr-2017 Mark Salyzyn <salyzyn@google.com> logd: statistics add logspan

Logspan down to the millisecond. Show a percentage if trimmed by
Chatty messages, a subspan from the newest to the newest chatty in
the log buffer. Sniff stats.add(elem), stats.subtract(elem) and
stats.dropped(elem) to generate the logspan data.

Test: gTest liblog-unit-tests, logd-unit-tests and logcat-unit-tests
Test: manual check Logspan statistics for being in range, added
temporary internal instrumentation to confirm expectations.
Bug: 37254265
Change-Id: I09c0d9375d5580315543c747b37976f9eeb9e408
/system/core/logd/LogStatistics.cpp
02dd2f42f8713b09ed0526e4eb49812957b66d5e 14-Apr-2017 Mark Salyzyn <salyzyn@google.com> logd: replace stats.add+stats.subtract with stats.addTotal

Replace stats.add(elem) + stats.subtract(elem) with a new more
efficient method stats.addTotal(elem).

Test: gTest liblog-unit-test, logd-unit-tests and logcat-unit-tests
Bug: 37254265
Change-Id: I2b3c2ac44209772b38f383ae46fe6c4422b542cf
/system/core/logd/LogStatistics.cpp
f31ae3d666f6e723a7dde6734c6d8395f8bcdc11 14-Apr-2017 Mark Salyzyn <salyzyn@google.com> logd: statistics truncate name

Prefix long truncated names with an ellipse (...). Shift left as
much as possible when doing so, but keep spaces between command
name and other tabular fields.

Test: manual/visual
Bug: 37254265
Change-Id: I185b1e121ba911a9410a8b6624e013d5a531962b
/system/core/logd/LogStatistics.cpp
501c373916e292764400dbae735f44b33378400f 10-Mar-2017 Mark Salyzyn <salyzyn@google.com> logd: specify clang format

Switch _all_ file's coding style to match to ease all future changes.

SideEffects: None
Test: compile
Bug: 35373582
Change-Id: I470cb17f64fa48f14aafc02f574e296bffe3a3f3
/system/core/logd/LogStatistics.cpp
61e9ce6709a12cf39a9471476da3d50339efe466 12-Sep-2016 Mark Salyzyn <salyzyn@google.com> logd: add getEventTag command and service

Will register a new event tag by name and format, and return an
event-log-tags format response with the newly allocated tag.
If format is not specified, then nothing will be recorded, but
a pre-existing named entry will be listed. If name and format are
not specified, list all dynamic entries. If name=* list all
event log tag entries.

Stickiness through logd crash will be managed with the tmpfs file
/dev/event-log-tags and through a reboot with add_tag entries in
the pmsg last logcat event log. On debug builds we retain a
/data/misc/logd/event-log-tags file that aids stickiness and that
can be picked up by the bugreport.

If we detect truncation damage to /dev/event-log-tags, or to
/data/misc/logd/event-log-tags, rebuild file with a new first line
signature incorporating the time so mmap'd readers of the file can
detect the possible change in shape and order.

Manual testing:

Make sure nc (netcat) is built for the target platform on the host:
$ m nc

Then the following can be used to issue a request on the platform:
$ echo -n 'getEventTag name=<name> format="<format>"\0EXIT\0' |
> nc -U /dev/socket/logd

Test: gTest logd-unit-test --gtest_filter=getEventTag*
Bug: 31456426
Change-Id: I5dacc5f84a24d52dae09cca5ee1a3a9f9207f06d
/system/core/logd/LogStatistics.cpp
1fa079b2555a12a53a6d25956d4f371ace60edce 20-Dec-2016 Treehugger Robot <treehugger-gerrit@google.com> Merge "Revert "logd: trailing spaces in log statistics""
d966e226809bd446bb33651b71d7934887787c1d 19-Dec-2016 Mark Salyzyn <salyzyn@google.com> Revert "logd: trailing spaces in log statistics"

Caused +/- field data to land under the Pruned column

This reverts commit 0adcc3e3e8bd6d7c57994f828ee22c104b4eb043.

Test: manual
Bug: 30118730
Change-Id: Ic75ce3a90baded19f3efc0cc77474fe5d9a8accd
/system/core/logd/LogStatistics.cpp
3296291cffd13af13ea9e60a8ac1138101cf8e4c 12-Sep-2016 Mark Salyzyn <salyzyn@google.com> logd: add android::sizesTotal() function

Test: gTest liblog-unit-tests, logd-unit-tests and logcat-unit-tests
Bug: 31456426
Change-Id: I6fb6cd589227fc43d22f9336e01f1bf7e3feb24c
/system/core/logd/LogStatistics.cpp
a2c022257c5bed56fbc47de25c5d909bbe880f7b 13-Dec-2016 Mark Salyzyn <salyzyn@google.com> logd: record multiple duplicate messages as chatty

If a series of messages arrive from a single source with identical
message content payload, then suppress them and generate a chatty
report. The checking is done on a per log id basis.

This alters the assumption that chatty messages are always at the
oldest entries, they now show up in the middle too. To address this
change in behavior we print the first line, a chatty reference
which internally takes little space, then the last line in the series.

This does not conserve processing time in logd, and certainly has no
impact on the long path of formatting and submitting log messages from
from the source, but it may contribute to memory space and signal to
noise savings under heavy spammy loads.

Test: gTest liblog-unit-tests, logd-unit-tests & logcat-unit-tests
Bug: 33535908
Change-Id: I3160c36d4f4e2f8216f528605a1b3993173f4dec
/system/core/logd/LogStatistics.cpp
dff44709cf462a3af7eb5770c90e3ada492295b7 13-Dec-2016 Jeff Sharkey <jsharkey@android.com> Define range of GIDs for cached app data.

To support upcoming disk usage calculation optimizations, this change
creates a new GID for each app that will be used to mark its cached
data. We're allocating these unique GIDs so that we can use
quotactl() to track cached data on a per-app basis.

This change also tightens up the implementation of both the cache
and shared GID calculation to ensure that they stay inside the valid
ranges, and includes tests to verify.

Test: builds, boots, tests pass
Bug: 27948817
Change-Id: Ie4377e5aae267f2da39a165888139228995987cb
/system/core/logd/LogStatistics.cpp
0eeb06b932f185e10377e4494475d2cdd6adfa1b 02-Dec-2016 Mark Salyzyn <salyzyn@google.com> utils: Add FastStrcmp.h

Move existing fast<str*cmp> templates for general use, pulled from
the implementation used in logd that dealt with speed through cache
locality and subroutine call mitigation. Rename to fastcmp.

Test: logd-benchmarks and based on manual profiling from the past
Bug: 31456426
Change-Id: Ic62f4a437fc3e06ffdeaae73a6f34e197957a6b0
/system/core/logd/LogStatistics.cpp
6d981af12023bcaf22bfa0612a85ae4580ecb971 06-Oct-2016 Mark Salyzyn <salyzyn@google.com> logd: report statistics memory overhead

Add in to the Total Overhead the amount of storage we are
using to hold on to the statistics.

Test: see that the Total Overhead accounts for about 100K
Bug: 31942525
Change-Id: Ibe241c0bccc5a9df52395802338c8a7fc3b64104
/system/core/logd/LogStatistics.cpp
aeaaf81c2cc8366ac4f66eb3d2fc85f9b8194982 30-Sep-2016 Mark Salyzyn <salyzyn@google.com> liblog: logd: logcat: Split out log/logger.h into public and private.

log/logger.h pieces moved into log/log.h. Correct for some
minor Android Coding standards.

Test: gTests liblog-unit-tests, logd-unit-tests and logcat-unit-tests
Bug: 19235719
Bug: 26552300
Bug: 31289077
Bug: 31456426
Change-Id: I0a19fd8788eec20a582e72e4c62c04534bdb1b9a
/system/core/logd/LogStatistics.cpp
9af33ee78c395af715e7b861f4e32272559e1fe9 05-Oct-2016 Mark Salyzyn <salyzyn@google.com> logd: report logging memory overhead

On 64 bit system, calculates to roughly 80 bytes of metadata and
list overhead for each entry.

In unit test example, we report 3388987 bytes of logging data and
overhead total, showmap reports 4652K of dirty data. We still want
to account for the remainder (fragmentation, other sources of
internal allocations etc).

Test: see values and check math
Bug: 31942525
Change-Id: I75f3162ce691faf1ae5a5dec18939fea535ede7e
/system/core/logd/LogStatistics.cpp
807e40ecc9786755e2f74a7a6a9b20c812588119 22-Sep-2016 Mark Salyzyn <salyzyn@google.com> liblog: logd: Add android_lookupEventTag_len()

Allows us to mitigate the impact of MAP_PRIVATE and copy on write by
calling android_lookupEventTag_len instead of android_lookupEventTag,
and delaying the copy on write impact to the later. We return a
string length in a supplied location along with the string pointer
with android_lookupEventTag_len(const EventTagMap* map, size_t* len,
int tag). The string is not guaranteed to be nul terminated. Since
android_lookupEventTag() called even once can cause the memory
impact, we will mark it as deprecated, but we currently have no
timeframe for removal since this is a very old interface.

Add an API for __android_log_is_loggable_len() that accepts the non
null terminated content and fixup callers that would gain because the
length is known prior to the call either in the compiler or at
runtime. Tackle transition to android_lookupEventTag_len() and
fixup callers.

On any application that performs logging (eg: com.android.phone)

/proc/<pid>/smaps before:

xxxxxxxxxx-xxxxxxxxxx rw-p 00000000 fd:00 463 /system/etc/event-log-tags
Size: 20 kB
Rss: 20 kB
Pss: 1 kB
Shared_Clean: 0 kB
Shared_Dirty: 20 kB
Private_Clean: 0 kB
Private_Dirty: 0 kB
Referenced: 0 kB
Anonymous: 20 kB
AnonHugePages: 0 kB
Swap: 0 kB
SwapPss: 0 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Locked: 0 kB
VmFlags: rd wr mr mw me ac

/proc/<pid>/smaps after:

xxxxxxxxxx-xxxxxxxxxx rw-p 00000000 fd:00 1773 /system/etc/event-log-tags
Size: 20 kB
Rss: 20 kB
Pss: 1 kB
Shared_Clean: 20 kB (was 0kB)
Shared_Dirty: 0 kB (was 20kB)
Private_Clean: 0 kB
Private_Dirty: 0 kB
Referenced: 20 kB (was 0kB)
Anonymous: 0 kB (was 20kB)
AnonHugePages: 0 kB
Swap: 0 kB
SwapPss: 0 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Locked: 0 kB
VmFlags: rd wr mr mw me ac

Added liblog-unit-tests --gtest_filter=liblog.event_log_tags to
check for Shared_Clean: to not be 0 and Anonymous: to be 0 for
all processes referencing event-log-tags. Which can include multiple
references to /system/etc/event-log-tags and future possible refs to
/data/misc/logd/event-log-tags and /dev/event-log-tags. We want
failure messages to help point to errant code using the deprecated
interface.

This change saves 1/4MB of memory or more on a typical system.

Test: gTest liblog-unit-tests
Bug: 31456426
Change-Id: I9e08e44d9092bd96fe704b5709242e7195281d33
/system/core/logd/LogStatistics.cpp
6a06694a610d103afdf424b0bb69dc8f7f2b8e5a 15-Jul-2016 Mark Salyzyn <salyzyn@google.com> logd: Worst Tag filter enabled for events buffer

- Add drop logistics to TagTable
- replace uid references to a key reference since it
is an UID for most buffers, but a TAG for the
events and security buffer
- template the find worst entry mechanics into LogFindWorst class

Bug: 30118730
Change-Id: Ibea4be2c50d6ff4b39039e371365fed2453f17a2
/system/core/logd/LogStatistics.cpp
0adcc3e3e8bd6d7c57994f828ee22c104b4eb043 15-Jul-2016 Mark Salyzyn <salyzyn@google.com> logd: trailing spaces in log statistics

Bug: 30118730
Change-Id: I8cccbc1da2cf8168ec9cf12f07df4cafef076558
/system/core/logd/LogStatistics.cpp
b8a95bd3c9502d48b203b9f1e5df9b84a5df6281 07-Apr-2016 Mark Salyzyn <salyzyn@google.com> logd: switch from android_ids to getpwuid

Bug: 27999086
Change-Id: I7f4e68b21f58789b4dcada04f9c27f5722940c02
/system/core/logd/LogStatistics.cpp
bec3c3def945576d59d3344c16e149e6d9154e15 28-Aug-2015 Mark Salyzyn <salyzyn@google.com> logd: Add worst pid of system filter

- Add a new statistic that reports per pid and log_id for AID_SYSTEM
- Add a new pruning filter ~1000/! boolean
- Use this new statistic to prune on worst pid within AID_SYSTEM

Bug: 26029733
Bug: 21615139
Bug: 22855208
Change-Id: Iab5dd28f807dcf03d276372853883f3b6afa8294
/system/core/logd/LogStatistics.cpp
ee3b838e13dc2140ac2051c1012d471effd0fd5f 17-Dec-2015 Mark Salyzyn <salyzyn@google.com> logd: statistics per-pid filter

Primarily gives access to the Chattiest TIDs and TAGs
associated with a pid.

Has a secondary effect of allowing us to pull out the
command line, comm and in some cases the associated
PACKAGE for a specific pid while the logs are still
present even if the executable is gone.

Bug: 26029733
Bug: 21615139
Change-Id: I1ea63165a680a9318360579b70b1512078ed5682
/system/core/logd/LogStatistics.cpp
083b037c0740ca00f72429e4457bfdd4b4d4dfa7 04-Dec-2015 Mark Salyzyn <salyzyn@google.com> logd: liblog: logcat: Add LOG_ID_SECURITY

- Largish commit, buffer and access controls done together
- Add LOG_ID_SECURITY binary content log
- Add "default" meta buffer
- allow LOG_ID_SECURITY only from AID_SYSTEM and AID_ROOT UID & GID
- Use __android_log_security() to gate logging
- Add __android_log_security_bwrite() native access to security
logging.
- Add liblog.__security_buffer end-to-end gTest

Bug: 26029733
Change-Id: Ibcf5b4660c17c1aa6902c0d93f8ffd29c93d9a93
/system/core/logd/LogStatistics.cpp
c723df805a1a3199577cac947cebf2ab53abdb34 24-Aug-2015 Mark Salyzyn <salyzyn@google.com> logd: statistics report chatty effective percentage

Report the ESTIMATED instantaneous percentage decrease or increase
that an UID has to the logs as a result of the chatty filtration.

Bug: 22855208
Change-Id: If1e77afb81a2739a72b39bc7c57071763c1d64d8
/system/core/logd/LogStatistics.cpp
58b8be8906f903ac3d83c41bcb0fb9c7841945f0 30-Sep-2015 Mark Salyzyn <salyzyn@google.com> logd: correct for number of elements in prune

Chatty logs would distort the average log size by elevating the
elements, but not the size. Add statistical collection for the
number of elements that report chatty, and subtract that from
the number of elements to improve the pruning estimate. Pick
minElements as 1% rather than 10% of the total with this more
accurate number of elements, to a minumum of 4.

Bug: 24511000
Change-Id: I3f36558138aa0b2a50e4fac6440c3a8505d95276
/system/core/logd/LogStatistics.cpp
758058ffd8820df71c27db7675c50a90a5fa02b4 22-Aug-2015 Mark Salyzyn <salyzyn@google.com> logd: object layer format statistics

Simplify table generation by placing the line and header formatting
into each type's (UID, PID, TID) object. Switch to const return
values for the ownership passing functions (*ToName() functions
and methods). Use longer variable names to reduce confusion.

Switch from LINES To NUM for pruned column as that more accurately
reflects what is dropped since one entry can contain several lines.

Bug: 22855208
Change-Id: Ib110dce98a68cf5f844eb30f8a192a1f691eeba2
/system/core/logd/LogStatistics.cpp
ddda212faa81d62f637926680cd8163345120f71 02-Oct-2015 Mark Salyzyn <salyzyn@google.com> logd: optimize code hotspots

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
/system/core/logd/LogStatistics.cpp
73160acc5cb5236b30327569e6b51dbfe73e4a0f 20-Aug-2015 Mark Salyzyn <salyzyn@google.com> logd: switch asprintf to std::string

Bug: 23350706
Change-Id: I715cdd4563a09de3680081947a3439f0cac623be
/system/core/logd/LogStatistics.cpp
decbcd9c418a4d076965971e74fd51fab497414b 20-Aug-2015 Mark Salyzyn <salyzyn@google.com> logd: statistics switch to std::string

Bug: 23350706
Change-Id: I5564898c4f67b8fcc43cee64604855f789409482
/system/core/logd/LogStatistics.cpp
511338dd575572d567c04d69eaea60627b6c3452 19-May-2015 Mark Salyzyn <salyzyn@google.com> logd: switch to unordered_map from BasicHashtable

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
/system/core/logd/LogStatistics.cpp
d1371a8b8b55352e19332ba87f4b3ece6db58e1f 13-May-2015 Mark Salyzyn <salyzyn@google.com> Merge "logd: Add TID statistics"
7718778793b106498b931dd708a466cf3a6f6a0f 13-May-2015 Mark Salyzyn <salyzyn@google.com> logd: Cleanup

- Android Coding Standard for Constructors
- Side effects NONE

Change-Id: I2cda9dd73f3ac3ab58f394015cb810820093d47b
/system/core/logd/LogStatistics.cpp
ae4d928d816e30dbe57c2c321b0f0759d0567b3f 15-Oct-2014 Mark Salyzyn <salyzyn@google.com> logd: Add klogd

- 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
/system/core/logd/LogStatistics.cpp
17ed6797df722464eb5cc6dfc3e1e32aec284b70 20-Apr-2015 Mark Salyzyn <salyzyn@google.com> logd: Add TID statistics

Bug: 19608965
Change-Id: Ifbf0b00c48ef12b5970b9f9f217bd1dd8f587f2c
/system/core/logd/LogStatistics.cpp
344bff4391dd434dda501e812f18f524290c5a7c 13-Apr-2015 Mark Salyzyn <salyzyn@google.com> logd: Add Tag statistics

- 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
/system/core/logd/LogStatistics.cpp
023f51f360472f6bb9bad495e55cdb32b5411bc5 29-Apr-2015 Mark Salyzyn <salyzyn@google.com> logd: uidToName add dex2oat UID

- 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
/system/core/logd/LogStatistics.cpp
81b3eabc49736b89c4f99940f79785074955eaa5 13-Apr-2015 Mark Salyzyn <salyzyn@google.com> logd: class hierarcy for Uid and Pid statistics.

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
/system/core/logd/LogStatistics.cpp
5720d2c168f17afb57eefb6ed762a120a24c8ecb 21-Apr-2015 Mark Salyzyn <salyzyn@google.com> logd: Statistics headers

Answer to the question "Bytes or Lines?"

Change-Id: I352737265aeac63ea8d89e778d4222a9123bdf07
/system/core/logd/LogStatistics.cpp
56c6575da72653c3ffd79baf1b431574d6f7e1ea 15-Apr-2015 Mark Salyzyn <salyzyn@google.com> Merge "logd: syscall optimization"
c32afdf913f082235b1e66f5a57678c7f0723129 14-Apr-2015 Mark Salyzyn <salyzyn@google.com> logd: pidToUid incorrect

Change-Id: I9b0e655780924db125568179771e57b01e80aaae
/system/core/logd/LogStatistics.cpp
ae769238391f7f9fa5c03a436d5f1fd73130e6bd 18-Mar-2015 Mark Salyzyn <salyzyn@google.com> logd: disable worst uid prune for events buffer

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
/system/core/logd/LogStatistics.cpp
ab0dcf682867bd7e1fdebfd8d8f9fafaccfad7f6 16-Mar-2015 Mark Salyzyn <salyzyn@google.com> logd: annotate worst-UID pruned entries

- 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
/system/core/logd/LogStatistics.cpp
c6637859c224b64e899b6bcea3cc4ba303624070 09-Apr-2015 Mark Salyzyn <salyzyn@google.com> logd: Build Breakage

a change slipped in from a rebase conflict, repairing.

Change-Id: Ib6479f88fb044f37b6721035c2f7cc75577c0411
/system/core/logd/LogStatistics.cpp
08739ba71fc1f2659149be760405d622e5b68f06 16-Mar-2015 Mark Salyzyn <salyzyn@google.com> logd: uidToName improvement

- read packages.list to acquire package names
- hijack the reinit handler as a privileged worker

Bug: 19608965
Change-Id: If7becb34354d6415e5c387ecea7d4109a15259c9
/system/core/logd/LogStatistics.cpp
720f6d1d55d936d98cc9752e96f479e03e6d5009 16-Mar-2015 Mark Salyzyn <salyzyn@google.com> 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
/system/core/logd/LogStatistics.cpp
e3aeeeeccc260c29ca5907a444f8d746bcc2f8a5 17-Mar-2015 Mark Salyzyn <salyzyn@google.com> logd: syscall optimization

- prset(PR_SET_NAME) call once
- No need to call getuid(), should be AID_LOGD

Change-Id: I4dde0b178bc84e711b355cd7677b0dbf905a0634
/system/core/logd/LogStatistics.cpp
317843decf92ddf63d8110df8169c33546d587c3 20-Mar-2015 Mark Salyzyn <salyzyn@google.com> logd: statistics: missing comma

regression from statistics rewrite series resulted in build breakage

Change-Id: I71b532b23437b9b5f3af47b18c9110f3d7dda48a
/system/core/logd/LogStatistics.cpp
97c1c2beee2cbd8c67c1cd507367e5b084d853c8 10-Mar-2015 Mark Salyzyn <salyzyn@google.com> logd: optimize statistics

- Go back to basic requirements
- Simplify
- use hash tables to minimize memory impact

Bug: 19608965
Change-Id: If7becb34354d6415e5c387ecea7d4109a15259c8
/system/core/logd/LogStatistics.cpp
4ed16b4381e6723670575ff8da3cfe12fe74998a 03-Mar-2015 Mark Salyzyn <salyzyn@google.com> Revert "logd: Add minimum time bucket statistics"

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
/system/core/logd/LogStatistics.cpp
a744b05984a963966cec08758ffe582d241be9d7 28-Jan-2015 Elliott Hughes <enh@google.com> Add missing <malloc.h> and <string.h> includes.

Change-Id: Ia41756e607663d056e7d2fdd7ecbec7e5841a913
/system/core/logd/LogStatistics.cpp
f48ea7c8dcfbf2220ececccb1f4fb2f42df9048c 22-Sep-2014 Mark Salyzyn <salyzyn@google.com> logd: LogStatistics leak

- uid = -1 in subtract operation to match add

Change-Id: I7d0b85b5334c5264fd04309cb78e0c9aec0ad261
/system/core/logd/LogStatistics.cpp
df5aa61f05ccbef441cf8b024d4bbc1b717451f9 21-Sep-2014 Mark Salyzyn <salyzyn@google.com> logd: kill(0,0) issue

- 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
/system/core/logd/LogStatistics.cpp
f5fc50958978fc039bc3207cbfcb140a277442eb 21-Sep-2014 Mark Salyzyn <salyzyn@google.com> logd: Add control statistics enable/disable.

- 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
/system/core/logd/LogStatistics.cpp
e72c6e43668c8c6e1af77e2e5038557581cbf148 21-Sep-2014 Mark Salyzyn <salyzyn@google.com> logd: cleanup

- 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
/system/core/logd/LogStatistics.cpp
634118e261d2a3c6f67212f43a4ec3f075d705b6 13-Sep-2014 Chih-Hung Hsieh <chh@google.com> logd: fix format-extra-args warning.

Bug: 17409250
Change-Id: Id50ebb57754b12d69ed605d0e2901b8e05c607c6
/system/core/logd/LogStatistics.cpp
c3ce224c622e064207d1aff03f2440ca19617b4a 03-Sep-2014 Arseniy Antonov <arseniy.antonov@intel.com> Fix for parenthesis error

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>
/system/core/logd/LogStatistics.cpp
3cb54987857690fa5b73f0192cc052eb55b562f7 30-Apr-2014 Mark Salyzyn <salyzyn@google.com> logd: 64-bit compile issue

- ULONG_MAX is used against an uint32
- Add tv_sec_max and tv_nsec_max constants to log_time

Change-Id: Ic86cd7b0680868ad0536198b71a34cb19134fc22
/system/core/logd/LogStatistics.cpp
fdabe7287609af29793bb6ca15712582ba082521 21-Apr-2014 Mark Salyzyn <salyzyn@google.com> logd: oneline statistics does not report PID gone

- oneline, add check for gone
- Add pidGone() method, which caches the gone status

Change-Id: I8f03daeafb58583c2b08ec6b540486c05da0872d
/system/core/logd/LogStatistics.cpp
c8a576c637ae00577273b778498019dd609fcd15 05-Apr-2014 Mark Salyzyn <salyzyn@google.com> 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
/system/core/logd/LogStatistics.cpp
8e72c5384b288bc11af60e12686a44e502633e3d 26-Mar-2014 Mark Salyzyn <salyzyn@google.com> logd: Statistics: Add up to 10 chattiest clients

- embellish pid name
- >1% of the logs
- fix PID gone detection (EPERM)
- some ? : cleanup

Change-Id: Iba3b306e1fee43e53931165819a398693910514b
/system/core/logd/LogStatistics.cpp
9101878dd06a74cedeadca3fec3b3db68cba8bf0 08-Apr-2014 Greg Hackmann <ghackmann@google.com> Merge "logd: fix LogStatistics::format freeing wrong pointer"
239605ef64d34ced82c97870e3f3f5c4145be58c 07-Apr-2014 Greg Hackmann <ghackmann@google.com> logd: fix LogStatistics::format freeing wrong pointer

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>
/system/core/logd/LogStatistics.cpp
4ba0387af5acc52e43e4004ccb4c46b8bc700349 07-Apr-2014 Mark Salyzyn <salyzyn@google.com> logd: Add pidToUid helper

Change-Id: I23ebae1957c027bff6cbc2573a227bf0c44c08a2
/system/core/logd/LogStatistics.cpp
9a03863e88da99ba010342c874252089dd771f7f 07-Apr-2014 Mark Salyzyn <salyzyn@google.com> logd: Add pidToName helper

Change-Id: Idd8e804ab65feb8dc432150ae701464de1ad5302
/system/core/logd/LogStatistics.cpp
e457b74ce6ee6d799812dc2ec5e4b8b18bcd3e91 20-Feb-2014 Mark Salyzyn <salyzyn@google.com> logd: Add minimum time bucket statistics

* 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
/system/core/logd/LogStatistics.cpp
dfa7a07f5be656cfafdb4e75916bc9dcd9e592e7 11-Feb-2014 Mark Salyzyn <salyzyn@google.com> logd: liblog: logcat: Add LogWhiteBlackList

- 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
/system/core/logd/LogStatistics.cpp
34facab86b0fe7ec613de92b46b637f864fb0682 06-Feb-2014 Mark Salyzyn <salyzyn@google.com> logd: liblog: logcat: Add Statistics

- 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
/system/core/logd/LogStatistics.cpp