You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jianglk.darker 7ee447c011
v811_spc009_project
4 months ago
..
doc_images v811_spc009_project 4 months ago
fuzz v811_spc009_project 4 months ago
.clang-format v811_spc009_project 4 months ago
Android.bp v811_spc009_project 4 months ago
ChattyLogBuffer.cpp v811_spc009_project 4 months ago
ChattyLogBuffer.h v811_spc009_project 4 months ago
ChattyLogBufferTest.cpp v811_spc009_project 4 months ago
CommandListener.cpp v811_spc009_project 4 months ago
CommandListener.h v811_spc009_project 4 months ago
CompressionEngine.cpp v811_spc009_project 4 months ago
CompressionEngine.h v811_spc009_project 4 months ago
LogAudit.cpp v811_spc009_project 4 months ago
LogAudit.h v811_spc009_project 4 months ago
LogBuffer.h v811_spc009_project 4 months ago
LogBufferElement.cpp v811_spc009_project 4 months ago
LogBufferElement.h v811_spc009_project 4 months ago
LogBufferTest.cpp v811_spc009_project 4 months ago
LogBufferTest.h v811_spc009_project 4 months ago
LogKlog.cpp v811_spc009_project 4 months ago
LogKlog.h v811_spc009_project 4 months ago
LogListener.cpp v811_spc009_project 4 months ago
LogListener.h v811_spc009_project 4 months ago
LogPermissions.cpp v811_spc009_project 4 months ago
LogPermissions.h v811_spc009_project 4 months ago
LogReader.cpp v811_spc009_project 4 months ago
LogReader.h v811_spc009_project 4 months ago
LogReaderList.cpp v811_spc009_project 4 months ago
LogReaderList.h v811_spc009_project 4 months ago
LogReaderThread.cpp v811_spc009_project 4 months ago
LogReaderThread.h v811_spc009_project 4 months ago
LogSize.cpp v811_spc009_project 4 months ago
LogSize.h v811_spc009_project 4 months ago
LogStatistics.cpp v811_spc009_project 4 months ago
LogStatistics.h v811_spc009_project 4 months ago
LogTags.cpp v811_spc009_project 4 months ago
LogTags.h v811_spc009_project 4 months ago
LogUtils.h v811_spc009_project 4 months ago
LogWriter.h v811_spc009_project 4 months ago
LogdLock.cpp v811_spc009_project 4 months ago
LogdLock.h v811_spc009_project 4 months ago
OWNERS v811_spc009_project 4 months ago
PkgIds.cpp v811_spc009_project 4 months ago
PruneList.cpp v811_spc009_project 4 months ago
PruneList.h v811_spc009_project 4 months ago
README.auditd v811_spc009_project 4 months ago
README.compression.md v811_spc009_project 4 months ago
README.property v811_spc009_project 4 months ago
README.replay.md v811_spc009_project 4 months ago
RecordedLogMessage.h v811_spc009_project 4 months ago
RecordingLogBuffer.cpp v811_spc009_project 4 months ago
RecordingLogBuffer.h v811_spc009_project 4 months ago
ReplayMessages.cpp v811_spc009_project 4 months ago
SerializedData.h v811_spc009_project 4 months ago
SerializedFlushToState.cpp v811_spc009_project 4 months ago
SerializedFlushToState.h v811_spc009_project 4 months ago
SerializedFlushToStateTest.cpp v811_spc009_project 4 months ago
SerializedLogBuffer.cpp v811_spc009_project 4 months ago
SerializedLogBuffer.h v811_spc009_project 4 months ago
SerializedLogBufferTest.cpp v811_spc009_project 4 months ago
SerializedLogChunk.cpp v811_spc009_project 4 months ago
SerializedLogChunk.h v811_spc009_project 4 months ago
SerializedLogChunkTest.cpp v811_spc009_project 4 months ago
SerializedLogEntry.h v811_spc009_project 4 months ago
SimpleLogBuffer.cpp v811_spc009_project 4 months ago
SimpleLogBuffer.h v811_spc009_project 4 months ago
auditctl.cpp v811_spc009_project 4 months ago
device_test_config.xml v811_spc009_project 4 months ago
event.logtags v811_spc009_project 4 months ago
libaudit.cpp v811_spc009_project 4 months ago
libaudit.h v811_spc009_project 4 months ago
logd.rc v811_spc009_project 4 months ago
logd_test.cpp v811_spc009_project 4 months ago
logtagd.rc v811_spc009_project 4 months ago
main.cpp v811_spc009_project 4 months ago

README.replay.md

logd can record and replay log messages for offline analysis.

Recording Messages

logd has a RecordingLogBuffer buffer that records messages to /data/misc/logd/recorded-messages. It stores messages in memory until that file is accessible, in order to capture all messages since the beginning of boot. It is only meant for logging developers to use and must be manually enabled in by adding RecordingLogBuffer.cpp to Android.bp and setting log_buffer = new SimpleLogBuffer(&reader_list, &log_tags, &log_statistics); in main.cpp.

Recording messages may delay the Log() function from completing and it is highly recommended to make the logd socket in liblog blocking, by removing SOCK_NONBLOCK from the socket() call in liblog/logd_writer.cpp.

Replaying Messages

Recorded messages can be replayed offline with the replay_messages tool. It runs on host and device and supports the following options:

  1. interesting - this prints 'interesting' statistics for each of the log buffer types (simple, chatty, serialized). The statistics are:
    1. Log Entry Count
    2. Size (the uncompressed size of the log messages in bytes)
    3. Overhead (the total cost of the log messages in memory in bytes)
    4. Range (the range of time that the logs cover in seconds)
  2. memory_usage BUFFER_TYPE - this prints the memory usage (sum of private dirty pages of the replay_messages process). Note that the input file is mmap()'ed as RO/Shared so it does not appear in these dirty pages, and a baseline is taken before allocating the log buffers, so only their contributions are measured. The tool outputs the memory usage every 100,000 messages.
  3. latency BUFFER_TYPE - this prints statistics of the latency of the Log() function for the given buffer type. It specifically prints the 1st, 2nd, and 3rd quartiles; the 95th, 99th, and 99.99th percentiles; and the maximum latency.
  4. print_logs BUFFER_TYPE [buffers] [print_point] - this prints the logs as processed by the given buffer_type from the buffers specified by buffers starting after the number of logs specified by print_point have been logged. This acts as if a user called logcat immediately after the specified logs have been logged, which is particularly useful since it will show the chatty pruning messages at that point. It additionally prints the statistics from logcat -S after the logs. buffers is a comma separated list of the numeric buffer id values from <android/log.h>. For example, 0,1,3 represents the main, radio, and system buffers. It can can also be all. print_point is an positive integer. If it is unspecified, logs are printed after the entire input file is consumed.
  5. nothing BUFFER_TYPE - this does nothing other than read the input file and call Log() for the given buffer type. This is used for profiling CPU usage of strictly the log buffer.