Commit d6f40621 authored by william's avatar william

at clock op to bench.c

parent bafeec9c
......@@ -5,6 +5,8 @@
#include <locale.h>
#include <time.h>
#include <unistd.h>
#include <dlfcn.h>
......@@ -115,6 +117,10 @@ struct op *parseop(struct op *op, char *ln) {
case 'n':
op->type = OP_NONE;
break;
case 't':
op->type = OP_TIME;
break;
default:
op->type = OP_OOPS;
......@@ -193,6 +199,9 @@ int main(int argc, char **argv) {
--argc;
}
if (!MAIN.verbose)
setvbuf(stdout, NULL, _IOFBF, 0);
if (!(MAIN.timeout = calloc(MAIN.count, sizeof *MAIN.timeout)))
err(1, "calloc");
......@@ -255,9 +264,14 @@ int main(int argc, char **argv) {
break;
case OP_FILL:
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;
case OP_NONE:
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