diff options
author | Timo Teras <timo.teras@iki.fi> | 2009-03-03 19:43:26 +0200 |
---|---|---|
committer | Timo Teras <timo.teras@iki.fi> | 2009-03-03 19:43:26 +0200 |
commit | 8fb3af8d05555bc4a8206b7f524826bad77ad948 (patch) | |
tree | a2b3c1d86852c5f6a084944a6e436e7a19759bec /bootchartd | |
parent | cd5e0181517577a0c15d8f474a464f7464230080 (diff) | |
download | abuild-8fb3af8d05555bc4a8206b7f524826bad77ad948.tar.gz abuild-8fb3af8d05555bc4a8206b7f524826bad77ad948.tar.bz2 abuild-8fb3af8d05555bc4a8206b7f524826bad77ad948.tar.xz abuild-8fb3af8d05555bc4a8206b7f524826bad77ad948.zip |
initramfs: process accounting & misc fixes
enable bootchartd to use kernel process accounting for noticing
all processes.
also fix various little bits around the initramfs init.
Diffstat (limited to 'bootchartd')
-rwxr-xr-x | bootchartd | 54 |
1 files changed, 30 insertions, 24 deletions
@@ -17,8 +17,8 @@ PATH="/sbin:/bin:/usr/sbin:/usr/bin:$PATH" # Configuration for bootchartd, the bootchart logger script. TMPFS_SIZE=32m -SAMPLE_PERIOD=0.1 -PROCESS_ACCOUNTING="no" +SAMPLE_PERIOD=0.2 +PROCESS_ACCOUNTING="yes" BOOTLOG_DEST=/var/log/bootchart.tgz LOGDIR=/bootchart EXIT_PROC="mingetty agetty rungetty getty fgetty" @@ -97,7 +97,7 @@ do_logging() i=$(($i + 1)) done - [ -e kernel_pacct ] && accton off + [ -e kernel_pacct ] && accton } # Stop the boot logger. The lock file is removed to force the loggers in @@ -155,37 +155,43 @@ finalize() } case "$1" in -init) - # Started by the kernel or by the init script. +start-initfs) NEWROOT="$2" - mkdir "$LOGDIR" - cd "$LOGDIR" - ( + cleanup=true trap "not_stop_logging=false" USR1 - reexec=false - trap "reexec=true; not_stop_logging=false" USR2 + trap "cleanup=false; not_stop_logging=false" USR2 + mkdir "$LOGDIR" + cd "$LOGDIR" do_logging - if $reexec; then - mkdir "$NEWROOT$LOGDIR" - mv * "$NEWROOT$LOGDIR" - cp /sbin/bootchartd $NEWROOT/sbin - exec chroot $NEWROOT /sbin/bootchartd continue_logging \ - "$LOGDIR" </newroot/dev/null \ - >$NEWROOT/dev/console 2>&1 - else - sleep $SAMPLE_PERIOD + if $cleanup; then sleep $SAMPLE_PERIOD finalize fi ) & + echo $! > $LOGDIR/bootchart.pid + ;; +stop-initfs) + NEWROOT="$2" + + cd "$LOGDIR" + mkdir "$NEWROOT$LOGDIR" + cp /sbin/bootchartd $NEWROOT/sbin + PID=`cat bootchart.pid` + kill -USR2 $PID + wait $PID + mv * "$NEWROOT$LOGDIR" ;; -continue_logging) - cd "$2" - trap "not_stop_logging=false" USR1 - do_logging - finalize +start-rootfs) + ( + trap "not_stop_logging=false" USR1 + cd "$LOGDIR" + do_logging + finalize + ) & + shift + exec "$@" ;; esac |