On Sat, 2004-11-13 at 12:18 -0500, Owen Taylor wrote:
It should be possible to start with a limited set of easily
collected
data and already get a useful picture. Useful data collection could be
as simple as taking a snapshot of the data that the "top" program
displays a few times a second during boot. That already gives you a
list of the running processes, their states, and some statistics about
global system load.
So I gave this a try:
1. I modified the boot procedure so that early in rc.sysinit, a tmpfs is
mounted and top is run in batch mode (to output every 0.2 seconds). The
logged output is later parsed only up to the point where gdmgreeter is
running and the system is relatively idle (i.e. boot complete and ready
for login).
2. A Java program parses the log file, builds the process tree and
finally renders a PNG chart. Processes are sorted by PID and traversed
depth first.
This still needs more work but here's a sneak preview:
http://www.klika.si/ziga/bootchart/bootchart.png
(as a result of
http://www.klika.si/ziga/bootchart/bootop.log.gz )
Some processes were filtered out for clarity -- mostly sleepy kernel
processes and the ones that only live for the duration of a single top
sample. This skews the chart a bit but is definitely more
comprehensible (compare with
http://www.klika.si/ziga/bootchart/bootchart-complete.png ).
Some things I plan on adding:
- start logging earlier in the boot process (possibly in initrd),
- add additional layers (e.g. make use of the kernel patch Arjan
suggested for showing the number of open files),
- improve process tree representation and add dependency lines,
- render SVG instead, for scalability and interactivity.
This definitely helped me with my boot times -- the 4-second load gap at
the start I found to be "modprobe floppy", apparently timing out on my
floppyless laptop :)
Any ideas or comments are welcome,
--
Ziga