【问题标题】:What does the numbers at the beginning of prink() mean?prink() 开头的数字是什么意思?
【发布时间】:2014-03-25 04:15:52
【问题描述】:

如果你使用 prink() 打印内核消息并在控制台中读取它,它看起来像这样:

<6>[ 2809.666228] amp_enable: amp enable bypass(2)  
<6>[ 2809.666747] amp_enable: AMP_EN is set to 0  
<3>[ 2810.084296] init: untracked pid 4196 exited  
<3>[ 2810.873706] init: untracked pid 4817 exited  
<6>[ 2810.933923] msm_ta_detect_work: USB exit ta detection - frindex  
<6>[ 2817.483839] amp_enable: AMP_EN is set to 1  
<6>[ 2823.084022] adjust_soc: ibat_ua = -114500, vbat_uv = 4296066, soc = 95, batt_temp=302  
<6>[ 2823.669799] SLIM_CL: skip reconfig sequence  
<6>[ 2823.685578] amp_enable: amp enable bypass(2)  
<6>[ 2823.686372] amp_enable: AMP_EN is set to 0  

每行开头的数字是什么意思?它是某种时间戳吗?如何解读?

【问题讨论】:

标签: printk


【解决方案1】:

正如NG 提到的, 和 是日志级别,其中 是 KERN_ERR, 是 KERN_INFO

这是从http://tuxthink.blogspot.com/2012/07/printk-and-console-log-level.html 挑选的列表。

0 KERN_EMERG
1 KERN_ALERT
2 KERN_CRIT
3 KERN_ERR
4 KERN_WARNING
5 KERN_NOTICE
6 KERN_INFO
7 KERN_DEBUG

下一个数字似乎是自系统启动以来的时间(以秒为单位)。当您看到这些消息时,您的系统是否在大约 50 分钟前启动?时间戳可以帮助我们跟踪任务花费了多长时间。例如,amp_enable: amp enable bypass(2) 需要 0.519 毫秒才能完成。从第一个条目到第四个条目,耗时1.207478s。

<6>[ 2809.666228] amp_enable: amp enable bypass(2)  
<6>[ 2809.666747] amp_enable: AMP_EN is set to 0  
<3>[ 2810.084296] init: untracked pid 4196 exited  
<3>[ 2810.873706] init: untracked pid 4817 exited 

我通过访问http://elinux.org/Printk_Times_Sample1了解到这一点。

【讨论】:

    猜你喜欢
    • 2010-12-02
    • 2020-03-09
    • 1970-01-01
    • 2022-12-11
    • 2011-06-11
    • 2010-10-07
    • 2012-07-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多