Branch merge.
Этот коммит содержится в:
Коммит
6a00b2dfdd
1
README
1
README
@ -19,6 +19,7 @@ Supported platforms:
|
|||||||
|
|
||||||
./configure; make; make install
|
./configure; make; make install
|
||||||
|
|
||||||
|
(Note: If configure fails, try running ./bootstrap.sh first)
|
||||||
|
|
||||||
== Latest version ==
|
== Latest version ==
|
||||||
|
|
||||||
|
@ -73,7 +73,8 @@ struct iperf_settings
|
|||||||
int domain; /* AF_INET or AF_INET6 */
|
int domain; /* AF_INET or AF_INET6 */
|
||||||
int socket_bufsize; /* window size for TCP */
|
int socket_bufsize; /* window size for TCP */
|
||||||
int blksize; /* size of read/writes (-l) */
|
int blksize; /* size of read/writes (-l) */
|
||||||
uint64_t rate; /* target data rate, UDP only */
|
uint64_t rate; /* target data rate */
|
||||||
|
int burst; /* packets per burst */
|
||||||
int mss; /* for TCP MSS */
|
int mss; /* for TCP MSS */
|
||||||
int ttl; /* IP TTL option */
|
int ttl; /* IP TTL option */
|
||||||
int tos; /* type of service bit */
|
int tos; /* type of service bit */
|
||||||
@ -238,6 +239,7 @@ struct iperf_test
|
|||||||
#define MIN_INTERVAL 0.1
|
#define MIN_INTERVAL 0.1
|
||||||
#define MAX_INTERVAL 60.0
|
#define MAX_INTERVAL 60.0
|
||||||
#define MAX_TIME 3600
|
#define MAX_TIME 3600
|
||||||
|
#define MAX_BURST 1000
|
||||||
#define MAX_MSS (9 * 1024)
|
#define MAX_MSS (9 * 1024)
|
||||||
#define MAX_STREAMS 128
|
#define MAX_STREAMS 128
|
||||||
|
|
||||||
|
@ -73,6 +73,10 @@ use UDP rather than TCP
|
|||||||
set target bandwidth to \fIn\fR bits/sec (default 1 Mbit/sec for UDP, unlimited for TCP).
|
set target bandwidth to \fIn\fR bits/sec (default 1 Mbit/sec for UDP, unlimited for TCP).
|
||||||
If there are multiple streams (-P flag), the bandwidth limit is applied
|
If there are multiple streams (-P flag), the bandwidth limit is applied
|
||||||
separately to each stream.
|
separately to each stream.
|
||||||
|
You can also add a '/' and a number to the bandwidth specifier.
|
||||||
|
This is called "burst mode".
|
||||||
|
It will send the given number of packets without pausing, even if that
|
||||||
|
temporarily exceeds the specified bandwidth limit.
|
||||||
.TP
|
.TP
|
||||||
.BR -t ", " --time " \fIn\fR"
|
.BR -t ", " --time " \fIn\fR"
|
||||||
time in seconds to transmit for (default 10 secs)
|
time in seconds to transmit for (default 10 secs)
|
||||||
|
@ -115,6 +115,12 @@ iperf_get_test_rate(struct iperf_test *ipt)
|
|||||||
return ipt->settings->rate;
|
return ipt->settings->rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
iperf_get_test_burst(struct iperf_test *ipt)
|
||||||
|
{
|
||||||
|
return ipt->settings->burst;
|
||||||
|
}
|
||||||
|
|
||||||
char
|
char
|
||||||
iperf_get_test_role(struct iperf_test *ipt)
|
iperf_get_test_role(struct iperf_test *ipt)
|
||||||
{
|
{
|
||||||
@ -249,6 +255,12 @@ iperf_set_test_rate(struct iperf_test *ipt, uint64_t rate)
|
|||||||
ipt->settings->rate = rate;
|
ipt->settings->rate = rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
iperf_set_test_burst(struct iperf_test *ipt, int burst)
|
||||||
|
{
|
||||||
|
ipt->settings->burst = burst;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
iperf_set_test_server_port(struct iperf_test *ipt, int server_port)
|
iperf_set_test_server_port(struct iperf_test *ipt, int server_port)
|
||||||
{
|
{
|
||||||
@ -529,6 +541,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
|
|||||||
int blksize;
|
int blksize;
|
||||||
int server_flag, client_flag, rate_flag;
|
int server_flag, client_flag, rate_flag;
|
||||||
char* comma;
|
char* comma;
|
||||||
|
char* slash;
|
||||||
|
|
||||||
blksize = 0;
|
blksize = 0;
|
||||||
server_flag = client_flag = rate_flag = 0;
|
server_flag = client_flag = rate_flag = 0;
|
||||||
@ -583,6 +596,17 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
|
|||||||
client_flag = 1;
|
client_flag = 1;
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
|
slash = strchr(optarg, '/');
|
||||||
|
if (slash) {
|
||||||
|
*slash = '\0';
|
||||||
|
++slash;
|
||||||
|
test->settings->burst = atoi(slash);
|
||||||
|
if (test->settings->burst <= 0 ||
|
||||||
|
test->settings->burst > MAX_BURST) {
|
||||||
|
i_errno = IEBURST;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
test->settings->rate = unit_atof(optarg);
|
test->settings->rate = unit_atof(optarg);
|
||||||
rate_flag = 1;
|
rate_flag = 1;
|
||||||
client_flag = 1;
|
client_flag = 1;
|
||||||
@ -795,13 +819,15 @@ iperf_send(struct iperf_test *test, fd_set *write_setP)
|
|||||||
struct timeval now;
|
struct timeval now;
|
||||||
|
|
||||||
/* Can we do multisend mode? */
|
/* Can we do multisend mode? */
|
||||||
if (test->settings->rate != 0)
|
if (test->settings->burst != 0)
|
||||||
multisend = 1; /* nope */
|
multisend = test->settings->burst;
|
||||||
else
|
else if (test->settings->rate == 0)
|
||||||
multisend = test->multisend;
|
multisend = test->multisend;
|
||||||
|
else
|
||||||
|
multisend = 1; /* nope */
|
||||||
|
|
||||||
for (; multisend > 0; --multisend) {
|
for (; multisend > 0; --multisend) {
|
||||||
if (test->settings->rate != 0)
|
if (test->settings->rate != 0 && test->settings->burst == 0)
|
||||||
gettimeofday(&now, NULL);
|
gettimeofday(&now, NULL);
|
||||||
SLIST_FOREACH(sp, &test->streams, streams) {
|
SLIST_FOREACH(sp, &test->streams, streams) {
|
||||||
if (sp->green_light &&
|
if (sp->green_light &&
|
||||||
@ -813,13 +839,18 @@ iperf_send(struct iperf_test *test, fd_set *write_setP)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
test->bytes_sent += r;
|
test->bytes_sent += r;
|
||||||
if (test->settings->rate != 0)
|
if (test->settings->rate != 0 && test->settings->burst == 0)
|
||||||
iperf_check_throttle(sp, &now);
|
iperf_check_throttle(sp, &now);
|
||||||
if (multisend > 1 && test->settings->bytes != 0 && test->bytes_sent >= test->settings->bytes)
|
if (multisend > 1 && test->settings->bytes != 0 && test->bytes_sent >= test->settings->bytes)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (test->settings->burst != 0) {
|
||||||
|
gettimeofday(&now, NULL);
|
||||||
|
SLIST_FOREACH(sp, &test->streams, streams)
|
||||||
|
iperf_check_throttle(sp, &now);
|
||||||
|
}
|
||||||
if (write_setP != NULL)
|
if (write_setP != NULL)
|
||||||
SLIST_FOREACH(sp, &test->streams, streams)
|
SLIST_FOREACH(sp, &test->streams, streams)
|
||||||
if (FD_ISSET(sp->socket, write_setP))
|
if (FD_ISSET(sp->socket, write_setP))
|
||||||
@ -1021,6 +1052,8 @@ send_parameters(struct iperf_test *test)
|
|||||||
cJSON_AddIntToObject(j, "len", test->settings->blksize);
|
cJSON_AddIntToObject(j, "len", test->settings->blksize);
|
||||||
if (test->settings->rate)
|
if (test->settings->rate)
|
||||||
cJSON_AddIntToObject(j, "bandwidth", test->settings->rate);
|
cJSON_AddIntToObject(j, "bandwidth", test->settings->rate);
|
||||||
|
if (test->settings->burst)
|
||||||
|
cJSON_AddIntToObject(j, "burst", test->settings->burst);
|
||||||
if (test->settings->tos)
|
if (test->settings->tos)
|
||||||
cJSON_AddIntToObject(j, "TOS", test->settings->tos);
|
cJSON_AddIntToObject(j, "TOS", test->settings->tos);
|
||||||
if (test->settings->flowlabel)
|
if (test->settings->flowlabel)
|
||||||
@ -1078,6 +1111,8 @@ get_parameters(struct iperf_test *test)
|
|||||||
test->settings->blksize = j_p->valueint;
|
test->settings->blksize = j_p->valueint;
|
||||||
if ((j_p = cJSON_GetObjectItem(j, "bandwidth")) != NULL)
|
if ((j_p = cJSON_GetObjectItem(j, "bandwidth")) != NULL)
|
||||||
test->settings->rate = j_p->valueint;
|
test->settings->rate = j_p->valueint;
|
||||||
|
if ((j_p = cJSON_GetObjectItem(j, "burst")) != NULL)
|
||||||
|
test->settings->burst = j_p->valueint;
|
||||||
if ((j_p = cJSON_GetObjectItem(j, "TOS")) != NULL)
|
if ((j_p = cJSON_GetObjectItem(j, "TOS")) != NULL)
|
||||||
test->settings->tos = j_p->valueint;
|
test->settings->tos = j_p->valueint;
|
||||||
if ((j_p = cJSON_GetObjectItem(j, "flowlabel")) != NULL)
|
if ((j_p = cJSON_GetObjectItem(j, "flowlabel")) != NULL)
|
||||||
@ -1409,6 +1444,7 @@ iperf_defaults(struct iperf_test *testp)
|
|||||||
testp->settings->socket_bufsize = 0; /* use autotuning */
|
testp->settings->socket_bufsize = 0; /* use autotuning */
|
||||||
testp->settings->blksize = DEFAULT_TCP_BLKSIZE;
|
testp->settings->blksize = DEFAULT_TCP_BLKSIZE;
|
||||||
testp->settings->rate = 0;
|
testp->settings->rate = 0;
|
||||||
|
testp->settings->burst = 0;
|
||||||
testp->settings->mss = 0;
|
testp->settings->mss = 0;
|
||||||
testp->settings->bytes = 0;
|
testp->settings->bytes = 0;
|
||||||
memset(testp->cookie, 0, COOKIE_SIZE);
|
memset(testp->cookie, 0, COOKIE_SIZE);
|
||||||
@ -1566,6 +1602,7 @@ iperf_reset_test(struct iperf_test *test)
|
|||||||
test->settings->socket_bufsize = 0;
|
test->settings->socket_bufsize = 0;
|
||||||
test->settings->blksize = DEFAULT_TCP_BLKSIZE;
|
test->settings->blksize = DEFAULT_TCP_BLKSIZE;
|
||||||
test->settings->rate = 0;
|
test->settings->rate = 0;
|
||||||
|
test->settings->burst = 0;
|
||||||
test->settings->mss = 0;
|
test->settings->mss = 0;
|
||||||
memset(test->cookie, 0, COOKIE_SIZE);
|
memset(test->cookie, 0, COOKIE_SIZE);
|
||||||
test->multisend = 10; /* arbitrary */
|
test->multisend = 10; /* arbitrary */
|
||||||
|
@ -52,6 +52,7 @@ char iperf_get_test_role( struct iperf_test* ipt );
|
|||||||
int iperf_get_test_reverse( struct iperf_test* ipt );
|
int iperf_get_test_reverse( struct iperf_test* ipt );
|
||||||
int iperf_get_test_blksize( struct iperf_test* ipt );
|
int iperf_get_test_blksize( struct iperf_test* ipt );
|
||||||
uint64_t iperf_get_test_rate( struct iperf_test* ipt );
|
uint64_t iperf_get_test_rate( struct iperf_test* ipt );
|
||||||
|
int iperf_get_test_burst( struct iperf_test* ipt );
|
||||||
int iperf_get_test_socket_bufsize( struct iperf_test* ipt );
|
int iperf_get_test_socket_bufsize( struct iperf_test* ipt );
|
||||||
double iperf_get_test_reporter_interval( struct iperf_test* ipt );
|
double iperf_get_test_reporter_interval( struct iperf_test* ipt );
|
||||||
double iperf_get_test_stats_interval( struct iperf_test* ipt );
|
double iperf_get_test_stats_interval( struct iperf_test* ipt );
|
||||||
@ -73,6 +74,7 @@ void iperf_set_test_stats_interval( struct iperf_test* ipt, double stats_interva
|
|||||||
void iperf_set_test_state( struct iperf_test* ipt, signed char state );
|
void iperf_set_test_state( struct iperf_test* ipt, signed char state );
|
||||||
void iperf_set_test_blksize( struct iperf_test* ipt, int blksize );
|
void iperf_set_test_blksize( struct iperf_test* ipt, int blksize );
|
||||||
void iperf_set_test_rate( struct iperf_test* ipt, uint64_t rate );
|
void iperf_set_test_rate( struct iperf_test* ipt, uint64_t rate );
|
||||||
|
void iperf_set_test_burst( struct iperf_test* ipt, int burst );
|
||||||
void iperf_set_test_server_port( struct iperf_test* ipt, int server_port );
|
void iperf_set_test_server_port( struct iperf_test* ipt, int server_port );
|
||||||
void iperf_set_test_socket_bufsize( struct iperf_test* ipt, int socket_bufsize );
|
void iperf_set_test_socket_bufsize( struct iperf_test* ipt, int socket_bufsize );
|
||||||
void iperf_set_test_num_streams( struct iperf_test* ipt, int num_streams );
|
void iperf_set_test_num_streams( struct iperf_test* ipt, int num_streams );
|
||||||
@ -241,6 +243,7 @@ enum {
|
|||||||
IEOMIT = 12, // Bogus value for --omit
|
IEOMIT = 12, // Bogus value for --omit
|
||||||
IEUNIMP = 13, // Not implemented yet
|
IEUNIMP = 13, // Not implemented yet
|
||||||
IEFILE = 14, // -F file couldn't be opened
|
IEFILE = 14, // -F file couldn't be opened
|
||||||
|
IEBURST = 15, // Invalid burst count. Maximum value = %dMAX_BURST
|
||||||
/* Test errors */
|
/* Test errors */
|
||||||
IENEWTEST = 100, // Unable to create a new test (check perror)
|
IENEWTEST = 100, // Unable to create a new test (check perror)
|
||||||
IEINITTEST = 101, // Test initialization failed (check perror)
|
IEINITTEST = 101, // Test initialization failed (check perror)
|
||||||
|
@ -109,6 +109,9 @@ iperf_strerror(int i_errno)
|
|||||||
snprintf(errstr, len, "unable to open -F file");
|
snprintf(errstr, len, "unable to open -F file");
|
||||||
perr = 1;
|
perr = 1;
|
||||||
break;
|
break;
|
||||||
|
case IEBURST:
|
||||||
|
snprintf(errstr, len, "invalid burst count (maximum = %d)", MAX_BURST);
|
||||||
|
break;
|
||||||
case IENEWTEST:
|
case IENEWTEST:
|
||||||
snprintf(errstr, len, "unable to create a new test");
|
snprintf(errstr, len, "unable to create a new test");
|
||||||
perr = 1;
|
perr = 1;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user