From e5b4aacc5d30dedc78fe955de6ab340374ca2920 Mon Sep 17 00:00:00 2001 From: johannst Date: Sat, 27 Jan 2024 01:27:09 +0000 Subject: deploy: c649f69634104c80d5da8af20871646e7d06aab1 --- trace_profile/src/Makefile | 8 ++++++++ trace_profile/src/noploop.c | 10 ++++++++++ 2 files changed, 18 insertions(+) create mode 100644 trace_profile/src/Makefile create mode 100644 trace_profile/src/noploop.c (limited to 'trace_profile/src') 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); + } +} -- cgit v1.2.3