Take the 2-minute tour ×

I am trying to optimise the boot-up time of linux on an embedded device (not PC)

Currently to profile the boot-up sequence,
I have enabled the timing info on printk logs.

Is this the most optimum way?
If not, how do i profile the boot-up sequence (with timing) with minimum overhead?

I have a terminal (of the device) over a serial-connection &
I use TeraTerm over windows-XP to access it.

share|improve this question
add comment

2 Answers

The overhead of printk timing info is very small. However, this information is not always useful, because it does not tell you what is happening in the userspace.

You might want to try Bootchart. It is a shell script that runs in the background during boot and collects data from /proc. Although it has a larger overhead than printk timing info, it is more detailed and allows you to profile process startup and disk utilization.


share|improve this answer
@ Krzysztof I did try Bootchartd. But, it just gives me the timing of start-end of processes etc. How do i time a specific "part of code"... Any other tools u know of??... –  TheCodeArtist Jun 21 '10 at 3:45
You can try profiling the usual way: compile with -pg, then use gprof on the output. However, the overhead is quite substantial. –  Krzysztof Kosiński Jul 4 '10 at 9:59
add comment
up vote 1 down vote accepted

Its been a long time but updating the answer here for reference.

Here is what i finally ended up doing:

  1. Enabled timestamps on my serial terminal client on PC (TeraTerm).

    Actually enabled capturing log to a file on disk &
    selected option to add a timestamp to each line.

  2. Added printk() statements in the kernel.

    • 1st at the start of the block i was trying to profile.
    • 2nd at the end of the block i was trying to profile.

Though there is a slight delay between when an event occurs on the device and when the logs are received on the host PC via serial, this is fairly constant on a given hardware setup. Hence difference between two timestamps are accurate to the actual time-diff between the events on the device that generated those logs. Also overhead/side-effect of 2 printk statements is minimal.

2 yrs down the line, and hundreds of hours of kernel-debugging later, i would recommend using function tracers. It involves a little bit of effort to learn though. As nicely explained here, one needs to :

  • Enable CONFIG_FUNCTION_TRACER in the .config
  • Use trace_printk() instead of printk()
  • Check output logs by cat /sys/kernel/debug/tracing/trace
share|improve this answer
add comment

Your Answer


