diff options
author | Tom Gundersen <teg@jklm.no> | 2012-05-18 04:18:47 +0200 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2012-05-18 19:09:38 +0200 |
commit | 7eb40daaae07520557d20fd41941026108faddfa (patch) | |
tree | a67e040425bee6c6167afae7afc316f3ff041976 | |
parent | f88b2b53a4b2dcb177cb8b7197e2a61fd510c7ef (diff) | |
download | mkinitcpio-7eb40daaae07520557d20fd41941026108faddfa.tar.gz mkinitcpio-7eb40daaae07520557d20fd41941026108faddfa.tar.xz |
init: add timestamp at start of initramfs if binary exists
This will allow us to tell how much time was spent in the initramfs,
which might be good for working on optimizations and making sure we
don't regress.
If a binary able to produce the timestamp is not installed this is a
noop.
I'll post separately an install hook to the systemd package that will
install systemd-timestamp. However, it would be trivial to replace this
by an independent implementation if people want to use this without
systemd.
With this patch I get the following on my (ancient) laptop:
$ systemd-analyze
Startup finished in 294ms (kernel) + 2684ms (initramfs) + 15741ms (userspace) = 18720ms
FWIW, 1 second is spent on inserting the needed modules, and 1.5 seconds
on mounting the rootfs (mounting btrfs is slow!).
Signed-off-by: Tom Gundersen <teg@jklm.no>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rw-r--r-- | init | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -2,6 +2,10 @@ PATH=/usr/bin udevd_running=0 +if [ -x /usr/bin/systemd-timestamp ]; then + RD_TIMESTAMP=$(systemd-timestamp) +fi + . /init_functions mount -t proc proc /proc -o nosuid,noexec,nodev @@ -72,6 +76,9 @@ if [ "${break}" = "postmount" ]; then launch_interactive_shell fi -exec env -i "TERM=$TERM" /sbin/switch_root /new_root $init "$@" +exec env -i \ + "TERM=$TERM" \ + "RD_TIMESTAMP=$RD_TIMESTAMP" \ + /usr/bin/switch_root /new_root $init "$@" # vim: set ft=sh ts=4 sw=4 et: |