projects
/
bluesky.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Do not drop data from cache immediately after a write.
[bluesky.git]
/
microbench
/
readbench.c
diff --git
a/microbench/readbench.c
b/microbench/readbench.c
index
84d6a82
..
043a2cf
100644
(file)
--- a/
microbench/readbench.c
+++ b/
microbench/readbench.c
@@
-1,11
+1,13
@@
+#include <errno.h>
+#include <inttypes.h>
+#include <pthread.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.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 <time.h>
-#include <
pthrea
d.h>
+#include <
unist
d.h>
struct thread_state {
pthread_t thread;
struct thread_state {
pthread_t thread;
@@
-61,6
+63,11
@@
void *benchmark_thread(void *arg)
int64_t start, end;
start = now_hires();
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");
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);
char buf[4096];
fread(buf, 1, sizeof(buf), f);
+#endif
end = now_hires();
printf("Thread %d: Time = %"PRIi64"\n", ts->thread_num, end - start);
end = now_hires();
printf("Thread %d: Time = %"PRIi64"\n", ts->thread_num, end - start);
- fclose(f);
+
//
fclose(f);
return NULL;
}
return NULL;
}