aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/malloc/init.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-08-30 18:56:49 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-08-30 18:56:49 +0300
commit1a2e1fff7ce4b8fd8db46549d81e71e76b842da3 (patch)
treee33fa259bf9de49e589dd1e75a95dcd09ad3bc97 /benchmarks/malloc/init.c
parentec30538a81c0e900797f4d88c1ee059afa7d9617 (diff)
downloadkmi-1a2e1fff7ce4b8fd8db46549d81e71e76b842da3.tar.gz
kmi-1a2e1fff7ce4b8fd8db46549d81e71e76b842da3.zip
add some basic benchmarks
Diffstat (limited to 'benchmarks/malloc/init.c')
-rw-r--r--benchmarks/malloc/init.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/benchmarks/malloc/init.c b/benchmarks/malloc/init.c
new file mode 100644
index 0000000..d58eeb2
--- /dev/null
+++ b/benchmarks/malloc/init.c
@@ -0,0 +1,22 @@
+#include <common/benchmark.h>
+
+START(pid, tid, d0, d1, d2, d3)
+{
+ UNUSED(pid);
+ UNUSED(tid);
+ UNUSED(d0);
+ UNUSED(d1);
+ UNUSED(d2);
+ UNUSED(d3);
+
+ uint64_t timebase = sys_timebase();
+ uint64_t start = sys_ticks();
+
+ for (size_t i = 0; i < 1000; ++i) {
+ void *p = sys_req_mem(1, VM_R | VM_W);
+ sys_free_mem((uintptr_t)p);
+ }
+
+ uint64_t end = sys_ticks();
+ report(start, end, timebase);
+}