aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/trace_profile/perf
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2025-02-21 21:52:42 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2025-02-21 21:52:42 +0100
commitc9bfd7ea16ec63ca689734ad9dd279a8f76d88be (patch)
tree02c71b58997285cfefbc6337354df4df5c5fc7ef /src/trace_profile/perf
parent8167ecb83a8cc75da42a0b398c750d8f3aa4c44b (diff)
downloadnotes-c9bfd7ea16ec63ca689734ad9dd279a8f76d88be.tar.gz
notes-c9bfd7ea16ec63ca689734ad9dd279a8f76d88be.zip
perf: rename src folder
Diffstat (limited to 'src/trace_profile/perf')
-rw-r--r--src/trace_profile/perf/Makefile8
-rw-r--r--src/trace_profile/perf/noploop.c10
2 files changed, 18 insertions, 0 deletions
diff --git a/src/trace_profile/perf/Makefile b/src/trace_profile/perf/Makefile
new file mode 100644
index 0000000..7e887b8
--- /dev/null
+++ b/src/trace_profile/perf/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/src/trace_profile/perf/noploop.c b/src/trace_profile/perf/noploop.c
new file mode 100644
index 0000000..76e664f
--- /dev/null
+++ b/src/trace_profile/perf/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);
+ }
+}