TableOfContents

Introduction

"Instrumented printk" is a simple technology which adds some code to the standard kernel printk routine, to output timing data with each message. While crude, this can be used to get an overview of the areas of kernel initialization which take a relatively long time. This feature is used by the Bootup Time Working Group to identify areas of the Linux kernel requiring work to improve bootup time, and to measure the improvements of changes made by the working group.

The technology for this feature consists of a patch and a utility program. The patch alters the printk code in the kernel to emit the timing data.

The utility program is provided as a convenience for rewriting the results in an easier-to-read format. The system normally emits the timing data as a floating point number of seconds (to microsecond resolution) for the time at which the printk started. The utility program can reformat this data to seconds (including a decimal portion) between calls (deltas) and seconds relative to a single specified call. This makes it easier to see the timing for specific segments of kernel code.

Rationale

Other timing instrumentation systems for the kernel exist, and have more advanced features than this. However, this system is very simple and robust. It does not require extra programs, interfaces in proc of sysfs, or even a root filesystem, in order to obtain measurements of bootup time. It's weakness is that you can only see timing information for areas of the kernel which have printks. In order to get per-call timing data, you have to add additional printks to the area of interest. Also, printks can have high overhead themselves when they are output over a serial line.

Downloads

Patch

Utility program

show_delta is a program to read the information from the printk output, and display the time values as delta's between printks, instead of as absolute values.

Here's the program: attachment:show_delta (Please use the one in the scripts directory of the kernel, if using a patch against Linux 2.6.xx or above)

How To Use (2.6 version of patch)

How To Use (2.4 version of patch)

Sample Results

Sample Results for dmesg output for 2.6.11-rc4:


Sample Results for show_delta:

Future Work

Here are some ideas for additional work needed on this system:

InstrumentedPrintk (last edited 2005-04-11 19:35:30 by cache3-outside-a)