ref: 16a2cc57f9cd49f84db08e9c46478d8d0acfdf45
parent: 00128bc62f7b3d643caa11754e96387ac8e0830d
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Jul 14 10:51:42 EDT 2025
libc: add initial libc benchmarks
--- a/bench.c
+++ b/bench.c
@@ -224,7 +224,7 @@
else if(cyperop < 100)
snprint(cyop, sizeof(cyop), "%12.1f cy/op", (double)res->cycles / (double)res->N);
else
- snprint(cyop, sizeof(cyop), "%10ulld cy/op", cyperop);
+ snprint(cyop, sizeof(cyop), "%10ulld cy/op", cyperop);
print("%10d N %s\t%s\n", res->N, tmop, cyop);
}
@@ -262,17 +262,10 @@
if(strncmp(name, "bench", 5) == 0)
name += 5;
- print("%16s\t", name);
+ print("%24s\t", name);
res = benchrun(&b);
benchres(&res);
-}
-
-void
-xbench(char *name, void (*fn)(B*), void (*init)(void))
-{
- init();
- bench(name, fn);
}
// bench an array of functions
--- a/bench.h
+++ b/bench.h
@@ -34,8 +34,13 @@
extern int NPROC;
+enum {
+ KiB = 1024,
+ MiB = 1024*KiB,
+ GiB = 1024*MiB,
+};
+
#define BM(func) bench("func", func)
-#define XBM(func, init) xbench("func", func, init)
// public api
void benchinit(int, char**);
--- a/fsio.c
+++ b/fsio.c
@@ -6,12 +6,6 @@
char *benchdir;
char randbuf[128*IOUNIT];
-enum {
- KiB = 1024,
- MiB = 1024*KiB,
- GiB = 1024*MiB,
-};
-
#define Nfiles 8
#define Filesz 128*MiB
--- a/mkfile
+++ b/mkfile
@@ -7,6 +7,7 @@
spawn\
fcall\
fsio\
+ libc\
OFILES=\
bench.$O\
--
⑨