# Linux Kernel Module Cheat

#### 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