diff options
author | johannst <johannst@users.noreply.github.com> | 2024-01-27 01:27:09 +0000 |
---|---|---|
committer | johannst <johannst@users.noreply.github.com> | 2024-01-27 01:27:09 +0000 |
commit | e5b4aacc5d30dedc78fe955de6ab340374ca2920 (patch) | |
tree | 2f358c4624067dc0d0c78dcc33a8866b7e5ffc35 /trace_profile/src | |
parent | 920d16436e0d5f37e9f6d31236ee87b716f3c82f (diff) | |
download | notes-e5b4aacc5d30dedc78fe955de6ab340374ca2920.tar.gz notes-e5b4aacc5d30dedc78fe955de6ab340374ca2920.zip |
deploy: c649f69634104c80d5da8af20871646e7d06aab1
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); + } +} |