Commit d6f40621 authored by william's avatar william

at clock op to bench.c

parent bafeec9c
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include <locale.h> #include <locale.h>
#include <time.h>
#include <unistd.h> #include <unistd.h>
#include <dlfcn.h> #include <dlfcn.h>
...@@ -115,6 +117,10 @@ struct op *parseop(struct op *op, char *ln) { ...@@ -115,6 +117,10 @@ struct op *parseop(struct op *op, char *ln) {
case 'n': case 'n':
op->type = OP_NONE; op->type = OP_NONE;
break;
case 't':
op->type = OP_TIME;
break; break;
default: default:
op->type = OP_OOPS; op->type = OP_OOPS;
...@@ -193,6 +199,9 @@ int main(int argc, char **argv) { ...@@ -193,6 +199,9 @@ int main(int argc, char **argv) {
--argc; --argc;
} }
if (!MAIN.verbose)
setvbuf(stdout, NULL, _IOFBF, 0);
if (!(MAIN.timeout = calloc(MAIN.count, sizeof *MAIN.timeout))) if (!(MAIN.timeout = calloc(MAIN.count, sizeof *MAIN.timeout)))
err(1, "calloc"); err(1, "calloc");
...@@ -255,9 +264,14 @@ int main(int argc, char **argv) { ...@@ -255,9 +264,14 @@ int main(int argc, char **argv) {
break; break;
case OP_FILL: case OP_FILL:
for (to = MAIN.timeout; to < &MAIN.timeout[MAIN.count]; to++) { for (to = MAIN.timeout; to < &MAIN.timeout[MAIN.count]; to++) {
MAIN.vops.add(to, random() % MAIN.maximum); MAIN.vops.add(to, arc4random_uniform(MAIN.maximum));
//MAIN.vops.add(to, random() % MAIN.maximum);
} }
break;
case OP_TIME:
printf("clock %ld\n", clock());
break; break;
case OP_NONE: case OP_NONE:
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment