Linux Kernel Load Optimization Timing

I am trying to optimize Linux boot time on an embedded device (not a PC).

Currently for boot sequence profile,
I have included time information in printk logs.

Is this the best way?
If not, how can I profile the boot sequence (with synchronization) with minimal overhead?

PS:
I have terminal (s) over a serial connection & I use TeraTerm over Windows XP to access it.

+4
source share
2 answers

It has been a long time, but updated the answer here for reference.

Here is what I finally finished:

  • Timestamps are enabled on my client terminal on a PC (TeraTerm).

    Actually allowed to write the log to a file on disk &
    Selected option to add a timestamp to each line.

  • Added printk() statements in the kernel.

    • 1st at the beginning of the block that I was trying to configure.
    • 2nd at the end of the block I was trying to configure.

Despite the slight delay between events on the device and when receiving logs on the host PC via the serial port, this is a fairly constant value for this hardware setting. Consequently, the difference between the two timestamps is accurate with the actual time-diff between the events on the device that generated these logs. Also the overhead / side effects of the 2 printk statements are minimal.


UPDATE: 2 years after the end of the line and hundreds of hours of kernel debugging, I would recommend using the tracers functions . It takes a little effort to learn. As it is well said here , you need:

  • Include CONFIG_FUNCTION_TRACER in .config
  • Use trace_printk() instead of printk()
  • Check output logs cat /sys/kernel/debug/tracing/trace
+1
source

The overhead of printing timeline information is very small. However, this information is not always useful because it does not tell you what is happening in user space.

You might want to try Bootchart. This is a shell script that runs in the background at boot time and collects data from / proc. Although it has more overhead than print time information, it is more detailed and allows you to profile the process of starting and using the disk.

http://www.bootchart.org/

+2
source

Source: https://habr.com/ru/post/1312416/


All Articles