simplified reporter callback by removing conditional assignments
Этот коммит содержится в:
родитель
7dd1f0cd55
Коммит
a428063b8b
@ -626,25 +626,16 @@ char *iperf_reporter_callback(struct iperf_test *test)
|
||||
bytes+= ip->bytes_transferred;
|
||||
unit_snprintf(ubuf, UNIT_LEN, (double) (ip->bytes_transferred), test->unit_format);
|
||||
|
||||
if(test->stats_interval <= test->duration && test->stats_interval!= 0)
|
||||
{
|
||||
printf("NORMAL ip->interval_duration = %d \n", ip->interval_duration);
|
||||
test->stats_interval = test->stats_interval== 0 ? test->duration : test->stats_interval;
|
||||
|
||||
unit_snprintf(nbuf, UNIT_LEN, (double) (ip->bytes_transferred / test->stats_interval), test->unit_format);
|
||||
}
|
||||
// for duration(t) != multiple(i)
|
||||
else
|
||||
{
|
||||
printf("ELSE ip->interval_duration = %d \n", ip->interval_duration);
|
||||
unit_snprintf(nbuf, UNIT_LEN, (double) (ip->bytes_transferred / (test->duration - ip->interval_duration)), test->unit_format);
|
||||
}
|
||||
|
||||
sprintf(message,report_bw_header);
|
||||
strcat(message_final, message);
|
||||
|
||||
if(test->stats_interval!= 0)
|
||||
sprintf(message, report_bw_format, sp->socket, (double)ip->interval_duration, (double)ip->interval_duration + test->stats_interval, ubuf, nbuf);
|
||||
else
|
||||
sprintf(message, report_bw_format, sp->socket, (double)ip->interval_duration, (double)ip->interval_duration + test->duration, ubuf, nbuf);
|
||||
|
||||
strcat(message_final, message);
|
||||
|
||||
sp = sp->next;
|
||||
@ -652,17 +643,12 @@ char *iperf_reporter_callback(struct iperf_test *test)
|
||||
|
||||
unit_snprintf(ubuf, UNIT_LEN, (double) ( bytes), test->unit_format);
|
||||
|
||||
if(test->stats_interval <= test->duration && test->stats_interval!=0)
|
||||
unit_snprintf(nbuf, UNIT_LEN, (double) ( bytes / test->stats_interval), test->unit_format);
|
||||
else
|
||||
unit_snprintf(nbuf, UNIT_LEN, (double) ( bytes /(test->duration - ip->interval_duration)), test->unit_format);
|
||||
|
||||
|
||||
if(test->stats_interval!= 0)
|
||||
sprintf(message, report_sum_bw_format, (double)ip->interval_duration,
|
||||
(double)ip->interval_duration + test->stats_interval, ubuf, nbuf);
|
||||
else
|
||||
sprintf(message, report_sum_bw_format, (double)ip->interval_duration,
|
||||
(double)ip->interval_duration + test->duration, ubuf, nbuf);
|
||||
|
||||
strcat(message_final, message);
|
||||
}
|
||||
@ -1047,7 +1033,6 @@ void iperf_run_server(struct iperf_test *test)
|
||||
FD_CLR(test->listener_sock, &test->temp_set);
|
||||
}
|
||||
|
||||
|
||||
//Process the sockets for read operation
|
||||
for (j=0; j< test->max_fd+1; j++)
|
||||
{
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user