# test files/objects
.test/
+
+# bench files/objects
+.bench/
inc/usage.h \
inc/watch.h
-SUBDIRS = . test/unit
+SUBDIRS = . test/unit bench
--- /dev/null
+AM_CPPFLAGS = \
+ -DPREFIX=\".bench\" \
+ -Wall \
+ -Werror
+
+EXTRA_DIST = \
+ bench_utils.h
+
+bin_PROGRAMS = add_bench
+
+common_SOURCES = \
+ bench_utils.c
+
+add_bench_SOURCES = \
+ $(common_SOURCES) \
+ add.bench.c
--- /dev/null
+#include<bench_utils.h>
+
+int main();
+
+int main() {
+ char template[] = PREFIX "/XXXXXX";
+ create_tmp_file(template,10000);
+
+ return EXIT_SUCCESS;
+}
--- /dev/null
+#include<bench_utils.h>
+
+void create_tmp_file(char *template, size_t size) {
+ int urandom, fd;
+ char buf[65636];
+ ssize_t i;
+
+ urandom = open("/dev/urandom",O_RDONLY);
+ assert(urandom!=-1);
+
+ fd = mkstemp(template);
+ assert(fd!=-1);
+
+ while(size>0) {
+ i = read(urandom,buf,65636);
+ assert(i!=-1);
+
+ assert(i==write(fd,buf,i));
+ size -= i;
+ }
+
+ close(urandom);
+ close(fd);
+}
--- /dev/null
+#ifndef __BENCH_UTILS_H_
+#define __BENCH_UTILS_H_
+
+#include<assert.h>
+#include<fcntl.h>
+#include<stdint.h>
+#include<stdio.h>
+#include<stdlib.h>
+#include<sys/types.h>
+#include<sys/stat.h>
+#include<unistd.h>
+
+void create_tmp_file(char*,uint64_t);
+
+#endif
AC_CHECK_FUNCS([atexit])
AC_CONFIG_FILES([Makefile
+ bench/Makefile
test/unit/Makefile])
AC_OUTPUT