summaryrefslogtreecommitdiff
path: root/bcache-test.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2010-05-29 17:52:44 -0700
committerKent Overstreet <kent.overstreet@gmail.com>2010-05-29 17:52:44 -0700
commit5cffe67790d96ad515658b3f80cac5d9bc939077 (patch)
treeb61b52e7c13b420ba1ae9bbd15011f2ee4785af1 /bcache-test.c
parentc6d725f9ca45a97f6fcd084550da8d15813b4ae9 (diff)
auto
Diffstat (limited to 'bcache-test.c')
-rw-r--r--bcache-test.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/bcache-test.c b/bcache-test.c
index aa963a9..876f492 100644
--- a/bcache-test.c
+++ b/bcache-test.c
@@ -15,6 +15,7 @@
#include <sys/stat.h>
#include <stdlib.h>
#include <stdint.h>
+#include <time.h>
#include <openssl/rc4.h>
#include <openssl/md4.h>
@@ -103,6 +104,7 @@ int main(int argc, char **argv)
struct pagestuff *pages, *p;
unsigned char c[16];
char *test;
+ time_t last_printed = 0;
printf("strchr: %p\n", strchr);
@@ -168,13 +170,20 @@ int main(int argc, char **argv)
nbytes <<= 12;
offset >>= 12;
- offset += walk ? normal() * 64 : random();
+ offset += walk ? normal() * 20 : random();
offset %= size;
offset <<= 12;
- if (verbose || !(i % 100))
- printf("Loop %6li offset %9li sectors %3i, %6lu mb done\n",
+ if (!verbose) {
+ time_t now = time(NULL);
+ if (now - last_printed >= 5) {
+ last_printed = now;
+ goto print;
+ }
+ } else
+print: printf("Loop %6li offset %9li sectors %3i, %6lu mb done\n",
i, offset >> 9, nbytes >> 9, done >> 11);
+
done += nbytes >> 9;
if (!writing)