#include <sys/time.h>
#include <sys/types.h>
+#include <sys/mman.h>
#include <assert.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
-#define BUFFER 16*1024*1024
+#ifndef RWBUFFER_SIZE_MB
+#define RWBUFFER_SIZE_MB 16
+#endif
+
+#define BUFFER (RWBUFFER_SIZE_MB*1024*1024)
#define WAITEMPTY ((BUFFER*1)/4)
static inline int min(int a, int b) { return a<=b ? a : b; }