概述
分析总体耗时
$ systemd-analyze Startup finished in 4.718s (kernel) + 10.642s (userspace) = 15.361s graphical.target reached after 10.472s in userspace
分析关键耗时
$ systemd-analyze critical-chain The time after the unit is active or started is printed after the "@" character. The time the unit takes to start is printed after the "+" character. graphical.target @8.912s └─udisks2.service @6.607s +2.288s └─basic.target @6.507s └─sockets.target @6.495s └─docker.socket @6.368s +76ms └─sysinit.target @6.332s └─swap.target @6.323s └─dev-sda3.swap @6.114s +195ms └─dev-sda3.device @6.027s
分析每个服务的耗时
$ systemd-analyze blame 5.107s dev-sda1.device 2.288s udisks2.service 1.404s systemd-udev-trigger.service 1.237s user@1000.service 1.085s systemd-journald.service 841ms NetworkManager.service 736ms systemd-udevd.service 702ms systemd-logind.service 620ms ssh.service 559ms rsyslog.service 479ms alsa-restore.service 450ms wpa_supplicant.service 426ms systemd-timesyncd.service 419ms lightdm.service 409ms avahi-daemon.service 405ms networking.service 382ms systemd-sysusers.service 347ms polkit.service 347ms systemd-hostnamed.service 329ms systemd-sysctl.service 309ms systemd-random-seed.service 296ms dev-mqueue.mount 240ms systemd-update-utmp.service
将每个服务的耗时输出到图片
$ systemd-analyze plot > boot.svg
列出所有开机启动的服务
$ systemctl list-unit-files --type=service | grep enabled apparmor.service enabled autovt@.service enabled avahi-daemon.service enabled binfmt-support.service enabled cron.service enabled dbus-fi.w1.wpa_supplicant1.service enabled dbus-org.freedesktop.Avahi.service enabled dbus-org.freedesktop.nm-dispatcher.service enabled dbus-org.freedesktop.timesync1.service enabled getty@.service enabled network-manager.service enabled networking.service enabled NetworkManager-dispatcher.service enabled NetworkManager.service enabled pppd-dns.service enabled rsyslog.service enabled ssh.service enabled sshd.service enabled syslog.service enabled systemd-fsck-root.service enabled-runtime systemd-timesyncd.service enabled udisks2.service enabled vsftpd.service enabled wpa_supplicant.service enabled
最后
以上就是喜悦小伙为你收集整理的系统启动耗时分析systemd 常用命令分析总体耗时的全部内容,希望文章能够帮你解决系统启动耗时分析systemd 常用命令分析总体耗时所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复