Although ever present, an increased regression introduced with
commit b6bee33182 (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
Although ever present, an increased regression introduced with
commit b6bee33182 (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
if ro.logd.timestamp or persist.logd.timestamp are set to the value
monotonic then liblog writer, liblog printing and logd all switch to
recording/printing monotonic time rather than realtime. If reinit
detects a change for presist.logd.timestamp, correct the older entry
timestamps in place.
ToDo: A corner case condition where new log entries in monotonic time
occur before logd reinit detects persist.logd.timestamp, there
will be a few out-of-order entries, but with accurate
timestamps. This problem does not happen for ro.logd.timestamp
as it is set before logd starts.
NB: This offers a nano second time accuracy on all log entries
that may be more suitable for merging with other system
activities, such as systrace, that also use monotonic time. This
feature is for debugging.
Bug: 23668800
Change-Id: Iee6dab7140061b1a6627254921411f61b01aa5c2
- '-v epoch' prints seconds since Jan 1 1970
- '-v monotonic' print cpu seconds since start of device
- '-T sssss.mmm...' as alternate tail time format
NB: monotonic is a best estimate and may be out by a few ms
given the synchronization source clue accuracy.
Bug: 23668800
Change-Id: Ieb924b6d3817669c7e53beb9c970fb626eaad460
strcmp was 1/10 #2 behind find_property in __android_log_level(),
now virtually eliminated from performance profile.
Bug: 23685592
Change-Id: I3978886193af77e489c6d1728d6a26b7f53f8f2f
- '-v year' modifier adds the four digit year prefix
- '-v <timezone>' modifier sets and prints the timezone suffix
- Only promise in logcat to support UTC as a timezone since
all others are based on the configured environment
- '-v zone' modifier toggles the timezone suffix on or off
- '-T YYYY-MM-DD HH:MM:SS.mmm...' format is added
Bug: 23668700
Change-Id: I7521c1efb7455dc9a25434fce72a69a65dcf72ea
CYGWIN is not supported, USE_MINGW and HOST_OS==windows are being
replaced with LOCAL_..._windows variables.
Bug: 23566667
Change-Id: I3e4a1e4097dc994cf5abdce6939e83a91758fd75
* liblog does not use STL, don't link it.
* ASan runtime library depends on liblog, hence liblog can never be
sanitized.
Bug: 21785137
Change-Id: I1e97378c61d4d18d740287f5f0881427aa7cc227
- Add support for "log.tag" and "persist.log.tag" global
logging properties, effectively a runtime default minimum
logging level.
- Add a thread-safe single level cache plus selective logic for the
four properties being checked to help speed up logging decision
on subsequent identical calls.
- Using new __system_property_area_serial() to make for
efficient (<100ns) handling of cache misses. Despite adding
two new properties, we are 8 times faster on subsequent calls
even if the properties do not exist.
- A NULL or blank tag is no longer directed to return default,
it will check the pair of global logging properties first.
- Add liblog.is_loggable gTest
- Fixup liblog.android_logger_get_, allow no content in crash buffer
- Fixup liblog.max_payload, lowered logd priority increases latency
Bug: 19544788
Bug: 21696721
Change-Id: Ideb887755aa3f1fd14a2603bda1fe23cba49642c
- added printable format modifier:
logcat -v printable
- opencoded borrowed individual utf8 validity checking algorithm
from utf8_length() in libutils/Unicode.cpp
- if considered basic one-character ASCII, use popular \x escape
sequences for non-printable
- logprint convert to C comments to drop mixed-mode
Bug: 19000361
Change-Id: I122a5b8fb41216fc0bc816178c0b768f3df56586
On startup, check the current logging content, then grab logs from
that time forward rather than restarting from the beginning. Add
support for reading tail time down to the nano-second.
Bonus, permits us to create a logcatd logpersist daemon
Bug: 19608716
Change-Id: Iaab58de4c02b7f97c69de12cf954fedc2163059e
- Add additional 3 digits of time precision for time output
adding in the reporting of usec
- Remove trailing space in header file
Change-Id: Ifb560850b8e01080e126fbaeab640db71cce3eea
- On a N9 64-bit benchmark, the __android_log_is_loggable overhead
is roughly 500ns (1/2 of a syscall?)
Bug: 19544788
Bug: 17760225
Bug: 20416721
Change-Id: Ib9e4d06d96e1b19ca5d459e569ead451ef47a9c0
- If logd.tag.<tag> is not found, check if persist.logd.tag.<tag> is available
- Do not turn off the isLoggable functionality on "user" builds
Bug: 19544788
Bug: 17760225
Change-Id: I3fec67b547aa431438965519507033798398e1e1
__android_log_write() was just a special form of
__android_log_buf_write that used a default log ID and set the abort
message for fatal messages. Presumably the latter was intended to be
set for __android_log_buf_write as well.
Change-Id: I51cff7561a2754676b2088d95fa4f4505ac3c3c2
__write_to_log_null never retries initialization and only
made sense for the kernel logger. The user space logger
can come and go.
Bug: 19732485
Change-Id: Iac34ea1c52ec82db4ee0c2c73ba0950ace4d4dec
A regression after "liblog: Instrument logging of logd write drops"
where an empty payload would result in an insufficient iovec to
report the write drop.
Change-Id: Iffabcfbb0680898d7a42004700e638e9d940ff5f
If you rely on __builtin_trap, it's likely to use an illegal instruction,
which is a misleading way to abort. If we just call abort, it's more
immediately obvious that we've aborted.
Bug: 19644330
Change-Id: I63a962e4748aec7b019ea94b007593e478a3b61a
Fix host/sdk builds:
- Drop logprint from list of host products
- Drop <endian.h> for FAKE_LOG_DEVICE
Change-Id: I8aa854413ff6d809f0b04987cf913eb228e4213c
* changes:
logcat: remove dead label code
logcat: do not stop on unexpected log ID
Revert "logd: Add minimum time bucket statistics"
liblog: Instrument logging of logd write drops
- If logger system is prostrated, send an event message with the
liblog tag from the associated UID and PID with a count of
dropped messages once logging is resumed.
- Added to the README a description of the error return values.
- Describe in the README the appropriate mitigations for dropped
messages.
- If the caller sees this message, then
/proc/sys/net/unix/max_dgram_qlen is likely too small
Change-Id: Iaf387b9e5e1b6aa93bebc7481f9e8353732e3229
Used to pull the Android log messages after a reboot. Adding
an ANDROID_LOG_PSTORE flag to the mode parameter in calls to
android_logger_list_alloc() and android_logger_list_alloc_time().
The side effects are that android_logger_clear() and
android_logger_list_read() will react with the user space
pstore driver. Forms a companion to the pstore console logs.
Change-Id: I7bb07b87b3bf73f059a21af3f810af37c7715b6d
Move away from using POSIX open(2) flags and introduce ANDROID_LOG_* flags to
replace them. Add security by preventing random mode flags from getting into
underlying POSIX calls. ANDROID_LOG_* flags overlap POSIX O_* flag definitions.
Change-Id: Ib32bb64c287e8bf150be62242e1ba46bb37839fc