diff options
Diffstat (limited to 'trace_profile/src')
-rw-r--r-- | trace_profile/src/Makefile | 8 | ||||
-rw-r--r-- | trace_profile/src/noploop.c | 10 |
2 files changed, 18 insertions, 0 deletions
diff --git a/trace_profile/src/Makefile b/trace_profile/src/Makefile new file mode 100644 index 0000000..7e887b8 --- /dev/null +++ b/trace_profile/src/Makefile @@ -0,0 +1,8 @@ +ipc: noploop + perf stat -e cycles,instructions -- ./noploop + +noploop: + $(CC) -o noploop noploop.c + +clean: + $(RM) noploop diff --git a/trace_profile/src/noploop.c b/trace_profile/src/noploop.c new file mode 100644 index 0000000..76e664f --- /dev/null +++ b/trace_profile/src/noploop.c @@ -0,0 +1,10 @@ +#define NOP4 "nop\nnop\nnop\nnop\n" +#define NOP32 NOP4 NOP4 NOP4 NOP4 NOP4 NOP4 NOP4 NOP4 +#define NOP256 NOP32 NOP32 NOP32 NOP32 NOP32 NOP32 NOP32 NOP32 +#define NOP2048 NOP256 NOP256 NOP256 NOP256 NOP256 NOP256 NOP256 NOP256 + +int main() { + for (unsigned i = 0; i < 2000000; ++i) { + asm volatile(NOP2048); + } +} |