首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >理解内核dmesg时间戳

理解内核dmesg时间戳
EN

Stack Overflow用户
提问于 2015-09-11 13:16:00
回答 2查看 10.6K关注 0票数 5

我想在内核日志中解码时间格式:

代码语言:javascript
复制
<3>[  107.236115]

<3>[  107.245076]

<4>[  107.521858]

<3>[  107.522098]

有没有办法将这些时间戳转换成"min:sec:msec“格式?

我找到了一些可以解码的脚本,但是在运行时,我已经有了一个日志,并且希望手动解码它。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-09-11 13:32:25

格式很简单:<N>表示日志级别为N,而在[]内部,从上一次系统启动到现在,以秒为单位。

因此,[ 107.245076]意味着消息在上次引导后记录了107秒和245076微秒(1分钟47秒245毫秒)。

但是,请记住,这不是挂钟时间,而是内核运行的时间。如果系统被暂停,它可能会停止,这在嵌入式设备上很常见,尤其是基于Android的设备。

票数 15
EN

Stack Overflow用户

发布于 2022-01-14 19:03:25

dmesg有一个选项可以将此时间转换为人类可读的时间格式:

代码语言:javascript
复制
dmesg -T

这使得dmesg以这种格式打印内核消息:

代码语言:javascript
复制
[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
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32524443

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档