aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/fork
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks/fork')
-rw-r--r--benchmarks/fork/init.c27
-rw-r--r--benchmarks/fork/source.mk1
2 files changed, 28 insertions, 0 deletions
diff --git a/benchmarks/fork/init.c b/benchmarks/fork/init.c
new file mode 100644
index 0000000..95f6466
--- /dev/null
+++ b/benchmarks/fork/init.c
@@ -0,0 +1,27 @@
+#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) {
+ id_t our_tid = 0;
+ id_t new_id = sys_fork(&our_tid);
+ if (new_id == 0) {
+ /* child instantly dies */
+ sys_exit(1);
+ }
+ sys_swap(new_id);
+ }
+
+ uint64_t end = sys_ticks();
+ report(start, end, timebase);
+}
diff --git a/benchmarks/fork/source.mk b/benchmarks/fork/source.mk
new file mode 100644
index 0000000..46bde60
--- /dev/null
+++ b/benchmarks/fork/source.mk
@@ -0,0 +1 @@
+DO != ./scripts/gen-benchmark -n fork