1
# bootchart - boot sequence auditing
3
# bootchart allows you to audit the boot sequence of your computer and
4
# generate a pretty chart of the processes run, including how long they
5
# took and how much CPU and I/O they used.
7
description "boot sequence auditing"
9
start on virtual-filesystems
13
grep -q "profile" /proc/cmdline && { stop; exit 0; }
14
grep -q "bootchart=disable" /proc/cmdline && { stop; exit 0; }
16
if grep -q "bootchart=[0-9]*hz" /proc/cmdline
18
HZ=$(sed -e 's/.*bootchart=//;s/hz.*//' /proc/cmdline)
23
mkdir -p /var/run/bootchart
24
exec /lib/bootchart/collector $HZ /var/run/bootchart 2>/dev/null
28
# Sleep for an extra 45s to allow enough time to chart the desktop
30
[ "$UPSTART_STOP_EVENTS" = "stopped" ] && sleep 45
34
if [ -d /dev/.bootchart/log ]
36
LOGS=/dev/.bootchart/log
38
LOGS=/var/run/bootchart
41
# Figure out name for the chart
42
base="$(hostname -s)-$(lsb_release -sc)-$(date +%Y%m%d)"
44
while [ -e "/var/log/bootchart/$base-$count.tgz" -o -e "/var/log/bootchart/$base-$count.png" -o -e "/var/log/bootchart/$base-$count.svg" ]
46
count=$(( $count + 1 ))
49
BASE="/var/log/bootchart/$base-$count"
52
# Gather the output into the tarball
53
/lib/bootchart/gather "$TARBALL" "$LOGS"
55
# Generate SVG and optionally PNG if pybootchartgui is installed
56
if [ -x /usr/bin/bootchart ]
58
if grep -q "bootchart=svg" /proc/cmdline
65
bootchart --format=$format \
66
--crop-after=compiz,metacity,mutter,kwin,xfwm4,unity8 \
67
--annotate=ureadahead,mountall,hostname,hwclock \
69
--annotate=gdm-session-worker \
70
--output="/var/log/bootchart" "$TARBALL"
75
if [ -d /dev/.bootchart ]
77
umount /dev/.bootchart/proc
78
rm -rf /dev/.bootchart