# Linux Kernel Module Cheat

##### 35.2.2.1. User mode vs full system benchmark

Let’s see if user mode runs considerably faster than full system or not, ignoring the kernel boot.

First we build dhrystonee manually statically since dynamic linking is broken in gem5 as explained at: Section 11.7, “gem5 syscall emulation mode”.

gem5 user mode:

    ./build-buildroot --arch arm --config 'BR2_PACKAGE_DHRYSTONE=y'
    make \
      -B \
      -C "$(./getvar --arch arm buildroot_build_build_dir)/dhrystone-2" \
      CC="$(./run-toolchain --arch arm --print-tool gcc)" \
      CFLAGS=-static \
    ;
    time \
      ./run \
      --arch arm \
      --emulator gem5 \
      --userland "$(./getvar --arch arm buildroot_build_build_dir)/dhrystone-2/dhrystone" \
      --cli-args 'asdf qwer' \
    ;

gem5 full system:

    time \
      ./run \
      --arch arm \
      --eval-after './gem5.sh' \
      --emulator gem5
      --gem5-readfile 'dhrystone 100000' \
    ;

QEMU user mode:

    time qemu-arm "$(./getvar --arch arm buildroot_build_build_dir)/dhrystone-2/dhrystone" 100000000

QEMU full system:

    time \
      ./run \
      --arch arm \
      --eval-after 'time dhrystone 100000000;./linux/poweroff.out' \
    ;

Result on 2017 Lenovo ThinkPad P51 at bad30f513c46c1b0995d3a10c0d9bc2a33dc4fa0:

- gem5 user: 33 seconds

- gem5 full system: 51 seconds

- QEMU user: 45 seconds

- QEMU full system: 223 seconds