Update synthetic RPC client to record timing.
[bluesky.git] / microbench / readbench.c
index 84d6a82..043a2cf 100644 (file)
@@ -1,11 +1,13 @@
+#include <errno.h>
+#include <inttypes.h>
+#include <pthread.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <unistd.h>
-#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
 #include <time.h>
-#include <pthread.h>
+#include <unistd.h>
 
 struct thread_state {
     pthread_t thread;
@@ -61,6 +63,11 @@ void *benchmark_thread(void *arg)
     int64_t start, end;
 
     start = now_hires();
+
+    struct stat stat_buf;
+    stat(namebuf, &stat_buf);
+
+#if 0
     FILE *f = fopen(namebuf, "rb");
     if (f == NULL) {
         perror("fopen");
@@ -69,11 +76,12 @@ void *benchmark_thread(void *arg)
 
     char buf[4096];
     fread(buf, 1, sizeof(buf), f);
+#endif
 
     end = now_hires();
     printf("Thread %d: Time = %"PRIi64"\n", ts->thread_num, end - start);
 
-    fclose(f);
+    // fclose(f);
 
     return NULL;
 }