# Linux Kernel Module Cheat

### 24.8. m5ops

m5ops are magic instructions which lead gem5 to do magic things, like quitting or dumping stats.

Documentation: http://gem5.org/M5ops

There are two main ways to use m5ops:

- gem5 m5 executable

- m5ops instructions

`m5` is convenient if you only want to take snapshots before or after the benchmark, without altering its source code. It uses the m5ops instructions as its backend.

`m5` cannot should / should not be used however:

- in bare metal setups

- when you want to call the instructions from inside interest points of your benchmark. Otherwise you add the syscall overhead to the benchmark, which is more intrusive and might affect results.

  Why not just hardcode some m5ops instructions as in our example instead, since you are going to modify the source of the benchmark anyway?

- gem5 m5 executable

- m5ops instructions