Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
timeout.c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
timeout.c
Commits
7a7f63a8
Commit
7a7f63a8
authored
Feb 02, 2014
by
william
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove main from bench.c and fix typo in makefile
parent
ff505515
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
135 deletions
+1
-135
Makefile
Makefile
+1
-1
bench.c
bench.c
+0
-134
No files found.
Makefile
View file @
7a7f63a8
...
...
@@ -34,7 +34,7 @@ else
SOFLAGS
=
-shared
endif
ifeq
($(shell
-
uname -s), Linux)
ifeq
($(shell uname -s), Linux)
LIBS
=
-lrt
endif
...
...
bench.c
View file @
7a7f63a8
...
...
@@ -199,137 +199,3 @@ int luaopen_bench(lua_State *L) {
return
1
;
}
/* luaopen_bench() */
#if 0
int main(int argc, char **argv) {
extern char *optarg;
extern int optind;
int optc;
struct vops *vops;
char cmd[256];
struct op op;
setlocale(LC_ALL, "C");
while (-1 != (optc = getopt(argc, argv, SHORT_OPTS))) {
switch (optc) {
case 'n':
MAIN.count = strtoul(optarg, NULL, 0);
break;
case 't':
MAIN.maximum = (strtod(optarg, NULL) * TIMEOUT_mHZ);
break;
case 'v':
MAIN.verbose++;
break;
case 'h':
usage(stdout);
return 0;
default:
usage(stderr);
return 1;
} /* switch() */
} /* while() */
argv += optind;
argc -= optind;
if (argc > 0) {
MAIN.path = *argv++;
--argc;
}
if (!MAIN.verbose)
setvbuf(stdout, NULL, _IOFBF, 0);
if (!(MAIN.timeout = calloc(MAIN.count, sizeof *MAIN.timeout)))
err(1, "calloc");
if (!(MAIN.solib = dlopen(MAIN.path, RTLD_NOW|RTLD_LOCAL)))
errx(1, "%s: %s", MAIN.path, dlerror());
if (!(vops = dlsym(MAIN.solib, "VOPS")))
errx(1, "%s: %s", MAIN.path, dlerror());
MAIN.vops = *vops;
MAIN.vops.init(MAIN.timeout, MAIN.count, MAIN.verbose);
while (fgets(cmd, sizeof cmd, stdin) && parseop(&op, cmd)) {
struct timeout *to;
unsigned n;
switch (op.type) {
case OP_QUIT:
goto quit;
case OP_HELP:
usage(stdout);
break;
case OP_ADD:
to = &MAIN.timeout[op.add.id];
MAIN.vops.add(to, op.add.timeout);
break;
case OP_DEL:
to = &MAIN.timeout[op.del.id];
MAIN.vops.del(to);
break;
case OP_GET:
n = 0;
while ((to = MAIN.vops.get())) {
if (op.get.verbose > 1)
printf("#%ld expired (%llu >= %llu)\n", to - MAIN.timeout, to->expires, MAIN.curtime);
n++;
}
if (op.get.verbose)
printf("expired %u\n", n);
break;
case OP_STEP:
MAIN.curtime += op.step.time;
MAIN.vops.update(MAIN.curtime);
break;
case OP_UPDATE:
MAIN.curtime = op.update.time;
MAIN.vops.update(MAIN.curtime);
break;
case OP_CHECK:
MAIN.vops.check();
break;
case OP_FILL:
for (to = MAIN.timeout; to < &MAIN.timeout[MAIN.count]; to++) {
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;
case OP_OOPS:
errx(1, "oops: %s", op.oops.why);
break;
}
} /* while() */
quit:
return 0;
} /* main() */
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment