Bitrate throttling when burst is specified (#1090)
When the -b option specifies a burst value, throttling the bitrate does not work. This is because iperf_check_throttle() does not perform the check when burst value was defined. This change removes the dependency of iperf_check_throttle() on the burst value and moves that check to the caller of that function. (Except for the call by send_timer_proc() which does not seem to be related to the change.)
Этот коммит содержится в:
родитель
50315e7a1e
Коммит
91c33dcfd0
@ -1539,7 +1539,7 @@ iperf_check_throttle(struct iperf_stream *sp, struct iperf_time *nowP)
|
|||||||
double seconds;
|
double seconds;
|
||||||
uint64_t bits_per_second;
|
uint64_t bits_per_second;
|
||||||
|
|
||||||
if (sp->test->done || sp->test->settings->rate == 0 || sp->test->settings->burst != 0)
|
if (sp->test->done || sp->test->settings->rate == 0)
|
||||||
return;
|
return;
|
||||||
iperf_time_diff(&sp->result->start_time_fixed, nowP, &temp_time);
|
iperf_time_diff(&sp->result->start_time_fixed, nowP, &temp_time);
|
||||||
seconds = iperf_time_in_secs(&temp_time);
|
seconds = iperf_time_in_secs(&temp_time);
|
||||||
@ -1598,6 +1598,7 @@ iperf_send(struct iperf_test *test, fd_set *write_setP)
|
|||||||
register int multisend, r, streams_active;
|
register int multisend, r, streams_active;
|
||||||
register struct iperf_stream *sp;
|
register struct iperf_stream *sp;
|
||||||
struct iperf_time now;
|
struct iperf_time now;
|
||||||
|
int no_throttle_check;
|
||||||
|
|
||||||
/* Can we do multisend mode? */
|
/* Can we do multisend mode? */
|
||||||
if (test->settings->burst != 0)
|
if (test->settings->burst != 0)
|
||||||
@ -1607,8 +1608,11 @@ iperf_send(struct iperf_test *test, fd_set *write_setP)
|
|||||||
else
|
else
|
||||||
multisend = 1; /* nope */
|
multisend = 1; /* nope */
|
||||||
|
|
||||||
|
/* Should bitrate throttle be checked for every send */
|
||||||
|
no_throttle_check = test->settings->rate != 0 && test->settings->burst == 0;
|
||||||
|
|
||||||
for (; multisend > 0; --multisend) {
|
for (; multisend > 0; --multisend) {
|
||||||
if (test->settings->rate != 0 && test->settings->burst == 0)
|
if (no_throttle_check)
|
||||||
iperf_time_now(&now);
|
iperf_time_now(&now);
|
||||||
streams_active = 0;
|
streams_active = 0;
|
||||||
SLIST_FOREACH(sp, &test->streams, streams) {
|
SLIST_FOREACH(sp, &test->streams, streams) {
|
||||||
@ -1623,7 +1627,8 @@ iperf_send(struct iperf_test *test, fd_set *write_setP)
|
|||||||
streams_active = 1;
|
streams_active = 1;
|
||||||
test->bytes_sent += r;
|
test->bytes_sent += r;
|
||||||
++test->blocks_sent;
|
++test->blocks_sent;
|
||||||
iperf_check_throttle(sp, &now);
|
if (no_throttle_check)
|
||||||
|
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 (multisend > 1 && test->settings->blocks != 0 && test->blocks_sent >= test->settings->blocks)
|
if (multisend > 1 && test->settings->blocks != 0 && test->blocks_sent >= test->settings->blocks)
|
||||||
@ -1633,7 +1638,7 @@ iperf_send(struct iperf_test *test, fd_set *write_setP)
|
|||||||
if (!streams_active)
|
if (!streams_active)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (test->settings->burst != 0) {
|
if (!no_throttle_check) { /* Throttle check if was not checked for each send */
|
||||||
iperf_time_now(&now);
|
iperf_time_now(&now);
|
||||||
SLIST_FOREACH(sp, &test->streams, streams)
|
SLIST_FOREACH(sp, &test->streams, streams)
|
||||||
if (sp->sender)
|
if (sp->sender)
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user