aboutsummaryrefslogtreecommitdiffhomepage
path: root/trace_profile/src
diff options
context:
space:
mode:
authorjohannst <johannst@users.noreply.github.com>2024-01-27 01:27:09 +0000
committerjohannst <johannst@users.noreply.github.com>2024-01-27 01:27:09 +0000
commite5b4aacc5d30dedc78fe955de6ab340374ca2920 (patch)
tree2f358c4624067dc0d0c78dcc33a8866b7e5ffc35 /trace_profile/src
parent920d16436e0d5f37e9f6d31236ee87b716f3c82f (diff)
downloadnotes-e5b4aacc5d30dedc78fe955de6ab340374ca2920.tar.gz
notes-e5b4aacc5d30dedc78fe955de6ab340374ca2920.zip
deploy: c649f69634104c80d5da8af20871646e7d06aab1
Diffstat (limited to 'trace_profile/src')
-rw-r--r--trace_profile/src/Makefile8
-rw-r--r--trace_profile/src/noploop.c10
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);
+ }
+}