summaryrefslogtreecommitdiff
path: root/src/tools/cbr
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/cbr')
-rw-r--r--src/tools/cbr/cbr.c2
-rw-r--r--src/tools/cbr/cbr_client.c15
-rw-r--r--src/tools/cbr/cbr_server.c8
3 files changed, 12 insertions, 13 deletions
diff --git a/src/tools/cbr/cbr.c b/src/tools/cbr/cbr.c
index 27c51586..efcb2847 100644
--- a/src/tools/cbr/cbr.c
+++ b/src/tools/cbr/cbr.c
@@ -64,7 +64,7 @@ static void usage(void)
int main(int argc, char ** argv)
{
- int duration = 60; /* One minute test */
+ int duration = 60; /* One minute test */
int size = 1000; /* 1000 byte SDUs */
long rate = 1000000; /* 1 Mb/s */
bool flood = false;
diff --git a/src/tools/cbr/cbr_client.c b/src/tools/cbr/cbr_client.c
index af766599..b2cf7d7f 100644
--- a/src/tools/cbr/cbr_client.c
+++ b/src/tools/cbr/cbr_client.c
@@ -46,8 +46,8 @@ int client_main(char * server,
int result = 0;
bool stop = false;
char buf[size];
- long seqnr = 0;
- unsigned long gap = size * 8.0 * (BILLION / (double) rate);
+ int seqnr = 0;
+ long gap = size * 8.0 * (BILLION / (double) rate);
struct timespec start;
struct timespec end;
@@ -55,7 +55,7 @@ int client_main(char * server,
int ms;
printf("Client started, duration %d, rate %lu b/s, size %d B.\n",
- duration, rate, size);
+ duration, rate, size);
fd = flow_alloc(server, NULL, NULL);
if (fd < 0) {
@@ -85,18 +85,17 @@ int client_main(char * server,
if (sleep)
nanosleep(&intv, NULL);
else
- busy_wait_until(&end);
+ busy_wait_until(&end);
++seqnr;
- if (ts_diff_us(&start, &end) / MILLION
- >= (long) duration)
+ if (ts_diff_us(&start, &end) / MILLION >= duration)
stop = true;
}
} else { /* flood */
while (!stop) {
clock_gettime(CLOCK_REALTIME, &end);
- if (flow_write(fd, buf, size) == -1) {
+ if (flow_write(fd, buf, (size_t) size) == -1) {
stop = true;
continue;
}
@@ -115,7 +114,7 @@ int client_main(char * server,
ms = ts_diff_ms(&start, &end);
printf("sent statistics: "
- "%9ld SDUs, %12ld bytes in %9d ms, %4.4f Mb/s\n",
+ "%9d SDUs, %12d bytes in %9d ms, %4.4f Mb/s\n",
seqnr, seqnr * size, ms, (seqnr * size * 8.0)/(ms * 1000));
flow_dealloc(fd);
diff --git a/src/tools/cbr/cbr_server.c b/src/tools/cbr/cbr_server.c
index d40ae2cb..f1c342d1 100644
--- a/src/tools/cbr/cbr_server.c
+++ b/src/tools/cbr/cbr_server.c
@@ -63,7 +63,7 @@ void shutdown_server(int signo, siginfo_t * info, void * c)
void handle_flow(int fd)
{
- ssize_t count = 0;
+ int count = 0;
char buf[BUF_SIZE];
struct timespec now;
@@ -112,9 +112,9 @@ void handle_flow(int fd)
sdus - sdus_intv,
bytes_read - bytes_read_intv,
us / 1000,
- ((sdus - sdus_intv) / (float) us) * MILLION,
+ ((sdus - sdus_intv) / (double) us) * MILLION,
8 * (bytes_read - bytes_read_intv)
- / (float)(us));
+ / (double)(us));
iv_start = iv_end;
sdus_intv = sdus;
bytes_read_intv = bytes_read;
@@ -197,7 +197,7 @@ void * listener(void * o)
return 0;
}
-int server_main()
+int server_main(void)
{
struct sigaction sig_act;
int i;