Understanding the kernel dmesg timestamp
Asked Answered
H

2

6

I want to decode the time format in the kernel logs:

<3>[  107.236115]

<3>[  107.245076]

<4>[  107.521858]

<3>[  107.522098]

Is there any way to convert those time stamps into a "min:sec:msec" format?

I found some scripts to decode which are working but during runtime, here I already have a log and want to decode it manually.

Halfassed answered 11/9, 2015 at 13:16 Comment(0)
D
20

The format is simple: <N> means the log level is N, then inside of [] there is the time in seconds since the last system boot.

So [ 107.245076] means the message was logged 107 seconds and 245076 microseconds (1 min 47 s 245 ms) after the last boot.

Keep in mind, however, that this is not the wall-clock time, it's the time when the kernel was running. It may stop if the system is suspended which is quite common on embedded devices, especially Android-based ones.

Disconnect answered 11/9, 2015 at 13:32 Comment(0)
N
4

There is an option for dmesg to convert this time into a human-readable time format:

dmesg -T

That makes dmesg print kernel messages in this format:

[Tue Sep  6 13:57:24 2022] microcode: microcode updated early to revision 0x2f, date = 2019-02-17
[Tue Sep  6 13:57:24 2022] Linux version 5.19.5-arch1-1 (linux@archlinux) (gcc (GCC) 12.2.0, GNU ld (GNU Binutils) 2.39.0) #1 SMP PREEMPT_DYNAMIC Mon, 29 Aug 2022 15:51:05 +0000
[Tue Sep  6 13:57:24 2022] Command line: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=86d93292-13aa-4c83-be14-180d0b44f5fe rw loglevel=3 resume=/dev/sda3 resume_offset=26787840
[Tue Sep  6 13:57:24 2022] Disabled fast string operations
[Tue Sep  6 13:57:24 2022] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[Tue Sep  6 13:57:24 2022] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[Tue Sep  6 13:57:24 2022] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[Tue Sep  6 13:57:24 2022] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
[Tue Sep  6 13:57:24 2022] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format.
[Tue Sep  6 13:57:24 2022] signal: max sigframe size: 1776
[Tue Sep  6 13:57:24 2022] reserving inaccessible SNB gfx pages
[Tue Sep  6 13:57:24 2022] BIOS-provided physical RAM map:
[Tue Sep  6 13:57:24 2022] BIOS-e820: [mem 0x0000000000000000-0x000000000009d7ff] usable
[Tue Sep  6 13:57:24 2022] BIOS-e820: [mem 0x000000000009d800-0x000000000009ffff] reserved
[Tue Sep  6 13:57:24 2022] BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved
[Tue Sep  6 13:57:24 2022] BIOS-e820: [mem 0x0000000000100000-0x00000000da99efff] usable
[Tue Sep  6 13:57:24 2022] BIOS-e820: [mem 0x00000000da99f000-0x00000000dae9efff] reserved
[Tue Sep  6 13:57:24 2022] BIOS-e820: [mem 0x00000000dae9f000-0x00000000daf9efff] ACPI NVS
[Tue Sep  6 13:57:24 2022] BIOS-e820: [mem 0x00000000daf9f000-0x00000000daffefff] ACPI data
[Tue Sep  6 13:57:24 2022] BIOS-e820: [mem 0x00000000dafff000-0x00000000daffffff] usable
[Tue Sep  6 13:57:24 2022] BIOS-e820: [mem 0x00000000db000000-0x00000000df9fffff] reserved
[Tue Sep  6 13:57:24 2022] BIOS-e820: [mem 0x00000000f8000000-0x00000000fbffffff] reserved
[Tue Sep  6 13:57:24 2022] BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved
[Tue Sep  6 13:57:24 2022] BIOS-e820: [mem 0x00000000fed08000-0x00000000fed08fff] reserved
[Tue Sep  6 13:57:24 2022] BIOS-e820: [mem 0x00000000fed10000-0x00000000fed19fff] reserved
[Tue Sep  6 13:57:24 2022] BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed1ffff] reserved
[Tue Sep  6 13:57:24 2022] BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved
[Tue Sep  6 13:57:24 2022] BIOS-e820: [mem 0x00000000ffd20000-0x00000000ffffffff] reserved
[Tue Sep  6 13:57:24 2022] BIOS-e820: [mem 0x0000000100000000-0x000000041e5fffff] usable
[Tue Sep  6 13:57:24 2022] NX (Execute Disable) protection: active
[Tue Sep  6 13:57:24 2022] SMBIOS 2.6 present.
[Tue Sep  6 13:57:24 2022] DMI: LENOVO 4291IR6/4291IR6, BIOS 8DET49WW (1.19 ) 07/01/2011
Nightclub answered 14/1, 2022 at 19:3 Comment(2)
Question is: convert those time stamps into a "min:sec:msec" format?Cyan
dmesg -T shows hour:min:sec since kernel bootsCyan

© 2022 - 2024 — McMap. All rights reserved.