summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Remove old simulator support from liblogDan Willemsen2017-05-071-66/+15
| | | | | | | | | As far as I know, this isn't used anymore, and is causing problems when building with bionic on the host (with the cast of open). Bug: 31559095 Test: host bionic compiles Change-Id: I8b6e802e2d6dcc6e8476e387a5a365903aec3be1
* liblog: specify clang formatMark Salyzyn2017-03-091-510/+500
| | | | | | | | | Switch coding style to match SideEffects: None Test: compile Bug: 27405083 Change-Id: Id426d5c5e3b18f2ceec22b31bbc9781aabf6bcca
* liblog: add logprint to host buildMark Salyzyn2017-02-081-1/+6
| | | | | | | | | | | | | | | | - cleanup of some style issues - resolve a few minor bugs - add -lrt for host so that clock_gettime can be issued - enable write-only logging, logprint and event list handling tests for host consumption. NB: CtsLiblogTestCases_list is only outlet for host testing of the interfaces, but it is not part of any automated testing Test: gTest liblog-unit-tests, liblog-benchmarks and CtsLiblogTestCases_list && build mmma system/core/liblog Bug: 27405083 Change-Id: I13db1f45f67569407587a5a909248de33809b8cf
* liblog: add android_lookupEventTagNumMark Salyzyn2017-02-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | android_lookupEventTagNum added. Adds support for creating a new log tag at runtime, registered to the logd service. Tested on Hikey, all services stopped, shell only access, CPUs not locked (there is enough repeatability on this platform). $ /data/nativetest64/liblog-benchmarks/liblog-benchmarks BM_lookupEventTagNum iterations ns/op Precharge: start Precharge: stop 231 NB: only Tag matching, linear lookup (as reference, before unordered_map) BM_lookupEventTagNum 1000000 1017 NB: unordered_map with full Tag & Format lookup, but with Tag hashing BM_lookupEventTagNum 2000000 683 NB: with full Tag & Format hash and lookup for matching BM_lookupEventTagNum 2000000 814 NB: only Tag matching (Hail Mary path) BM_lookupEventTagNum 5000000 471 Because the database can now be dynamic, we added reader/writer locks which adds a 65ns (uncontended) premium on lookups, and switch to check for an allocation adds 25ns (either open code, or using string_view, no difference) which means our overall speed takes 90% as long as the requests did before we switched to unordered_map. Faster than before where we originally utilized binary lookup on static content, but not by much. Dynamic updates that are not cached locally take the following times to acquire long path to logd to generate. BM_lookupEventTag 20000000 139 BM_lookupEventTag_NOT 20000000 87 BM_lookupEventFormat 20000000 139 BM_lookupEventTagNum_logd_new 5000 335936 BM_lookupEventTagNum_logd_existing 10000 249226 The long path pickups are mitigated by the built-in caching, and the public mapping in /dev/event-log-tags. SideEffects: Event tags and signal handlers do not mix Test: liblog benchmarks Bug: 31456426 Change-Id: I69e6489d899cf35cdccffcee0d8d7cad469ada0a
* system/core: preparation to pull back interfaces from android/log.hMark Salyzyn2016-10-201-0/+4
| | | | | | | | | | | | | | | | Point to log/log.h where necessary, define LOG_TAG where necessary. Accept that private/android_logger.h is suitable replacement for log/logger.h and android/log.h. Correct liblog/README Effectively a cleanup and controlled select revert of 'system/core: drop or replace log/logger.h' and 'system/core: Replace log/log.h with android/log.h'. Test: compile Bug: 30465923 Change-Id: Ic2ad157bad6f5efe2c6af293a73bb753300b17a2
* liblog: LIBLOG_ABI_PRIVATE __android_log_is_debuggable()Mark Salyzyn2016-10-141-0/+5
| | | | | | | | | | Allow our own libraries to use this privately instead of running the less efficient get_properties and doing the math. Test: compile and boot smoke test Bug: 27566046 Bug: 31456426 Change-Id: I2f677276d27fbcb6af01b600ac1d9891c8938d43
* liblog: logd: Add android_lookupEventTag_len()Mark Salyzyn2016-10-031-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* liblog: Replace log/log.h with android/log.hMark Salyzyn2016-09-301-1/+1
| | | | | | | | | | Move all liblog related content into android/log.h, and make log/log.h points to android/log.h. Test: Compile Bug: 26552300 Bug: 31289077 Change-Id: I858e0ebe047b86f2a8530a99bc9c380d3d58edbb
* liblog: logcat: Replace log/logd.h with log/log.hMark Salyzyn2016-09-301-1/+1
| | | | | | | | | | | Should use log/log.h and in some cases android/log.h instead. Can not remove file because still in use by partners, so log/logd.h points to log/log.h. Test: Compile Bug: 26552300 Bug: 31289077 Change-Id: I3580d46154617abb7231027a44f4ab9ee023febf
* liblog: split out transports into separate filesMark Salyzyn2016-03-221-1/+1
| | | | | | | | | | | | | | | (cherry pick from commit 018a96d03f0d452bf078084eedcd5693da42308d) Create config_logger, logger and logger_read to house the log interfaces. Add fake_logger, logd_logger and pmsg_logger to house the write and read transports. Allows for an easier and direct path to add new transports to the library. SideEffects: None, logger benchmark performance unaffected Bug: 27176738 Bug: 27405083 Change-Id: I01b38637334a5242905c8c89f6ab0a92e2540008
* liblog: audit declare LIBLOG_ABI_PUBLICMark Salyzyn2016-03-101-16/+15
| | | | | | | | | | | | | | | (cherry pick from commit be1d3c21b57d3e67c6a9682f3b2f0838486a3ee8) - replace <sys/cdefs.h> with local "log_cdefs.h" which fortifies and expands definitions, adding LIBLOG_ABI_PUBLIC, LIBLOG_HIDDEN, LIBLOG_ABI_PRIVATE and LIBLOG_WEAK. - clearly tag each interface as LIBLOG_ABI_PUBLIC, LIBLOG_HIDDEN, LIBLOG_ABI_PRIVATE, LIBLOG_WEAK or static depending on scope - Add -fvisibility=hidden to ensure nothing else leaks - some code standard adjustments Bug: 27566046 Change-Id: Ic14033c4e6d833d973beb035ddc1c6134fb35a3f
* liblog: document fakeLogClose never to be calledMark Salyzyn2016-03-101-0/+11
| | | | | | | (cherry pick from commit bc81b17e06cb23501eeca03a530b3a90858ac7c3) Bug: 27107691 Change-Id: Ia699646ec2e83ca46f8b62b5d4f144e533b36074
* fake_log_device: long lived allocationsMark Salyzyn2016-03-101-21/+23
| | | | | | | | | | | | | | (cherry pick from commit 0085a135b9986c969067aa89c4c9985fe5233870) Use static space for long lived allocations as they will appear to act like a memory leak. Resort to a larger on-stack iovec to reduce the chances of an allocation. Fix bug in writer where not enough size was available for "security" buffer name. Minor transitions to more consistent coding style. Bug: 27107691 Change-Id: I68c918e7b916b1ae3b04829d48b3eddaa0a7e739
* Fix windows 64-bit buildsDan Willemsen2016-02-251-0/+4
| | | | | | | | | | | | | | | | | | pid_t is 64-bit in 64-bit mingw, but the windows process/thread functions return a DWORD(uint32_t). Instead of promoting to a pid_t and fixing the format strings, just use a uint32_t to store the values. android_thread_id also cannot be a 64-bit pointer, so for windows just force it to be a uint32_t. libutils/ProcessCallStack only works under Linux, since it makes heavy use of /proc. Don't compile it under Windows or Darwin. Bug: 26957718 (cherry picked from commit 86cf941c480de8d5693a24d3feb45574f5c89a86) Change-Id: I8d39d1951fea1b3011caf585c983e1da7959f7c0
* liblog: deal with warning messagesMark Salyzyn2016-02-221-3/+3
| | | | | | | | | | | (cherry pick from commit b525884edb1f8a80a8fc6cad58c69bdacc5bdb90) - Fix bug in fake_log_devices when it can not allocate memory failing to use the full on-stack buffer as backup. - remove superfluous code. Bug: 27265662 Change-Id: I97b6cca5f4ce8ecad9beb3a08353de596d6a4ad1
* liblog: resolve deadlocksMark Salyzyn2015-11-191-0/+7
| | | | | | | | | | | | | | | | | | | | | | | Although ever present, an increased regression introduced with commit b6bee33182cedea49199eb2252b3f3b442899c6d (liblog: logd: support logd.timestamp = monotonic). A signal handler can interrupt in locked context, if log is written in the signal handler, we are in deadlock. To reduce the contention and chances for this problem separate out timestamp lock from is loggable lock to reduce contention situations. Provide a best-guess response if lock would fail in timestamp path. Use a common lock() inline within each module, with a comment speaking to the issues surrounding calling a function that has a mutex within a signal handler. ToDo: Hold off signals temporarily in mainline, restart when unblock. Can not use pthread_sigmask(SIG_BLOCK,,) as it breaks AtCmd. Signed-off-by: Mark Salyzyn <salyzyn@google.com> Bug: 25563384 Change-Id: I47e2c87c988c3e359eb9eef129c6a3a08e9eedef
* Revert "liblog: resolve deadlocks"Mark Salyzyn2015-11-161-30/+11
| | | | | | | This reverts commit 7a2a3071921b11d7e476862e7f9cbe72be43d0f7. Bug: 25693940 Change-Id: I9a7c926289e972f80c03c92e33535e1dedaa7381
* liblog: resolve deadlocksMark Salyzyn2015-11-121-11/+30
| | | | | | | | | | | | | | | Although ever present, an increased regression introduced with commit b6bee33182cedea49199eb2252b3f3b442899c6d (liblog: logd: support logd.timestamp = monotonic). A signal handler can interrupt in locked context, if log is written in the signal handler, we are in deadlock. Block signals while we are locked. Separate out timestamp lock from is loggable lock to reduce contention situations. Provide a best-guess response if lock would fail in timestamp path. Bug: 25563384 Change-Id: I6dccd6b99ebace1c473c03a785a35c63ed5c6a8a
* liblog: add __android_log_is_loggable()Mark Salyzyn2015-02-091-0/+6
| | | | | | | | | - Add new liblog API __android_log_is_loggable(prio, tag, def) - future plan to integrate this into the runtime checks and into the logd daemon for filtration. Inert for now. Bug: 17760225 Change-Id: I16395b4d42acc08f0209f55a1cbf87b0b2112898
* Kill HAVE_PTHREADS.Yabin Cui2015-01-271-4/+4
| | | | | Bug: 19083585 Change-Id: Ic09eb3dd250bc5c5b63cac7998f99f5fa007f407
* Only Win32 doesn't have writev.Elliott Hughes2014-11-251-2/+2
| | | | Change-Id: I9b5328cea3c88a75135dcb0711cbb5471e8fa388
* kill HAVE_LOCALTIME_RYabin Cui2014-11-131-2/+2
| | | | | Bug: 18361583 Change-Id: Icdc745a5204bba26c6438d16ed38ec791e136163
* liblog: set -WerrorMark Salyzyn2014-05-071-5/+9
| | | | | | | - Deal with some -Wunused issues - Cleanup UNUSED to __unused transition Change-Id: Icd33808d4c974625f4fd0a126a90a2b4c90c8314
* Merge changes I70ab37d5,I716f89c0,I34c96adf,I77650923,I35b0d1ee, ...Mark Salyzyn2014-01-281-5/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * changes: libsysutils: SocketListener export release libsysutils: Add iovec/runOnEachSocket liblog: support struct logger_event_v2 format liblog: update timestamp on NOTICE file libcutils: resolve warning in iosched_policy.c liblog: Add const pedantics logcat: Add -T flag (-t w/o assumption of -d) logcat: Add logcat test suite liblog: Add cpu utilization test liblog: Add liblog test suite debuggerd: Support newline split in log messages liblog: deprecate export LOGGER ioctl definitions liblog: deprecate export of LOGGER_LOG_* defines liblog: Add README liblog: resolve build warning messages liblog: high CPU usage from logcat liblog: fix build again liblog: drop use of sys/cdefs.h liblog: git_master@964770 build problem logcat: Incorporate liblog reading API debuggerd: Incorporate liblog reading API liblog: Interface to support abstracting log read adb: deprecate legacy log service interface adb: regression from Move list.c to inlines liblog: whitespace cleanup libcutils: bug str_parms.c:str_parms_get_float(). libcutils: UNUSED argument warnings libsysutils: Get rid of warnings libcutils: Move list.c to inlines on list.h
| * liblog: resolve build warning messagesMark Salyzyn2014-01-271-5/+5
| | | | | | | | | | | | (cherry picked from commit 153b370624c3da0660281f692fbe3f2da96cfd70) Change-Id: Icc6f1f2c926a008efc4df71022cfde8d0e285880
* | Fixes some warningsKristian Monsen2014-01-281-0/+2
|/ | | | | | | - Implicit decleared function - Unused variable Change-Id: Ia701e66682cb6788f0716a2ef7556ed07227f78f
* Move liblog headers to system/core/include/logColin Cross2013-07-241-1/+1
| | | | | | | | | Move the liblog headers to log/ instead of cutils/ to complete the separation of libcutils and liblog. cutils/log.h still exists and includes log/log.h in order to support the many existing modules that use cutils/log.h. Change-Id: I2758c9f4aedcb809ca7ba8383d0f55041dd44345
* Fixed two 64-bit porting issues; Make pid/tid type consistentAndrew Hsieh2012-02-291-3/+3
| | | | | | | | 1. In printf, use "%zu" for variable of type size_t 2. Print tid in %5d 3. Make type of pid/tid in AndroidLogEntry and logger_entry consistent Change-Id: I3e3d9536ee58823f349a4734ae093d30eabe1bfe
* Fix SDK build.Brett Chabot2011-06-271-1/+0
| | | | | | Revert "Fix build warnings" This reverts commit 590e364868b6466e169f2647e95462ba2558dd00.
* Fix build warningsGlenn Kasten2011-06-241-0/+1
| | | | Change-Id: Ie24cf8e729813e4527c698fc7c1502a1efbc63e5
* Fix a long standing bug in the output buffer size computation.Carl Shapiro2010-04-091-1/+1
| | | | Change-Id: I55aca04fdd3822ac06db183bf2ff0cbd61f778e8
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-0/+685
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-677/+0
|
* Initial ContributionThe Android Open Source Project2008-10-211-0/+677