iperf: update to 2.1.9 (#8540)

This commit is contained in:
davidkaroly
2023-04-27 19:56:32 +02:00
committed by GitHub
parent 9111666470
commit bb69abab71
2 changed files with 173 additions and 102 deletions

View File

@@ -7,7 +7,7 @@ COPYRIGHT="1999-2007 Board of Trustees of University of Illinois"
LICENSE="UIUC"
REVISION="1"
SOURCE_URI="https://downloads.sourceforge.net/iperf2/iperf-${portVersion}.tar.gz"
CHECKSUM_SHA256="8e2cf2fbc9d0d4d1cf9d109b1e328459f9622993dc9a4c5a7dc8a2088fb7beaf"
CHECKSUM_SHA256="5c0771aab00ef14520013aef01675977816e23bb8f5d9fde016f90eb2f1be788"
SOURCE_DIR="iperf-$portVersion"
if [ $effectiveTargetArchitecture = x86_gcc2 ]; then

View File

@@ -1,82 +1,125 @@
From 01213ca45ed5baa50174b57a0f820d758268a9c3 Mon Sep 17 00:00:00 2001
From e1b36b7f6dab6cd98018e4f2aac60fb2b1567cda Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Tue, 2 Oct 2018 16:31:18 +0200
Subject: gcc2 patch
diff --git a/src/ReportOutputs.c b/src/ReportOutputs.c
index 6d124de..fde6f64 100644
index e977433..29d3ad0 100644
--- a/src/ReportOutputs.c
+++ b/src/ReportOutputs.c
@@ -252,9 +252,11 @@ void tcp_output_read_enhanced (struct TransferInfo *stats) {
fflush(stdout);
@@ -253,8 +253,8 @@ void tcp_output_read_enhanced (struct TransferInfo *stats) {
}
void tcp_output_read_triptime (struct TransferInfo *stats) {
+ double meantransit;
+ double lambda;
HEADING_PRINT_COND(report_bw_read_enhanced_netpwr);
- double meantransit = (stats->transit.current.cnt > 0) ? (stats->transit.current.sum / stats->transit.current.cnt) : 0;
- double lambda = (stats->IPGsum > 0.0) ? ((double)stats->cntBytes / stats->IPGsum) : 0.0;
+ meantransit = (stats->transit.current.cnt > 0) ? (stats->transit.current.sum / stats->transit.current.cnt) : 0;
+ lambda = (stats->IPGsum > 0.0) ? ((double)stats->cntBytes / stats->IPGsum) : 0.0;
set_llawbuf(lambda, meantransit);
double meantransit;
- HEADING_PRINT_COND(report_bw_read_enhanced_netpwr);
char llaw_bufstr[LLAWBUFSIZE];
+ HEADING_PRINT_COND(report_bw_read_enhanced_netpwr);
human_format_llawbuf(llaw_bufstr, sizeof(llaw_bufstr), ((stats->final) ? stats->fInP : stats->iInP));
_print_stats_common(stats);
if (stats->cntBytes) {
@@ -308,8 +310,9 @@ void tcp_output_read_triptime (struct TransferInfo *stats) {
if (!stats->final) {
@@ -310,9 +310,9 @@ void tcp_output_read_triptime (struct TransferInfo *stats) {
fflush(stdout);
}
void tcp_output_read_enhanced_isoch (struct TransferInfo *stats) {
+ double meantransit;
HEADING_PRINT_COND(report_bw_isoch_enhanced_netpwr);
- double meantransit = (stats->transit.current.cnt > 0) ? (stats->transit.current.sum / stats->transit.current.cnt) : 0;
+ meantransit = (stats->transit.current.cnt > 0) ? (stats->transit.current.sum / stats->transit.current.cnt) : 0;
_print_stats_common(stats);
if (stats->cntBytes) {
- double meantransit;
if (!stats->final) {
meantransit = (stats->isochstats.transit.current.cnt > 0) ? (stats->isochstats.transit.current.sum / stats->isochstats.transit.current.cnt) : 0;
set_netpowerbuf(meantransit, stats);
@@ -432,9 +435,9 @@ void tcp_output_write (struct TransferInfo *stats) {
@@ -436,9 +436,9 @@ void tcp_output_write (struct TransferInfo *stats) {
}
void tcp_output_write_bb (struct TransferInfo *stats) {
+ char rps_string[40];
+ char rps_string[80];
HEADING_PRINT_COND(report_client_bb_bw);
_print_stats_common(stats);
- char rps_string[40];
- char rps_string[80];
if (stats->final) {
double rps = ((stats->fBBrunning > 0) && (stats->bbrtt.total.cnt > 0)) ? ((double) stats->bbrtt.total.cnt / stats->fBBrunning) : 0;
if (rps < 10)
@@ -1151,13 +1154,14 @@ static void format_ips_ports_string (struct TransferInfo *stats) {
@@ -1170,9 +1170,9 @@ void tcp_output_sumcnt_read_enhanced (struct TransferInfo *stats) {
fflush(stdout);
}
void tcp_output_sumcnt_read_triptime (struct TransferInfo *stats) {
+ char llaw_bufstr[LLAWBUFSIZE];
HEADING_PRINT_COND(report_sumcnt_bw_read_triptime);
_print_stats_common(stats);
- char llaw_bufstr[LLAWBUFSIZE];
human_format_llawbuf(llaw_bufstr, sizeof(llaw_bufstr), ((stats->final) ? stats->fInP : stats->iInP));
printf(report_sumcnt_bw_read_triptime_format, stats->threadcnt,
stats->ts.iStart, stats->ts.iEnd,
@@ -1314,10 +1314,11 @@ void format_ips_port_string (struct TransferInfo *stats, bool sum) {
}
void udp_output_basic_csv (struct TransferInfo *stats) {
+ intmax_t speed;
format_timestamp(&stats->ts.nextTime, isEnhanced(stats->common));
if (stats->csv_peer[0] == '\0') {
format_ips_ports_string(stats);
strncpy(&stats->csv_peer[0], &__ips_ports_string[0], CSVPEERLIMIT);
stats->csv_peer[(CSVPEERLIMIT - 1)] = '\0';
}
char timestr[120];
iperf_formattime(timestr, sizeof(timestr), (!stats->final ? stats->ts.nextTime : stats->ts.packetTime), \
isEnhanced(stats->common), isUTC(stats->common), (isEnhanced(stats->common) ? CSVTZ : CSV));
- intmax_t speed = (intmax_t) (((stats->cntBytes > 0) && (stats->ts.iEnd - stats->ts.iStart) > 0.0) ? \
+ speed = (intmax_t) (((stats->cntBytes > 0) && (stats->ts.iEnd - stats->ts.iStart) > 0.0) ? \
(((double)stats->cntBytes * 8.0) / (stats->ts.iEnd - stats->ts.iStart)) : 0);
printf(reportCSV_bw_jitter_loss_format,
__timestring,
@@ -1173,13 +1177,14 @@ void udp_output_basic_csv (struct TransferInfo *stats) {
(100.0 * stats->cntError) / stats->cntDatagrams, stats->cntOutofOrder );
timestr,
@@ -1334,11 +1335,12 @@ void udp_output_basic_csv (struct TransferInfo *stats) {
}
void udp_output_enhanced_csv (struct TransferInfo *stats) {
+ intmax_t speed;
char timestr[80];
iperf_formattime(timestr, sizeof(timestr), (!stats->final ? stats->ts.nextTime : stats->ts.packetTime), \
isEnhanced(stats->common), isUTC(stats->common),
isEnhanced(stats->common) ? CSVTZ : CSV);
- intmax_t speed = (intmax_t) (((stats->cntBytes > 0) && (stats->ts.iEnd - stats->ts.iStart) > 0.0) ? \
+ speed = (intmax_t) (((stats->cntBytes > 0) && (stats->ts.iEnd - stats->ts.iStart) > 0.0) ? \
(((double)stats->cntBytes * 8.0) / (stats->ts.iEnd - stats->ts.iStart)) : 0);
printf(reportCSV_bw_jitter_loss_pps_format,
timestr,
@@ -1359,10 +1361,11 @@ void udp_output_enhanced_csv (struct TransferInfo *stats) {
}
void tcp_output_basic_csv (struct TransferInfo *stats) {
+ intmax_t speed;
format_timestamp(&stats->ts.nextTime, isEnhanced(stats->common));
if (stats->csv_peer[0] == '\0') {
format_ips_ports_string(stats);
strncpy(&stats->csv_peer[0], &__ips_ports_string[0], CSVPEERLIMIT);
stats->csv_peer[(CSVPEERLIMIT - 1)] = '\0';
}
char timestr[80];
iperf_formattime(timestr, sizeof(timestr), (!stats->final ? stats->ts.nextTime : stats->ts.packetTime), \
isEnhanced(stats->common), isUTC(stats->common), (isEnhanced(stats->common) ? CSVTZ : CSV));
- intmax_t speed = (intmax_t) (((stats->cntBytes > 0) && (stats->ts.iEnd - stats->ts.iStart) > 0.0) ? \
+ speed = (intmax_t) (((stats->cntBytes > 0) && (stats->ts.iEnd - stats->ts.iStart) > 0.0) ? \
(((double)stats->cntBytes * 8.0) / (stats->ts.iEnd - stats->ts.iStart)) : 0);
printf(reportCSV_bw_format,
__timestring,
@@ -1441,15 +1446,18 @@ void reporter_connect_printf_tcp_final (struct ConnectionInfo * report) {
timestr,
@@ -1375,11 +1378,12 @@ void tcp_output_basic_csv (struct TransferInfo *stats) {
}
void tcp_output_read_enhanced_csv (struct TransferInfo *stats) {
+ intmax_t speed;
char timestr[80];
iperf_formattime(timestr, sizeof(timestr), (!stats->final ? stats->ts.nextTime : stats->ts.packetTime), \
isEnhanced(stats->common), isUTC(stats->common),
isEnhanced(stats->common) ? CSVTZ : CSV);
- intmax_t speed = (intmax_t) (((stats->cntBytes > 0) && (stats->ts.iEnd - stats->ts.iStart) > 0.0) ? \
+ speed = (intmax_t) (((stats->cntBytes > 0) && (stats->ts.iEnd - stats->ts.iStart) > 0.0) ? \
(((double)stats->cntBytes * 8.0) / (stats->ts.iEnd - stats->ts.iStart)) : 0);
printf(reportCSV_bw_read_enhanced_format,
timestr,
@@ -1401,11 +1405,12 @@ void tcp_output_read_enhanced_csv (struct TransferInfo *stats) {
}
void tcp_output_write_enhanced_csv (struct TransferInfo *stats) {
+ intmax_t speed;
char timestr[80];
iperf_formattime(timestr, sizeof(timestr), (!stats->final ? stats->ts.nextTime : stats->ts.packetTime), \
isEnhanced(stats->common), isUTC(stats->common),
isEnhanced(stats->common) ? CSVTZ : CSV);
- intmax_t speed = (intmax_t) (((stats->cntBytes > 0) && (stats->ts.iEnd - stats->ts.iStart) > 0.0) ? \
+ speed = (intmax_t) (((stats->cntBytes > 0) && (stats->ts.iEnd - stats->ts.iStart) > 0.0) ? \
(((double)stats->cntBytes * 8.0) / (stats->ts.iEnd - stats->ts.iStart)) : 0);
#if !(HAVE_TCP_STATS)
printf(reportCSV_bw_write_enhanced_format,
@@ -1730,15 +1735,18 @@ void reporter_connect_printf_tcp_final (struct ConnectionInfo * report) {
}
void reporter_print_connection_report (struct ConnectionInfo *report) {
@@ -100,43 +143,42 @@ index 6d124de..fde6f64 100644
#if HAVE_DECL_TCP_WINDOW_CLAMP
if (!isUDP(report->common) && isRxClamp(report->common)) {
@@ -1554,8 +1562,8 @@ void reporter_print_connection_report (struct ConnectionInfo *report) {
if (!isServerReverse(report->common) && (isEnhanced(report->common) || isConnectOnly(report->common))) {
if (report->connect_timestamp.tv_sec > 0) {
struct tm ts;
- ts = *localtime(&report->connect_timestamp.tv_sec);
char now_timebuf[80];
+ ts = *localtime(&report->connect_timestamp.tv_sec);
strftime(now_timebuf, sizeof(now_timebuf), "%Y-%m-%d %H:%M:%S (%Z)", &ts);
if (!isUDP(report->common) && (report->common->ThreadMode == kMode_Client) && (report->tcpinitstats.connecttime > 0)) {
snprintf(b, SNBUFFERSIZE-strlen(b), " (ct=%4.2f ms) on %s", report->tcpinitstats.connecttime, now_timebuf);
@@ -1635,8 +1643,10 @@ void reporter_print_connection_report (struct ConnectionInfo *report) {
@@ -1923,6 +1931,10 @@ void reporter_print_connection_report (struct ConnectionInfo *report) {
if ((report->common->ThreadMode == kMode_Client) && !isServerReverse(report->common)) {
if (isTxHoldback(report->common) || isTxStartTime(report->common)) {
struct tm ts;
char start_timebuf[80];
+ char now_timebuf[80];
struct timeval now;
struct timeval start;
+ int seconds_from_now;
+ struct timeval start;
+ char start_timebuf[80];
+ char now_timebuf[80];
#ifdef HAVE_CLOCK_GETTIME
struct timespec t1;
clock_gettime(CLOCK_REALTIME, &t1);
@@ -1646,10 +1656,8 @@ void reporter_print_connection_report (struct ConnectionInfo *report) {
@@ -1931,7 +1943,6 @@ void reporter_print_connection_report (struct ConnectionInfo *report) {
#else
gettimeofday(&now, NULL);
#endif
ts = *localtime(&now.tv_sec);
- char now_timebuf[80];
strftime(now_timebuf, sizeof(now_timebuf), "%Y-%m-%d %H:%M:%S (%Z)", &ts);
// Format time, "ddd yyyy-mm-dd hh:mm:ss zzz"
- int seconds_from_now;
if (isTxHoldback(report->common)) {
seconds_from_now = report->txholdbacktime.tv_sec;
if (report->txholdbacktime.tv_usec > 0)
@@ -1939,11 +1950,8 @@ void reporter_print_connection_report (struct ConnectionInfo *report) {
} else {
seconds_from_now = ceil(TimeDifference(report->epochStartTime, now));
}
- struct timeval start;
start = now;
- char start_timebuf[80];
start.tv_sec = now.tv_sec + seconds_from_now;
- char now_timebuf[80];
iperf_formattime(now_timebuf, sizeof(now_timebuf), now, \
isEnhanced(report->common), isUTC(report->common), YearThruSecTZ);
iperf_formattime(start_timebuf, sizeof(start_timebuf), start, \
diff --git a/src/Reporter.c b/src/Reporter.c
index 7dc05b3..509ef08 100644
index bbd6fd5..eb2ab0f 100644
--- a/src/Reporter.c
+++ b/src/Reporter.c
@@ -146,9 +146,9 @@ void PostReport (struct ReportHeader *reporthdr) {
@@ -145,9 +145,9 @@ void PostReport (struct ReportHeader *reporthdr) {
* Returns true when the tcpinfo was sampled, false ohterwise
*/
bool ReportPacket (struct ReporterData* data, struct ReportStruct *packet) {
@@ -147,7 +189,7 @@ index 7dc05b3..509ef08 100644
#ifdef HAVE_THREAD_DEBUG
if (packet->packetID < 0) {
thread_debug("Reporting last packet for %p qdepth=%d sock=%d", (void *) data, packetring_getcount(data->packetring), data->info.common->socket);
@@ -196,13 +196,15 @@ bool ReportPacket (struct ReporterData* data, struct ReportStruct *packet) {
@@ -195,13 +195,15 @@ bool ReportPacket (struct ReporterData* data, struct ReportStruct *packet) {
* It also handles the freeing reports and other closing actions
*/
int EndJob (struct ReportHeader *reporthdr, struct ReportStruct *finalpacket) {
@@ -166,7 +208,7 @@ index 7dc05b3..509ef08 100644
/*
* Using PacketID of -1 ends reporting
* It pushes a "special packet" through
@@ -512,10 +514,15 @@ void reporter_spawn (struct thread_Settings *thread) {
@@ -511,10 +513,15 @@ void reporter_spawn (struct thread_Settings *thread) {
// The Transfer or Data report is by far the most complicated report
int reporter_process_transfer_report (struct ReporterData *this_ireport) {
@@ -185,7 +227,7 @@ index 7dc05b3..509ef08 100644
// The consumption detector applies delay to the reporter
// thread when its consumption rate is too low. This allows
// the traffic threads to send aggregates vs thrash
@@ -530,8 +537,8 @@ int reporter_process_transfer_report (struct ReporterData *this_ireport) {
@@ -529,8 +536,8 @@ int reporter_process_transfer_report (struct ReporterData *this_ireport) {
if (!isSingleUDP(this_ireport->info.common))
apply_consumption_detector();
// If there are more packets to process then handle them
@@ -196,7 +238,7 @@ index 7dc05b3..509ef08 100644
while (!advance_jobq && (packet = packetring_dequeue(this_ireport->packetring))) {
// Increment the total packet count processed by this thread
// this will be used to make decisions on if the reporter
@@ -617,8 +624,9 @@ int reporter_process_transfer_report (struct ReporterData *this_ireport) {
@@ -615,8 +622,9 @@ int reporter_process_transfer_report (struct ReporterData *this_ireport) {
*
*/
inline int reporter_process_report (struct ReportHeader *reporthdr) {
@@ -207,7 +249,7 @@ index 7dc05b3..509ef08 100644
switch (reporthdr->type) {
case DATA_REPORT:
done = reporter_process_transfer_report((struct ReporterData *)reporthdr->this_report);
@@ -695,10 +703,10 @@ static inline void reporter_compute_packet_pps (struct TransferInfo *stats, stru
@@ -693,10 +701,10 @@ static inline void reporter_compute_packet_pps (struct TransferInfo *stats, stru
static void reporter_handle_packet_oneway_transit (struct TransferInfo *stats, struct ReportStruct *packet) {
// Transit or latency updates done inline below
double transit = TimeDifference(packet->packetTime, packet->sentTime);
@@ -216,19 +258,22 @@ index 7dc05b3..509ef08 100644
histogram_insert(stats->latency_histogram, transit, NULL);
}
- double deltaTransit;
// from RFC 1889, Real Time Protocol (RTP)
// J = J + ( | D(i-1,i) | - J ) /
// Compute jitter
@@ -913,13 +921,17 @@ void reporter_handle_packet_client (struct ReporterData *data, struct ReportStru
}
deltaTransit = transit - stats->transit.current.last;
stats->transit.current.last = transit; // shift transit for next time
if (deltaTransit < 0.0) {
@@ -938,16 +946,20 @@ void reporter_handle_packet_client (struct ReporterData *data, struct ReportStru
#define DEBUG_BB_TIMESTAMPS 0
void reporter_handle_packet_bb_client (struct ReporterData *data, struct ReportStruct *packet) {
+ double bbrtt;
+ double bbowdto;
+ double bbowdfro;
+ double asym;
struct TransferInfo *stats = &data->info;
if (packet->scheduled) {
reporter_update_mmm(&stats->schedule_error, (double)(packet->sched_err));
}
if (!packet->emptyreport && (packet->packetLen > 0)) {
struct TransferInfo *stats = &data->info;
stats->total.Bytes.current += packet->packetLen;
- double bbrtt = TimeDifference(packet->packetTime, packet->sentTime);
- double bbowdto = TimeDifference(packet->sentTimeRX, packet->sentTime);
@@ -239,23 +284,24 @@ index 7dc05b3..509ef08 100644
+ bbowdfro = TimeDifference(packet->packetTime, packet->sentTimeTX);
+ asym = bbowdfro - bbowdto;
stats->ts.prevpacketTime = packet->packetTime;
#if 0
fprintf(stderr, "BB Debug: ctx=%lx.%lx srx=%lx.%lx stx=%lx.%lx crx=%lx.%lx\n", packet->sentTime.tv_sec, packet->sentTime.tv_usec, packet->sentTimeRX.tv_sec, packet->sentTimeRX.tv_usec, packet->sentTimeTX.tv_sec, packet->sentTimeTX.tv_usec, packet->packetTime.tv_sec, packet->pAckettime.tv_usec);
@@ -1079,8 +1091,8 @@ static inline void reporter_set_timestamps_time (struct ReportTimeStamps *times,
#if DEBUG_BB_TIMESTAMPS
fprintf(stderr, "BB Debug: ctx=%lx.%lx srx=%lx.%lx stx=%lx.%lx crx=%lx.%lx (hex)\n", packet->sentTime.tv_sec, packet->sentTime.tv_usec, packet->sentTimeRX.tv_sec, packet->sentTimeRX.tv_usec, packet->sentTimeTX.tv_sec, packet->sentTimeTX.tv_usec, packet->packetTime.tv_sec, packet->packetTime.tv_usec);
@@ -1114,8 +1126,8 @@ static inline void reporter_set_timestamps_time (struct TransferInfo *stats, enu
static inline void reporter_transfer_protocol_missed_reports (struct TransferInfo *stats, struct ReportStruct *packet) {
while (TimeDifference(packet->packetTime, stats->ts.nextTime) > TimeDouble(stats->ts.intervalTime)) {
// printf("**** cmp=%f/%f next %ld.%ld packet %ld.%ld id=%ld\n", TimeDifference(packet->packetTime, stats->ts.nextTime), TimeDouble(stats->ts.intervalTime), stats->ts.nextTime.tv_sec, stats->ts.nextTime.tv_usec, packet->packetTime.tv_sec, packet->packetTime.tv_usec, packet->packetID);
- reporter_set_timestamps_time(&stats->ts, INTERVAL);
- reporter_set_timestamps_time(stats, INTERVAL);
struct TransferInfo emptystats;
+ reporter_set_timestamps_time(&stats->ts, INTERVAL);
+ reporter_set_timestamps_time(stats, INTERVAL);
memset(&emptystats, 0, sizeof(struct TransferInfo));
emptystats.ts.iStart = stats->ts.iStart;
emptystats.ts.iEnd = stats->ts.iEnd;
@@ -1395,11 +1407,11 @@ void reporter_transfer_protocol_client_udp (struct ReporterData *data, int final
@@ -1464,15 +1476,15 @@ void reporter_transfer_protocol_client_udp (struct ReporterData *data, int final
}
void reporter_transfer_protocol_server_tcp (struct ReporterData *data, int final) {
+ int ix;
+ double thisInP;
struct TransferInfo *stats = &data->info;
struct TransferInfo *sumstats = (data->GroupSumReport != NULL) ? &data->GroupSumReport->info : NULL;
struct TransferInfo *fullduplexstats = (data->FullDuplexReport != NULL) ? &data->FullDuplexReport->info : NULL;
@@ -264,7 +310,11 @@ index 7dc05b3..509ef08 100644
if (stats->framelatency_histogram) {
stats->framelatency_histogram->final = 0;
}
@@ -1726,10 +1738,13 @@ void reporter_transfer_protocol_fullduplex_udp (struct TransferInfo *stats, int
- double thisInP;
if (!final) {
double bytecnt = (double) (stats->total.Bytes.current - stats->total.Bytes.prev);
double lambda = (stats->IPGsum > 0.0) ? (bytecnt / stats->IPGsum) : 0.0;
@@ -1815,10 +1827,13 @@ void reporter_transfer_protocol_fullduplex_udp (struct TransferInfo *stats, int
// Conditional print based on time
int reporter_condprint_time_interval_report (struct ReporterData *data, struct ReportStruct *packet) {
@@ -279,7 +329,7 @@ index 7dc05b3..509ef08 100644
// Print a report if packet time exceeds the next report interval time,
// Also signal to the caller to move to the next report (or packet ring)
// if there was output. This will allow for more precise interval sum accounting.
@@ -1737,8 +1752,8 @@ int reporter_condprint_time_interval_report (struct ReporterData *data, struct R
@@ -1827,8 +1842,8 @@ int reporter_condprint_time_interval_report (struct ReporterData *data, struct R
if (TimeDifference(stats->ts.nextTime, packet->packetTime) < 0) {
assert(data->transfer_protocol_handler!=NULL);
advance_jobq = 1;
@@ -291,10 +341,10 @@ index 7dc05b3..509ef08 100644
#ifdef DEBUG_PPS
printf("*** packetID TRIGGER = %ld pt=%ld.%ld empty=%d nt=%ld.%ld\n",packet->packetID, packet->packetTime.tv_sec, packet->packetTime.tv_usec, packet->emptyreport, stats->ts.nextTime.tv_sec, stats->ts.nextTime.tv_usec);
diff --git a/src/Reports.c b/src/Reports.c
index 9c44ace..9debdf1 100644
index 008f7f4..06e32de 100644
--- a/src/Reports.c
+++ b/src/Reports.c
@@ -180,13 +180,14 @@ static void free_common_copy (struct ReportCommon *common) {
@@ -181,13 +181,14 @@ static void free_common_copy (struct ReportCommon *common) {
// this will get the next one. Otherwise it will use
// the value.
void setTransferID (struct thread_Settings *inSettings, int role_reversal) {
@@ -310,7 +360,7 @@ index 9c44ace..9debdf1 100644
if (role_reversal) {
#ifdef HAVE_ROLE_REVERSAL_ID
if (isPermitKey(inSettings) && (inSettings->mPermitKey[0] != '\0')) {
@@ -331,9 +332,10 @@ struct SumReport* InitSumReport(struct thread_Settings *inSettings, int inID, in
@@ -386,9 +387,10 @@ struct SumReport* InitSumReport(struct thread_Settings *inSettings, int inID, in
}
struct ConnectionInfo * InitConnectOnlyReport (struct thread_Settings *thread) {
@@ -322,7 +372,7 @@ index 9c44ace..9debdf1 100644
if (!creport) {
FAIL(1, "Out of Memory!!\n", thread);
}
@@ -452,6 +454,7 @@ void IncrSumReportRefCounter (struct SumReport *sumreport) {
@@ -522,6 +524,7 @@ void IncrSumReportRefCounter (struct SumReport *sumreport) {
}
int DecrSumReportRefCounter (struct SumReport *sumreport) {
@@ -330,7 +380,7 @@ index 9c44ace..9debdf1 100644
assert(sumreport);
// thread_debug("before lock hdr=%p", (void *)sumreport);
Mutex_Lock(&sumreport->reference.lock);
@@ -459,7 +462,7 @@ int DecrSumReportRefCounter (struct SumReport *sumreport) {
@@ -529,7 +532,7 @@ int DecrSumReportRefCounter (struct SumReport *sumreport) {
thread_debug("Sum multiheader %p ref=%d->%d", (void *)sumreport, sumreport->reference.count, (sumreport->reference.count - 1));
#endif
// thread_debug("in lock hdr=%p", (void *)sumreport);
@@ -339,7 +389,7 @@ index 9c44ace..9debdf1 100644
Mutex_Unlock(&sumreport->reference.lock);
// thread_debug("unlock hdr=%p", (void *)sumreport);
return refcnt;
@@ -475,8 +478,10 @@ struct ReportHeader* InitIndividualReport (struct thread_Settings *inSettings) {
@@ -545,8 +548,10 @@ struct ReportHeader* InitIndividualReport (struct thread_Settings *inSettings) {
/*
* Create the report header and an ireport (if needed)
*/
@@ -351,16 +401,16 @@ index 9c44ace..9debdf1 100644
if (reporthdr == NULL) {
FAIL(1, "Out of Memory!!\n", inSettings);
}
@@ -487,7 +492,7 @@ struct ReportHeader* InitIndividualReport (struct thread_Settings *inSettings) {
@@ -557,7 +562,7 @@ struct ReportHeader* InitIndividualReport (struct thread_Settings *inSettings) {
reporthdr->type = DATA_REPORT;
reporthdr->ReportMode = inSettings->mReportMode;
- struct ReporterData *ireport = (struct ReporterData *)(reporthdr->this_report);
+ ireport = (struct ReporterData *)(reporthdr->this_report);
if (inSettings->mSumReport) {
IncrSumReportRefCounter(inSettings->mSumReport);
ireport->GroupSumReport = inSettings->mSumReport;
@@ -704,8 +709,10 @@ struct ReportHeader* InitIndividualReport (struct thread_Settings *inSettings) {
}
@@ -796,8 +801,10 @@ struct ReportHeader* InitIndividualReport (struct thread_Settings *inSettings) {
* and to extend.
*/
struct ReportHeader* InitConnectionReport (struct thread_Settings *inSettings) {
@@ -372,7 +422,7 @@ index 9c44ace..9debdf1 100644
if (reporthdr == NULL) {
FAIL(1, "Out of Memory!!\n", inSettings);
}
@@ -716,7 +723,7 @@ struct ReportHeader* InitConnectionReport (struct thread_Settings *inSettings) {
@@ -808,7 +815,7 @@ struct ReportHeader* InitConnectionReport (struct thread_Settings *inSettings) {
reporthdr->type = CONNECTION_REPORT;
reporthdr->ReportMode = inSettings->mReportMode;
@@ -381,7 +431,7 @@ index 9c44ace..9debdf1 100644
common_copy(&creport->common, inSettings);
tcpstats_copy(&creport->tcpinitstats, &inSettings->tcpinitstats);
// Fill out known fields for the connection report
@@ -762,8 +769,10 @@ struct ReportHeader* InitConnectionReport (struct thread_Settings *inSettings) {
@@ -854,8 +861,10 @@ struct ReportHeader* InitConnectionReport (struct thread_Settings *inSettings) {
* settings being used with Listeners or Clients
*/
struct ReportHeader *InitSettingsReport (struct thread_Settings *inSettings) {
@@ -393,7 +443,7 @@ index 9c44ace..9debdf1 100644
if (reporthdr == NULL) {
FAIL(1, "Out of Memory!!\n", inSettings);
}
@@ -774,7 +783,7 @@ struct ReportHeader *InitSettingsReport (struct thread_Settings *inSettings) {
@@ -866,7 +875,7 @@ struct ReportHeader *InitSettingsReport (struct thread_Settings *inSettings) {
reporthdr->type = SETTINGS_REPORT;
reporthdr->ReportMode = inSettings->mReportMode;
@@ -402,7 +452,7 @@ index 9c44ace..9debdf1 100644
common_copy(&sreport->common, inSettings);
sreport->peer = inSettings->peer;
sreport->size_peer = inSettings->size_peer;
@@ -810,6 +819,9 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
@@ -902,6 +911,9 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
/*
* Create the report header and an ireport (if needed)
*/
@@ -412,7 +462,7 @@ index 9c44ace..9debdf1 100644
struct ReportHeader *reporthdr = (struct ReportHeader *) calloc(1, sizeof(struct ReportHeader));
if (reporthdr == NULL) {
FAIL(1, "Out of Memory!!\n", inSettings);
@@ -823,9 +835,9 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
@@ -915,9 +927,9 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
#endif
reporthdr->type = SERVER_RELAY_REPORT;
reporthdr->ReportMode = inSettings->mReportMode;
@@ -424,7 +474,7 @@ index 9c44ace..9debdf1 100644
stats->common->transferID = inSettings->mTransferID;
stats->jitter = ntohl(server->base.jitter1);
@@ -839,7 +851,7 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
@@ -931,7 +943,7 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
stats->ts.iStart = 0;
stats->ts.iEnd = ntohl(server->base.stop_sec);
stats->ts.iEnd += ntohl(server->base.stop_usec) / (double)rMillion;
@@ -433,7 +483,7 @@ index 9c44ace..9debdf1 100644
if ((flags & HEADER_SEQNO64B)) {
stats->cntError = (((intmax_t) ntohl(server->extend2.error_cnt2)) << 32) + \
ntohl(server->base.error_cnt);
@@ -889,22 +901,29 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
@@ -981,22 +993,29 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
* Sent by server to client
* ------------------------------------------------------------------- */
void write_UDP_AckFIN (struct TransferInfo *stats, int len) {
@@ -471,7 +521,7 @@ index 9c44ace..9debdf1 100644
if (isEnhanced(stats->common) || isTripTime(stats->common))
flags |= SERVER_HEADER_EXTEND;
#ifdef HAVE_INT64_T
@@ -948,7 +967,7 @@ void write_UDP_AckFIN (struct TransferInfo *stats, int len) {
@@ -1043,7 +1062,7 @@ void write_UDP_AckFIN (struct TransferInfo *stats, int len) {
hdr->extend.IPGsum = htonl(1);
#define TRYCOUNT 10
@@ -481,10 +531,10 @@ index 9c44ace..9debdf1 100644
// write data
#if defined(HAVE_LINUX_FILTER_H) && defined(HAVE_AF_PACKET)
diff --git a/src/Server.cpp b/src/Server.cpp
index 65e56a0..86e785b 100644
index c271cd7..cea672a 100644
--- a/src/Server.cpp
+++ b/src/Server.cpp
@@ -603,7 +603,7 @@ bool Server::InitTrafficLoop (void) {
@@ -610,7 +610,7 @@ bool Server::InitTrafficLoop (void) {
ClientReverseFirstRead();
}
if (isTripTime(mSettings)) {
@@ -494,10 +544,10 @@ index 65e56a0..86e785b 100644
fprintf(stdout,"WARN: ignore --trip-times because client didn't provide valid start timestamp within %d seconds of now\n", MAXDIFFTIMESTAMPSECS);
mSettings->accept_time.tv_sec = now.getSecs();
diff --git a/src/histogram.c b/src/histogram.c
index 5bb8820..2df448a 100644
index 3a9b82c..53d01a6 100644
--- a/src/histogram.c
+++ b/src/histogram.c
@@ -175,15 +175,16 @@ void histogram_add(struct histogram *to, struct histogram *from) {
@@ -192,15 +192,16 @@ void histogram_add(struct histogram *to, struct histogram *from) {
}
void histogram_print(struct histogram *h, double start, double end) {
@@ -517,7 +567,7 @@ index 5bb8820..2df448a 100644
intervalpopulation = h->populationcnt - h->prev->populationcnt;
strcpy(h->outbuf, h->myname);
sprintf(h->outbuf, "[%3d] " IPERFTimeFrmt " sec %s%s%s bin(w=%d%s):cnt(%d)=", h->id, start, end, h->myname, (h->final ? "(f)" : ""), "-PDF:",h->binwidth, ((h->units == 1e3) ? "ms" : "us"), intervalpopulation);
@@ -194,7 +195,6 @@ void histogram_print(struct histogram *h, double start, double end) {
@@ -211,7 +212,6 @@ void histogram_print(struct histogram *h, double start, double end) {
outliercnt=0;
fence_lower = 0;
fence_upper = 0;
@@ -525,6 +575,27 @@ index 5bb8820..2df448a 100644
h->prev->populationcnt = h->populationcnt;
oob_l = h->cntloweroutofbounds - h->prev->cntloweroutofbounds;
h->prev->cntloweroutofbounds = h->cntloweroutofbounds;
diff --git a/src/iperf_formattime.c b/src/iperf_formattime.c
index df65650..02efb9b 100644
--- a/src/iperf_formattime.c
+++ b/src/iperf_formattime.c
@@ -50,6 +50,7 @@
#include "iperf_formattime.h"
inline void iperf_formattime (char *timestr, int buflen, struct timeval timestamp, bool prec_ms, bool utc_time, enum TimeFormatType ftype) {
+ int currlen;
struct tm ts ;
ts = (utc_time ? *gmtime(&timestamp.tv_sec) : *localtime(&timestamp.tv_sec));
switch (ftype) {
@@ -64,7 +65,7 @@ inline void iperf_formattime (char *timestr, int buflen, struct timeval timestam
break;
case YearThruSecTZ:
strftime(timestr, buflen, "%Y-%m-%d %H:%M:%S", &ts);
- int currlen = strlen(timestr);
+ currlen = strlen(timestr);
if (prec_ms) {
if (currlen > 5) {
snprintf((timestr + currlen), 5, ".%.3d", (int) (timestamp.tv_usec/1000));
diff --git a/src/packet_ring.c b/src/packet_ring.c
index 93e7578..f6114e2 100644
--- a/src/packet_ring.c