性能分析——dmesg

dmesg 用于查看显示开机信息。在开机时无法观察信息,可以是用该命令进行查看kernel 的开机信息。但其实开机的信息会被系统默认的写入到 /var/log 下,进入到该目录下进行查看也是可以的 。

首先,查看 dmesg 的具体用法:

[root@Seichung ~]# dmesg --help
Usage:
 dmesg [options]

Options:
 -C, --clear                 clear the kernel ring buffer	# 清理 kernel 的 ring buffer 信息
 -c, --read-clear            read and clear all messages	# 在显示信息后再清理 ring buffer 信息
 -D, --console-off           disable printing messages to console	# 禁用打印消息到控制台
 -d, --show-delta            show time delta between printed messages	# 显示打印消息之间的时间差
 -e, --reltime               show local time and time delta in readable format	# 以可读格式显示本地时间和时间增量
 -E, --console-on            enable printing messages to console	# 允许打印消息到控制台
 -F, --file <file>           use the file instead of the kernel log buffer	# 使用该文件而不是内核日志缓冲区
 -f, --facility <list>       restrict output to defined facilities		# 限制输出到定义的设施
 -H, --human                 human readable output		# 人类可读的方式进行输出
 -k, --kernel                display kernel messages	# 显示内核消息
 -L, --color                 colorize messages			# 着色消息
 -l, --level <list>          restrict output to defined levels	# 将输出限制为定义的级别
 -n, --console-level <level> set level of messages printed to console	# 设置记录信息的层级
 -P, --nopager               do not pipe output into a pager		# 不要用管道将输出输出到寻呼机中
 -r, --raw                   print the raw message buffer			# 打印原始消息缓冲区
 -S, --syslog                force to use syslog(2) rather than /dev/kmsg	# 强制使用syslog(2)而不是/ dev / kmsg
 -s, --buffer-size <size>    buffer size to query the kernel ring buffer	# 缓冲区大小以查询内核环缓冲区
 -T, --ctime                 show human readable timestamp (could be 	
                             inaccurate if you have used SUSPEND/RESUME)	# 显示人类可读的时间戳(如果您使用了SUSPEND / RESUME,则可能不准确
 -t, --notime                don't print messages timestamp		# 不打印消息时间戳
 -u, --userspace             display userspace messages		# 显示用户空间信息
 -w, --follow                wait for new messages			# 等待新的信息
 -x, --decode                decode facility and level to readable string	# 将设施和级别解码为可读字符串

 -h, --help     display this help and exit		# 显示该命令的帮助信息并退出
 -V, --version  output version information and exit		# 显示版本信息并退出

Supported log facilities:
    kern - kernel messages
    user - random user-level messages
    mail - mail system
  daemon - system daemons
    auth - security/authorization messages
  syslog - messages generated internally by syslogd
     lpr - line printer subsystem
    news - network news subsystem

Supported log levels (priorities):
   emerg - system is unusable
   alert - action must be taken immediately
    crit - critical conditions
     err - error conditions
    warn - warning conditions
  notice - normal but significant condition
    info - informational
   debug - debug-level messages

上面可以看到,-T 是以人类可读的时间戳显示,那么使用该选项进行查看,如图:

[root@Seichung ~]# dmesg -T | more

在这里插入图片描述

可以看到,系统启动信息,及相关信息都有显示。在一定程度上可以根据该信息进行系统的故障排查。

更多 dmesg 用法将在后续补充,也欢迎各位读者进行补充。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值