# Linux Kernel Module Cheat
The perfect emulation setup to study and develop the <<linux-kernel>> v5.9.2, kernel modules, <<qemu-buildroot-setup,QEMU>>, <<gem5-buildroot-setup,gem5>> and x86_64, ARMv7 and ARMv8 <<userland-assembly,userland>> and <<baremetal-setup,baremetal>> assembly, <<c,ANSI C>>, <<cpp,C++>> and <<posix,POSIX>>. <<gdb>> and <<kgdb>> just work. Powered by <<about-the-qemu-buildroot-setup,Buildroot>> and <<about-the-baremetal-setup,crosstool-NG>>. Highly automated. Thoroughly documented. Automated <<test-this-repo,tests>>.

#### 24.16.3. gem5 prof and perf builds

Profiling builds as of 3cea7d9ce49bda49c50e756339ff1287fd55df77 both use: `-g -O3` and disable asserts and logging like the gem5 fast build and:

- `prof` uses `-pg` for gprof

- `perf` uses `-lprofile` for google-pprof

Profiling techniques are discussed in more detail at: Profiling userland programs.

For the `prof` build, you can get the `gmon.out` file with:

    ./run --arch aarch64 --emulator gem5 --userland userland/c/hello.c --gem5-build-type prof
    gprof "$(./getvar --arch aarch64 gem5_executable)" > tmp.gprof