-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
36 lines (29 loc) · 919 Bytes
/
main.c
File metadata and controls
36 lines (29 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <stdio.h>
#include <stdlib.h>
#include <err.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "mtime.h"
#include "options.h"
#include "clients.h"
int main(int argc, char **argv)
{
options_t options;
clients_t clients;
int e;
e = options_parse(&options, argc, argv);
if (e == -1)
options_usage();
e = clients_init(&clients, options.nrequests, options.nclients, options.ip, options.port, options.path);
if (e == -1)
err(1, "clients_init");
e = clients_loop(&clients);
if (e == -1)
err(1, "clients_loop");
(void) fprintf(stderr, "%lld us, %lld rps, %ld kB, %lld kB/s\n",
clients.time_done - clients.time_started,
(1000000 * (mtime_t) options.nrequests) / (clients.time_done - clients.time_started),
clients.received_total / 1000,
(1000 * (mtime_t) clients.received_total / (clients.time_done - clients.time_started)));
exit(EXIT_SUCCESS);
}