Another solution would be similar to jpg's answer, but in the other direction, redirect
the kernel messages into logcat. This is better, because too many logcat messages might overload the serial console (if you have it active).
you can run this in an android shell:
cat /proc/kmsg | while read LINE; do echo '\06kernel\0'$LINE'\0' > /dev/log/main; done
or this in a host shell:
adb shell '(cat /proc/kmsg | while read LINE; do echo \\06kernel\\0$LINE\\0 > /dev/log/main; done)'
The first time you start the command you will see all of the current dmesg messages in one place, but any further messages will be interleaved, when they appear.
and then examine logcat in a different shell. If you examine logcat with -v time, then the kernel messages will contain both the logcat and the kernel timestamps. Of course there may be delays between the two.
Another, even simpler way to see messages interleaved would be:
adb shell '(logcat & cat /proc/kmsg) > /path/to/log/file'
But in this case it's a little harder to identify messages coming from the kernel, and you can't tell how kernel timestamps relate to logcat timestamps.
elapsedRealtime()
into every log! So I checked into logcat code. Time formatting is done inandroid_log_formatLogLine()
inlogprint.cpp
. ButelapsedRealtime()
is in java and I dont know how to access it from a cpp file. I am not able to find an equivalent that I can use from this cpp file – Etra