# Linux Kernel Module Cheat

##### 35.2.3.2. Benchmark Buildroot build baseline

This is the minimal build we could expect to get away with.

We will run this whenever the Buildroot submodule is updated.

On the upstream Buildroot repo at :

    ./bench-all -B

Sample time on 2017.08: 11 minutes, 7 with full ccache hits. Breakdown: 47% GCC, 15% Linux kernel, 9% uclibc, 5% host-binutils. Conclusions:

- we have bloated our kernel build 3x with all those delicious features :-)

- GCC time increased 1.5x by our bloat, but its percentage of the total was greatly reduced, due to new packages being introduced.

  `make graph-depends` shows that most new dependencies come from QEMU and GDB, which we can’t get rid of anyway.

A quick look at the system monitor reveals that the build switches between times when:

- CPUs are at a max, memory is fine. So we must be CPU / memory speed bound. I bet that this happens during heavy compilation.

- CPUs are not at a max, and memory is fine. So we are likely disk bound. I bet that this happens during configuration steps.

This is consistent with the fact that ccache reduces the build time only partially, since ccache should only overcome the CPU bound compilation steps, but not the disk bound ones.

The instructions counts varied very little between the baseline and LKMC, so runtime overhead is not a big deal apparently.

Size:

- `bzImage`: 4.4M

- `rootfs.cpio`: 1.6M

Zipped: 4.9M, `rootfs.cpio` deflates 50%, `bzImage` almost nothing.