summaryrefslogtreecommitdiffstats
path: root/bootchartd
diff options
context:
space:
mode:
Diffstat (limited to 'bootchartd')
-rwxr-xr-xbootchartd54
1 files changed, 30 insertions, 24 deletions
diff --git a/bootchartd b/bootchartd
index 0b0db4e..43fdfe9 100755
--- a/bootchartd
+++ b/bootchartd
@@ -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