内核评估方法:
在启动参数里添加 initcall_debug,能得到更多内核 log:
- [ 3.750000] calling ov2640_i2c_driver_init+0x0/0x10 @ 1
- [ 3.760000] initcall ov2640_i2c_driver_init+0x0/0x10 returned 0 after 544 usecs
- [ 3.760000] calling at91sam9x5_video_init+0x0/0x14 @ 1
- [ 3.760000] at91sam9x5-video f0030340.lcdheo1: video device registered @ 0xe0d3e340, irq = 24
- [ 3.770000] initcall at91sam9x5_video_init+0x0/0x14 returned 0 after 10388 usecs
- [ 3.770000] calling gspca_init+0x0/0x18 @ 1
- [ 3.770000] gspca_main: v2.14.0 registered
- [ 3.770000] initcall gspca_init+0x0/0x18 returned 0 after 3966 usecs
- ...
另外,可以用 scripts/bootgraph.pl 将 dmesg 的信息转换成图片:
$ scripts/bootgraph.pl boot.log > boot.svg
接下来,找出消耗时间最多的环节,进行优化。