[systemd-devel] Profiling systemctl daemon-reload

Kay Sievers kay at vrfy.org
Wed Jul 24 17:49:43 PDT 2013

On Wed, Jul 24, 2013 at 10:26 PM, David Strauss <david at davidstrauss.net> wrote:
> With thousands of units, doing a daemon-reload puts a surprisingly
> huge CPU and memory burden on the system. Has anyone profiled why? I'd
> like to get started on optimizing this, but I'll obviously need to
> understand where the problem is first.

You might want to try the below, it should give a rough idea what's
going on in your setup:

Attach perf:
  perf record -p 1

Trigger the work in PID1 from another shell:
  systemctl daemon-reload

Ctrl-C perf, and run:
  perf report

to see the results.

Here it shows stuff like:
  Samples: 79  of event 'cycles', Event count (approx.): 71757534
24.12%  systemd  libdbus-1.so.3.7.4  [.] 0x000000000001cb84
  3.79%  systemd  [kernel.kallsyms]   [k] system_call
  3.62%  systemd  systemd             [.] string_hash_func
  3.03%  systemd  systemd             [.] hash_scan
  2.61%  systemd  libc-2.17.so        [.] __strlen_sse2_pminub
  2.46%  systemd  [kernel.kallsyms]   [k] _raw_spin_lock
  2.44%  systemd  systemd             [.] unit_add_name
  2.42%  systemd  systemd             [.] config_parse
  2.41%  systemd  libc-2.17.so        [.] __strchr_sse42
  2.39%  systemd  systemd             [.] strjoin
  2.38%  systemd  libc-2.17.so        [.] __strcmp_sse42


More information about the systemd-devel mailing list