Jump to content

Systemd-analyze

From eLinux.org

This page information about <quote>systemd-analyze. It is a tool that is part of the systemd init program suite, that shows the time spent doing various startup activities, including kernel start and the time for the startup of each service.

It is only available if you are using systemd as your init system.

Systemd records timing information for all services and units that it starts, and can analyze that data and show lists and charts of startup activities, to help you debug where your system is spending time during startup.

Examples

Here is an example of running systemd-analyze, with no arguments:

$ systemd-analyze
Startup finished in 25.463s (kernel) + 40.505s (userspace) = 1min 5.969s 
graphical.target reached after 38.574s in userspace

Get the list of services and how much time they took to activate: (This example was on a beaglebone system, running Debian buster)

# systemd-analyze blame
        41.019s generic-board-startup.service
        28.178s dev-mmcblk0p1.device
         4.226s nginx.service
         3.419s systemd-udev-trigger.service
         3.307s loadcpufreq.service
         2.282s networking.service
         1.763s ssh.service
         1.447s systemd-journald.service
         1.406s dnsmasq.service
         1.357s connman.service
         1.296s systemd-logind.service
         1.282s wpa_supplicant.service
         1.278s systemd-timesyncd.service
         1.249s rsyslog.service
         1.002s cpufrequtils.service
          865ms avahi-daemon.service
          782ms systemd-user-sessions.service
          657ms systemd-fsck-root.service
          622ms systemd-modules-load.service
          610ms systemd-update-utmp.service
          581ms dev-mqueue.mount
          500ms systemd-tmpfiles-setup.service
          494ms sys-kernel-debug.mount

Get a plot of startup times for various system elements (mostly systemd services): This creates an SVG file, which can be viewed in a browser or an SVG viewer program.

# systemd-analyze plot >bbb-boot-2024-05-22.svg
(maybe copy to a host here)
(on host) $ eog bbb-boot-2024-05-22.svg

Media:bbb-boot-2024-05-22.svg

Resources

See https://www.tecmint.com/systemd-analyze-monitor-linux-bootup-performance/

Use man systemd-analyze to get help on this program.