[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Boot poster challenge



FWIW.. my bootlog (no flashy graphs though):

   http://users.telenet.be/kvogel/boot.html


Created by following ugly hackish scripting:


--- rc.sysinit.orig     2004-11-18 16:49:52.624083048 +0100
+++ /etc/rc.sysinit     2004-11-18 03:24:43.000000000 +0100
@@ -29,6 +29,11 @@

 . /etc/init.d/functions

+cmdline=$(cat /proc/cmdline)
+if strstr "$cmdline" trace; then
+  nohup </dev/null >/dev/null 2>&1 /bin/bash /etc/rc.tracer &
+fi
+
 # Check SELinux status
 selinuxfs=`awk '/ selinuxfs / { print $2 }' /proc/mounts`
 SELINUX=


----------- /etc/rc.tracer
#!/bin/bash --login
mount -t tmpfs none /mnt/f
(
/sbin/hwclock --hctosys --localtime
while true
do
        echo ============================== $(date)
        ps -eHwwo ppid,pid,fname:20,stat,wchan:16,ni,cp,start,cputime,maj_flt,min_flt,rss,sz,vsz,cmd
        vmstat -d |sed -e '/hda/p' -e '3,$d'
        sleep 0.5
done
) >/mnt/f/boot.stats 2>&1
------------


And I put the following in /etc/rc.local  :

--------------
. /etc/init.d/functions
cmdline=$(cat /proc/cmdline)
if strstr "$cmdline" trace; then
   echo Stopping tracer
   pkill rc.tracer
   egrep -v 'ps -eHwwo|bash --login' /mnt/f/boot.stats >/var/log/boot.stats
   date >>/var/log/boot.stats
   echo -n Unmounting tmpfs:
   umount /mnt/f
   if [ $? -eq 0 ]; then
      success
   else
      failure
      sleep 8
   fi
fi
---------------


Some caveats:
- at the end of rc.sysinit (just after turning the swap on), init
  waits for a key. Pressing CTRL+C makes it continue.
  (I thought the nohup would help, but it doesn't)
- my /usr and /var are in the same partition as my root, so the script
  needs some work when using separate partitions.
- the tmpfs is mounted on /mnt/f
- umount fails, haven't looked why yet


Usage:
- boot with 'trace' on the kernel commandline. After bootup there will
  be a /var/log/boot.stats file.


Use the following perl script to generate the html output:

--- boot2html ---
#!/usr/bin/perl
open(IN, "</var/log/boot.stats") or die;
open(OUT, ">boot.html");
print OUT "<HTML><BODY><PRE>";
while(<IN>) {
        s/</&lt;/g;
        s/>/&gt;/g;
        @arg= split;
        if (/=======/) {
                print OUT "<HR><FONT SIZE=+2>$_</FONT><HR>";
        } elsif ( $arg[3] =~ /R/) {
                print OUT "<FONT COLOR=red>$_</FONT>";
        } elsif ( $arg[3] =~ /D/) {
                print OUT "<FONT COLOR=blue>$_</FONT>";
        } else {
                print OUT $_;
        }
}

print OUT "</PRE></BODY></HTML>";
close(OUT);
close(IN);
--------------

Feel free to add some GD.pm lovin' to the script :-)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]