summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Reading from logd in WRAP mode is expected to take a long time,Alan Stokes2017-08-251-2/+12
| | | | | | | | | | don't abort it after 30s. Adds a new CTS test to verify the behaviour. Bug: 64143705 Test: New and existing CTS tests pass. Manual testing with logcat. Change-Id: Ia67175701ed8c462083e14e26123ce8ddcb226bc
* liblog: specify clang formatMark Salyzyn2017-03-091-477/+450
| | | | | | | | | Switch coding style to match SideEffects: None Test: compile Bug: 27405083 Change-Id: Id426d5c5e3b18f2ceec22b31bbc9781aabf6bcca
* liblog: Harden log_id check.Mark Salyzyn2017-02-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Logd currently checks against LOG_ID_MAX and LOG_ID_KERNEL to determine if a given log_id is available. liblog uses only LOG_ID_KERNEL. While this matches with the comments in log/log_id.h to always keep LOG_ID_KERNEL at the end it does not match with other checks that logd makes, causing inconsistent behavior. This inconsistency is noticable on devices that errantly rewrite LOG_ID_MAX to not equal LOG_ID_KERNEL + 1. For log buffers with id's greater than LOG_ID_KERNEL, liblog reports that logd is unavailable while logd would accept the request. The guideline is to not use buffer ids above LOG_ID_KERNEL. This hardening change prevents an inconsistency that results if these guidelines are not followed. Partners are urged instead to increase LOG_ID_KERNEL locally to match their LOG_ID_MAX - 1 when they add new local log buffers in their private builds. Signed-off-by: Evan Ralston <eralston@amazon.com> Signed-off-by: Mark Salyzyn <salyzyn@google.com> Test: compiles. no functional change Change-Id: Icd4b12ac79c1e5cd1d8a32f67a9795797580aad5
* Merge "Revert "Check against LOG_ID_MAX instead of LOG_ID_KERNEL""Treehugger Robot2017-02-141-1/+1
|\
| * Revert "Check against LOG_ID_MAX instead of LOG_ID_KERNEL"Mark Salyzyn2017-02-141-1/+1
| | | | | | | | | | | | | | | | | | | | causes a regression, logcat -b kernel does not work. Check should have landed in logd_writer.c This reverts commit 2c2337a293dfcd7a144996048e48c2a54b44c5f8. Change-Id: I1004b44ecc87f5d83d1c4463dd8b1ac16499706d
* | Merge "Check against LOG_ID_MAX instead of LOG_ID_KERNEL"Treehugger Robot2017-02-091-1/+1
|\|
| * Check against LOG_ID_MAX instead of LOG_ID_KERNELEvan Ralston2017-02-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Logd currently checks against LOG_ID_KERNEL to determine if a given log_id is available. While this matches with the comments in log.h to always keep LOG_ID_KERNEL at the end it does not match with other checks that Logd makes causing inconsistent behavior. This inconsistency is noticable on devices with log buffers with id's greater than LOG_ID_KERNEL and liblog reports that logd is unavailable while logd would accept the request. Test: compiles. no functional change Change-Id: I0302d9e3f2657706fdf778f1e78e5604abf566e2
* | 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-2/+0
| | | | | | | | | | | | | | | | 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: __android_log_pmsg_file_write() cleanupMark Salyzyn2016-10-131-10/+14
| | | | | | | | | | | | | __android_log_pmsg_file_write() will open /dev/pmsg0 if not already, and will close it if we opened it. Added atomic access to the android_log_context as insurance. Fortify and correct pmsg tests. Test: gTest liblog-unit-tests --gtest_filter=liblog.__android_log_pmsg_file_* Bug: 31958686 Change-Id: I2cf6f971b6968938f471fda67367efe20dae3004
* 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: logd: logcat: deprecate log/log_read.hMark Salyzyn2016-09-301-1/+0
| | | | | | | | | | | | Always used in combination with log/logger.h except in log_time.cpp, and not used externally. As a result liblog has to support stl, a small price to pay since goal is to convert liblog to C++ internally. Test: compile Bug: 31456426 Bug: 26552300 Bug: 31289077 Change-Id: I72828ec807d0a2c8e40bbdebd7a69f147a7ca5a9
* liblog: logcat -g readable size wrongMark Salyzyn2016-04-291-1/+1
| | | | | Bug: 28451229 Change-Id: I4bbc2bed933d69416c23cc7af617be3fb55d0b62
* liblog: split out transports into separate filesMark Salyzyn2016-03-221-0/+670
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