mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-06 15:08:57 +02:00
iperf: bump to 2.1.4 (#6348)
This commit is contained in:
@@ -7,9 +7,12 @@ 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="c88adec966096a81136dda91b4bd19c27aae06df4d45a7f547a8e50d723778ad"
|
||||
CHECKSUM_SHA256="062b392e87b8e227aca74fef0a99b04fe0382d4518957041b508a56885b4d4f9"
|
||||
SOURCE_DIR="iperf-$portVersion"
|
||||
PATCHES="iperf-$portVersion.patchset"
|
||||
|
||||
if [ $effectiveTargetArchitecture = x86_gcc2 ]; then
|
||||
PATCHES="iperf-$portVersion.gcc2.patchset"
|
||||
fi
|
||||
|
||||
ARCHITECTURES="all"
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
From 0c6d5b283f65ebfa15186177e3d813f014d227d6 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/include/Settings.hpp b/include/Settings.hpp
|
||||
index 00a0ebb..e6dc7e1 100644
|
||||
--- a/include/Settings.hpp
|
||||
+++ b/include/Settings.hpp
|
||||
@@ -452,7 +452,6 @@ typedef enum MsgType {
|
||||
* and must be packed by the compilers
|
||||
* Align on 32 bits (4 bytes)
|
||||
*/
|
||||
-#pragma pack(push,4)
|
||||
typedef struct UDP_datagram {
|
||||
// used to reference the 4 byte ID number we place in UDP datagrams
|
||||
// Support 64 bit seqno on machines that support them
|
||||
@@ -664,7 +663,6 @@ typedef struct server_hdr {
|
||||
server_hdr_extension2 extend2;
|
||||
} server_hdr;
|
||||
|
||||
-#pragma pack(pop)
|
||||
|
||||
#define SIZEOF_UDPCLIENTMSG (sizeof(client_hdr) + sizeof(UDP_datagram))
|
||||
#define SIZEOF_TCPHDRMSG (int) ((sizeof(client_hdr) > sizeof(server_hdr)) ? (int) sizeof(client_hdr) : (int) sizeof(server_hdr))
|
||||
diff --git a/src/ReportDefault.c b/src/ReportDefault.c
|
||||
index 4f9f7a5..ccccd9a 100644
|
||||
--- a/src/ReportDefault.c
|
||||
+++ b/src/ReportDefault.c
|
||||
@@ -483,9 +483,6 @@ void reporter_reportsettings( ReporterData *data ) {
|
||||
*/
|
||||
void *reporter_reportpeer( Connection_Info *stats, int ID ) {
|
||||
if ( ID > 0 ) {
|
||||
- if (stats->epochStartTime.tv_sec) {
|
||||
- printf(client_report_epoch_start, ID,stats->epochStartTime.tv_sec, stats->epochStartTime.tv_usec);
|
||||
- }
|
||||
// copy the inet_ntop into temp buffers, to avoid overwriting
|
||||
char local_addr[ REPORT_ADDRLEN ];
|
||||
char remote_addr[ REPORT_ADDRLEN ];
|
||||
@@ -493,9 +490,12 @@ void *reporter_reportpeer( Connection_Info *stats, int ID ) {
|
||||
struct sockaddr *peer = ((struct sockaddr*)&stats->peer);
|
||||
|
||||
char extbuf[2*PEERBUFSIZE];
|
||||
- extbuf[(2*PEERBUFSIZE)-1] = '\0';
|
||||
char *b = &extbuf[0];
|
||||
+ extbuf[(2*PEERBUFSIZE)-1] = '\0';
|
||||
extbuf[0]= '\0';
|
||||
+ if (stats->epochStartTime.tv_sec) {
|
||||
+ printf(client_report_epoch_start, ID,stats->epochStartTime.tv_sec, stats->epochStartTime.tv_usec);
|
||||
+ }
|
||||
if (stats->l2mode) {
|
||||
snprintf(b, PEERBUFSIZE, " (%s=0x%X)", "l2mode", stats->l2mode);
|
||||
b += strlen(b);
|
||||
diff --git a/src/Reporter.c b/src/Reporter.c
|
||||
index 80891aa..06f08c4 100644
|
||||
--- a/src/Reporter.c
|
||||
+++ b/src/Reporter.c
|
||||
@@ -242,6 +242,7 @@ void BarrierClient( ReportHeader *agent ) {
|
||||
* synchronize on compeleting their connect()
|
||||
*/
|
||||
void InitReport(thread_Settings *mSettings) {
|
||||
+ ReportHeader *reporthdr;
|
||||
// Note, this must be called in order as
|
||||
// the data report structures need to be
|
||||
// initialized first
|
||||
@@ -251,7 +252,7 @@ void InitReport(thread_Settings *mSettings) {
|
||||
if (isConnectionReport(mSettings)) {
|
||||
InitConnectionReport(mSettings);
|
||||
}
|
||||
- ReportHeader *reporthdr = mSettings->reporthdr;
|
||||
+ reporthdr = mSettings->reporthdr;
|
||||
if (reporthdr && (isDataReport(mSettings) || isConnectionReport(mSettings))) {
|
||||
//
|
||||
// Set the report start times and next report times
|
||||
diff --git a/src/histogram.c b/src/histogram.c
|
||||
index 5950278..a9116a4 100644
|
||||
--- a/src/histogram.c
|
||||
+++ b/src/histogram.c
|
||||
@@ -122,15 +122,16 @@ void histogram_add(histogram_t *to, histogram_t *from) {
|
||||
}
|
||||
|
||||
void histogram_print(histogram_t *h, double start, double end, int final) {
|
||||
+ int n = 0, ix, delta, lowerci, upperci, outliercnt, fence_lower, fence_upper;
|
||||
+ int running=0;
|
||||
+ int intervalpopulation, oob_u, oob_l;
|
||||
+ int outside3fences = 0;
|
||||
if (final && h->prev) {
|
||||
histogram_clear(h->prev);
|
||||
}
|
||||
if (!h->prev) {
|
||||
h->prev = histogram_init(h->bincount, h->binwidth, h->offset, h->units, h->ci_lower, h->ci_upper, h->id, h->myname);
|
||||
}
|
||||
- int n = 0, ix, delta, lowerci, upperci, outliercnt, fence_lower, fence_upper;
|
||||
- int running=0;
|
||||
- int intervalpopulation, oob_u, oob_l;
|
||||
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, (final ? "(f)" : ""), "-PDF:",h->binwidth, ((h->units == 1e3) ? "ms" : "us"), intervalpopulation);
|
||||
@@ -140,7 +141,6 @@ void histogram_print(histogram_t *h, double start, double end, int final) {
|
||||
outliercnt=0;
|
||||
fence_lower = 0;
|
||||
fence_upper = 0;
|
||||
- int outside3fences = 0;
|
||||
h->prev->populationcnt = h->populationcnt;
|
||||
oob_l = h->cntloweroutofbounds - h->prev->cntloweroutofbounds;
|
||||
h->prev->cntloweroutofbounds = h->cntloweroutofbounds;
|
||||
diff --git a/src/sockets.c b/src/sockets.c
|
||||
index e0f4800..f628e27 100644
|
||||
--- a/src/sockets.c
|
||||
+++ b/src/sockets.c
|
||||
@@ -244,10 +244,12 @@ bool setsock_blocking (int fd, bool blocking) {
|
||||
unsigned long mode = blocking ? 0 : 1;
|
||||
return (ioctlsocket(fd, FIONBIO, &mode) == 0) ? TRUE : FALSE;
|
||||
#else
|
||||
+{
|
||||
int flags = fcntl(fd, F_GETFL, 0);
|
||||
if (flags < 0) return FALSE;
|
||||
flags = blocking ? (flags&~O_NONBLOCK) : (flags|O_NONBLOCK);
|
||||
return (fcntl(fd, F_SETFL, flags) == 0) ? TRUE : FALSE;
|
||||
+}
|
||||
#endif
|
||||
}
|
||||
|
||||
--
|
||||
2.19.1
|
||||
|
||||
550
net-analyzer/iperf/patches/iperf-2.1.4.gcc2.patchset
Normal file
550
net-analyzer/iperf/patches/iperf-2.1.4.gcc2.patchset
Normal file
@@ -0,0 +1,550 @@
|
||||
From c7e369241391c97532aba898a64757b15afe2649 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 b69636c..e6342fd 100644
|
||||
--- a/src/ReportOutputs.c
|
||||
+++ b/src/ReportOutputs.c
|
||||
@@ -228,9 +228,11 @@ void tcp_output_read_enhanced (struct TransferInfo *stats) {
|
||||
fflush(stdout);
|
||||
}
|
||||
void tcp_output_read_enhanced_triptime (struct TransferInfo *stats) {
|
||||
+ double meantransit;
|
||||
+ double lambda;
|
||||
HEADING_PRINT_COND(report_bw_read_enhanced_netpwr);
|
||||
- double meantransit = (stats->transit.cntTransit > 0) ? (stats->transit.sumTransit / stats->transit.cntTransit) : 0;
|
||||
- double lambda = (stats->IPGsum > 0.0) ? ((double)stats->cntBytes / stats->IPGsum) : 0.0;
|
||||
+ meantransit = (stats->transit.cntTransit > 0) ? (stats->transit.sumTransit / stats->transit.cntTransit) : 0;
|
||||
+ lambda = (stats->IPGsum > 0.0) ? ((double)stats->cntBytes / stats->IPGsum) : 0.0;
|
||||
set_llawbuf(lambda, meantransit, stats);
|
||||
_print_stats_common(stats);
|
||||
if (stats->cntBytes) {
|
||||
@@ -931,13 +933,14 @@ static void format_ips_ports_string (struct TransferInfo *stats) {
|
||||
}
|
||||
|
||||
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';
|
||||
}
|
||||
- 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,
|
||||
@@ -953,13 +956,14 @@ void udp_output_basic_csv (struct TransferInfo *stats) {
|
||||
(100.0 * stats->cntError) / stats->cntDatagrams, stats->cntOutofOrder );
|
||||
}
|
||||
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';
|
||||
}
|
||||
- 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,
|
||||
@@ -1179,12 +1183,13 @@ void reporter_print_connection_report (struct ConnectionInfo *report) {
|
||||
// copy the inet_ntop into temp buffers, to avoid overwriting
|
||||
char local_addr[REPORT_ADDRLEN];
|
||||
char remote_addr[REPORT_ADDRLEN];
|
||||
+ char *b;
|
||||
struct sockaddr *local = ((struct sockaddr*)&report->common->local);
|
||||
struct sockaddr *peer = ((struct sockaddr*)&report->common->peer);
|
||||
outbuffer[0]='\0';
|
||||
outbufferext[0]='\0';
|
||||
outbufferext2[0]='\0';
|
||||
- char *b = &outbuffer[0];
|
||||
+ b = &outbuffer[0];
|
||||
if (!isUDP(report->common) && (report->common->socket > 0) && (isPrintMSS(report->common) || isEnhanced(report->common))) {
|
||||
if (isPrintMSS(report->common) && (report->MSS <= 0)) {
|
||||
printf(report_mss_unsupported, report->MSS);
|
||||
@@ -1258,8 +1263,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)) {
|
||||
snprintf(b, SNBUFFERSIZE-strlen(b), " (ct=%4.2f ms) on %s", report->connecttime, now_timebuf);
|
||||
@@ -1341,6 +1346,8 @@ void reporter_print_connection_report (struct ConnectionInfo *report) {
|
||||
char start_timebuf[80];
|
||||
struct timeval now;
|
||||
struct timeval start;
|
||||
+ char now_timebuf[80];
|
||||
+ int seconds_from_now;
|
||||
#ifdef HAVE_CLOCK_GETTIME
|
||||
struct timespec t1;
|
||||
clock_gettime(CLOCK_REALTIME, &t1);
|
||||
@@ -1350,10 +1357,8 @@ void reporter_print_connection_report (struct ConnectionInfo *report) {
|
||||
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)
|
||||
diff --git a/src/Reporter.c b/src/Reporter.c
|
||||
index 2ebfa1b..ded0d7b 100644
|
||||
--- a/src/Reporter.c
|
||||
+++ b/src/Reporter.c
|
||||
@@ -172,8 +172,9 @@ bool ReportPacket (struct ReporterData* data, struct ReportStruct *packet, struc
|
||||
}
|
||||
#else
|
||||
void ReportPacket (struct ReporterData* data, struct ReportStruct *packet) {
|
||||
+ struct TransferInfo *stats;
|
||||
assert(data != NULL);
|
||||
- struct TransferInfo *stats = &data->info;
|
||||
+ stats = &data->info;
|
||||
#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);
|
||||
@@ -207,15 +208,17 @@ void 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) {
|
||||
+ struct ReporterData *report;
|
||||
+ struct ReportStruct packet;
|
||||
+ int do_close;
|
||||
assert(reporthdr!=NULL);
|
||||
assert(finalpacket!=NULL);
|
||||
- struct ReporterData *report = (struct ReporterData *) reporthdr->this_report;
|
||||
- struct ReportStruct packet;
|
||||
+ report = (struct ReporterData *) reporthdr->this_report;
|
||||
#if defined(HAVE_STRUCT_TCP_INFO_TCPI_TOTAL_RETRANS) | defined(HAVE_THREAD_DEBUG)
|
||||
struct TransferInfo *stats = &report->info;
|
||||
#endif
|
||||
memset(&packet, 0, sizeof(struct ReportStruct));
|
||||
- int do_close = 1;
|
||||
+ do_close = 1;
|
||||
/*
|
||||
* Using PacketID of -1 ends reporting
|
||||
* It pushes a "special packet" through
|
||||
@@ -488,10 +491,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) {
|
||||
+ struct TransferInfo *sumstats;
|
||||
+ struct TransferInfo *fullduplexstats;
|
||||
+ int need_free;
|
||||
+ struct ReportStruct *packet;
|
||||
+ int advance_jobq;
|
||||
assert(this_ireport != NULL);
|
||||
- struct TransferInfo *sumstats = (this_ireport->GroupSumReport ? &this_ireport->GroupSumReport->info : NULL);
|
||||
- struct TransferInfo *fullduplexstats = (this_ireport->FullDuplexReport ? &this_ireport->FullDuplexReport->info : NULL);
|
||||
- int need_free = 0;
|
||||
+ sumstats = (this_ireport->GroupSumReport ? &this_ireport->GroupSumReport->info : NULL);
|
||||
+ fullduplexstats = (this_ireport->FullDuplexReport ? &this_ireport->FullDuplexReport->info : NULL);
|
||||
+ need_free = 0;
|
||||
// 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
|
||||
@@ -506,8 +514,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
|
||||
- struct ReportStruct *packet = NULL;
|
||||
- int advance_jobq = 0;
|
||||
+ packet = NULL;
|
||||
+ advance_jobq = 0;
|
||||
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
|
||||
@@ -593,8 +601,9 @@ int reporter_process_transfer_report (struct ReporterData *this_ireport) {
|
||||
*
|
||||
*/
|
||||
inline int reporter_process_report (struct ReportHeader *reporthdr) {
|
||||
+ int done;
|
||||
assert(reporthdr != NULL);
|
||||
- int done = 1;
|
||||
+ done = 1;
|
||||
switch (reporthdr->type) {
|
||||
case DATA_REPORT:
|
||||
done = reporter_process_transfer_report((struct ReporterData *)reporthdr->this_report);
|
||||
@@ -996,8 +1005,8 @@ static inline void reporter_set_timestamps_time (struct ReportTimeStamps *times,
|
||||
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);
|
||||
struct TransferInfo emptystats;
|
||||
+ reporter_set_timestamps_time(&stats->ts, INTERVAL);
|
||||
memset(&emptystats, 0, sizeof(struct TransferInfo));
|
||||
emptystats.ts.iStart = stats->ts.iStart;
|
||||
emptystats.ts.iEnd = stats->ts.iEnd;
|
||||
@@ -1313,11 +1322,11 @@ void reporter_transfer_protocol_client_udp (struct ReporterData *data, int final
|
||||
}
|
||||
|
||||
void reporter_transfer_protocol_server_tcp (struct ReporterData *data, int final) {
|
||||
+ int ix;
|
||||
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;
|
||||
stats->cntBytes = stats->total.Bytes.current - stats->total.Bytes.prev;
|
||||
- int ix;
|
||||
if (stats->framelatency_histogram) {
|
||||
stats->framelatency_histogram->final = 0;
|
||||
}
|
||||
@@ -1587,18 +1596,21 @@ 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) {
|
||||
+ int advance_jobq;
|
||||
+ struct TransferInfo *sumstats;
|
||||
+ struct TransferInfo *fullduplexstats;
|
||||
struct TransferInfo *stats = &data->info;
|
||||
assert(stats!=NULL);
|
||||
// printf("***sum handler = %p\n", (void *) data->GroupSumReport->transfer_protocol_sum_handler);
|
||||
- int advance_jobq = 0;
|
||||
+ advance_jobq = 0;
|
||||
// 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.
|
||||
if (TimeDifference(stats->ts.nextTime, packet->packetTime) < 0) {
|
||||
assert(data->transfer_protocol_handler!=NULL);
|
||||
advance_jobq = 1;
|
||||
- struct TransferInfo *sumstats = (data->GroupSumReport ? &data->GroupSumReport->info : NULL);
|
||||
- struct TransferInfo *fullduplexstats = (data->FullDuplexReport ? &data->FullDuplexReport->info : NULL);
|
||||
+ sumstats = (data->GroupSumReport ? &data->GroupSumReport->info : NULL);
|
||||
+ fullduplexstats = (data->FullDuplexReport ? &data->FullDuplexReport->info : NULL);
|
||||
stats->ts.packetTime = packet->packetTime;
|
||||
#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);
|
||||
@@ -1669,10 +1681,12 @@ int reporter_condprint_frame_interval_report_server_tcp (struct ReporterData *da
|
||||
}
|
||||
|
||||
int reporter_condprint_burst_interval_report_server_tcp (struct ReporterData *data, struct ReportStruct *packet) {
|
||||
+ struct TransferInfo *stats;
|
||||
+ int advance_jobq;
|
||||
assert(packet->burstsize != 0);
|
||||
- struct TransferInfo *stats = &data->info;
|
||||
+ stats = &data->info;
|
||||
|
||||
- int advance_jobq = 0;
|
||||
+ advance_jobq = 0;
|
||||
// first packet of a burst and not a duplicate
|
||||
if (packet->transit_ready) {
|
||||
stats->tripTime = reporter_handle_packet_oneway_transit(data, packet);
|
||||
diff --git a/src/Reports.c b/src/Reports.c
|
||||
index 695ec9e..954bd4b 100644
|
||||
--- a/src/Reports.c
|
||||
+++ b/src/Reports.c
|
||||
@@ -81,8 +81,9 @@ static inline int my_str_copy(char **dst, char *src) {
|
||||
// better encpasulate report handling.
|
||||
static void common_copy (struct ReportCommon **common, struct thread_Settings *inSettings) {
|
||||
// Do deep copies from settings
|
||||
+ int bytecnt;
|
||||
*common = (struct ReportCommon *) calloc(1, sizeof(struct ReportCommon));
|
||||
- int bytecnt = 0;
|
||||
+ bytecnt = 0;
|
||||
bytecnt = my_str_copy(&(*common)->Host, inSettings->mHost);
|
||||
bytecnt += my_str_copy(&(*common)->HideHost, inSettings->mHideHost);
|
||||
bytecnt += my_str_copy(&(*common)->Localhost, inSettings->mLocalhost);
|
||||
@@ -188,13 +189,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) {
|
||||
+ int len;
|
||||
if (!inSettings->mTransferIDStr) {
|
||||
if (!inSettings->mTransferID) {
|
||||
Mutex_Lock(&transferid_mutex);
|
||||
inSettings->mTransferID = ++transferid_counter;
|
||||
Mutex_Unlock(&transferid_mutex);
|
||||
}
|
||||
- int len = 0;
|
||||
+ len = 0;
|
||||
if (role_reversal) {
|
||||
#ifdef HAVE_ROLE_REVERSAL_ID
|
||||
if (isPermitKey(inSettings) && (inSettings->mPermitKey[0] != '\0')) {
|
||||
@@ -338,9 +340,10 @@ struct SumReport* InitSumReport(struct thread_Settings *inSettings, int inID, in
|
||||
}
|
||||
|
||||
struct ConnectionInfo * InitConnectOnlyReport (struct thread_Settings *thread) {
|
||||
+ struct ConnectionInfo *creport;
|
||||
assert(thread != NULL);
|
||||
// this connection report used only by report for accumulate stats
|
||||
- struct ConnectionInfo *creport = (struct ConnectionInfo *) calloc(1, sizeof(struct ConnectionInfo));
|
||||
+ creport = (struct ConnectionInfo *) calloc(1, sizeof(struct ConnectionInfo));
|
||||
if (!creport) {
|
||||
FAIL(1, "Out of Memory!!\n", thread);
|
||||
}
|
||||
@@ -456,6 +459,7 @@ void IncrSumReportRefCounter (struct SumReport *sumreport) {
|
||||
}
|
||||
|
||||
int DecrSumReportRefCounter (struct SumReport *sumreport) {
|
||||
+ int refcnt;
|
||||
assert(sumreport);
|
||||
// thread_debug("before lock hdr=%p", (void *)sumreport);
|
||||
Mutex_Lock(&sumreport->reference.lock);
|
||||
@@ -463,7 +467,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);
|
||||
- int refcnt = --sumreport->reference.count;
|
||||
+ refcnt = --sumreport->reference.count;
|
||||
Mutex_Unlock(&sumreport->reference.lock);
|
||||
// thread_debug("unlock hdr=%p", (void *)sumreport);
|
||||
return refcnt;
|
||||
@@ -479,8 +483,10 @@ struct ReportHeader* InitIndividualReport (struct thread_Settings *inSettings) {
|
||||
/*
|
||||
* Create the report header and an ireport (if needed)
|
||||
*/
|
||||
+ struct ReportHeader *reporthdr;
|
||||
+ struct ReporterData *ireport;
|
||||
assert(inSettings!=NULL);
|
||||
- struct ReportHeader *reporthdr = (struct ReportHeader *) calloc(1, sizeof(struct ReportHeader));
|
||||
+ reporthdr = (struct ReportHeader *) calloc(1, sizeof(struct ReportHeader));
|
||||
if (reporthdr == NULL) {
|
||||
FAIL(1, "Out of Memory!!\n", inSettings);
|
||||
}
|
||||
@@ -491,7 +497,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;
|
||||
@@ -679,8 +685,10 @@ struct ReportHeader* InitIndividualReport (struct thread_Settings *inSettings) {
|
||||
* and to extend.
|
||||
*/
|
||||
struct ReportHeader* InitConnectionReport (struct thread_Settings *inSettings, double ct) {
|
||||
+ struct ReportHeader *reporthdr;
|
||||
+ struct ConnectionInfo * creport;
|
||||
assert(inSettings != NULL);
|
||||
- struct ReportHeader *reporthdr = (struct ReportHeader *) calloc(1, sizeof(struct ReportHeader));
|
||||
+ reporthdr = (struct ReportHeader *) calloc(1, sizeof(struct ReportHeader));
|
||||
if (reporthdr == NULL) {
|
||||
FAIL(1, "Out of Memory!!\n", inSettings);
|
||||
}
|
||||
@@ -691,7 +699,7 @@ struct ReportHeader* InitConnectionReport (struct thread_Settings *inSettings, d
|
||||
reporthdr->type = CONNECTION_REPORT;
|
||||
reporthdr->ReportMode = inSettings->mReportMode;
|
||||
|
||||
- struct ConnectionInfo * creport = (struct ConnectionInfo *)(reporthdr->this_report);
|
||||
+ creport = (struct ConnectionInfo *)(reporthdr->this_report);
|
||||
common_copy(&creport->common, inSettings);
|
||||
if (!isUDP(inSettings) && (inSettings->mSock > 0) && !isDontRoute(inSettings) && \
|
||||
!(ct <= 0.0 && (inSettings->mThreadMode == kMode_Client))) {
|
||||
@@ -743,8 +751,10 @@ struct ReportHeader* InitConnectionReport (struct thread_Settings *inSettings, d
|
||||
* settings being used with Listeners or Clients
|
||||
*/
|
||||
struct ReportHeader *InitSettingsReport (struct thread_Settings *inSettings) {
|
||||
+ struct ReportHeader *reporthdr;
|
||||
+ struct ReportSettings *sreport;
|
||||
assert(inSettings != NULL);
|
||||
- struct ReportHeader *reporthdr = (struct ReportHeader *) calloc(1, sizeof(struct ReportHeader));
|
||||
+ reporthdr = (struct ReportHeader *) calloc(1, sizeof(struct ReportHeader));
|
||||
if (reporthdr == NULL) {
|
||||
FAIL(1, "Out of Memory!!\n", inSettings);
|
||||
}
|
||||
@@ -755,7 +765,7 @@ struct ReportHeader *InitSettingsReport (struct thread_Settings *inSettings) {
|
||||
reporthdr->type = SETTINGS_REPORT;
|
||||
reporthdr->ReportMode = inSettings->mReportMode;
|
||||
|
||||
- struct ReportSettings *sreport = (struct ReportSettings *)reporthdr->this_report;
|
||||
+ sreport = (struct ReportSettings *)reporthdr->this_report;
|
||||
common_copy(&sreport->common, inSettings);
|
||||
sreport->peer = inSettings->peer;
|
||||
sreport->size_peer = inSettings->size_peer;
|
||||
@@ -784,6 +794,9 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
|
||||
/*
|
||||
* Create the report header and an ireport (if needed)
|
||||
*/
|
||||
+ struct ServerRelay *sr_report;
|
||||
+ struct TransferInfo *stats;
|
||||
+ uint32_t flags;
|
||||
struct ReportHeader *reporthdr = (struct ReportHeader *) calloc(1, sizeof(struct ReportHeader));
|
||||
if (reporthdr == NULL) {
|
||||
FAIL(1, "Out of Memory!!\n", inSettings);
|
||||
@@ -797,9 +810,9 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
|
||||
#endif
|
||||
reporthdr->type = SERVER_RELAY_REPORT;
|
||||
reporthdr->ReportMode = inSettings->mReportMode;
|
||||
- struct ServerRelay *sr_report = (struct ServerRelay *)reporthdr->this_report;
|
||||
+ sr_report = (struct ServerRelay *)reporthdr->this_report;
|
||||
common_copy(&sr_report->info.common, inSettings);
|
||||
- struct TransferInfo *stats = &sr_report->info;
|
||||
+ stats = &sr_report->info;
|
||||
stats->common->transferID = inSettings->mTransferID;
|
||||
|
||||
stats->jitter = ntohl(server->base.jitter1);
|
||||
@@ -813,7 +826,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;
|
||||
- uint32_t flags = ntohl(server->base.flags);
|
||||
+ flags = ntohl(server->base.flags);
|
||||
if ((flags & HEADER_SEQNO64B)) {
|
||||
stats->cntError = (((intmax_t) ntohl(server->extend2.error_cnt2)) << 32) + \
|
||||
ntohl(server->base.error_cnt);
|
||||
@@ -862,22 +875,29 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
|
||||
* Sent by server to client
|
||||
* ------------------------------------------------------------------- */
|
||||
void write_UDP_AckFIN (struct TransferInfo *stats, int len) {
|
||||
+ int ackpacket_length;
|
||||
+ char *ackPacket;
|
||||
+ int success;
|
||||
+ int rc;
|
||||
+ struct timeval timeout;
|
||||
+ int readlen;
|
||||
+ fd_set readSet;
|
||||
+ int count;
|
||||
assert(stats!= NULL);
|
||||
- int ackpacket_length = (int) (sizeof(struct UDP_datagram) + sizeof(struct server_hdr));
|
||||
- char *ackPacket = (char *) calloc(1, len);
|
||||
- int success = 0;
|
||||
+ ackpacket_length = (int) (sizeof(struct UDP_datagram) + sizeof(struct server_hdr));
|
||||
+ ackPacket = (char *) calloc(1, len);
|
||||
+ success = 0;
|
||||
assert(ackPacket);
|
||||
- fd_set readSet;
|
||||
- int rc = 1;
|
||||
- struct timeval timeout;
|
||||
- int readlen = ((ackpacket_length * 2) > len * 2) ? (ackpacket_length * 2) : (len * 2);
|
||||
+ rc = 1;
|
||||
+ readlen = ((ackpacket_length * 2) > len * 2) ? (ackpacket_length * 2) : (len * 2);
|
||||
|
||||
if (ackPacket) {
|
||||
+ int flags;
|
||||
struct UDP_datagram *UDP_Hdr = (struct UDP_datagram *)ackPacket;
|
||||
struct server_hdr *hdr = (struct server_hdr *)(UDP_Hdr+1);
|
||||
|
||||
UDP_Hdr = (struct UDP_datagram*) ackPacket;
|
||||
- int flags = HEADER_VERSION1;
|
||||
+ flags = HEADER_VERSION1;
|
||||
if (isEnhanced(stats->common) || isTripTime(stats->common))
|
||||
flags |= SERVER_HEADER_EXTEND;
|
||||
#ifdef HAVE_INT64_T
|
||||
@@ -920,7 +940,7 @@ void write_UDP_AckFIN (struct TransferInfo *stats, int len) {
|
||||
hdr->extend.IPGsum = htonl(1);
|
||||
|
||||
#define TRYCOUNT 10
|
||||
- int count = TRYCOUNT;
|
||||
+ count = TRYCOUNT;
|
||||
while (--count) {
|
||||
// write data
|
||||
#if defined(HAVE_LINUX_FILTER_H) && defined(HAVE_AF_PACKET)
|
||||
diff --git a/src/Server.cpp b/src/Server.cpp
|
||||
index 53f6949..d1606c5 100644
|
||||
--- a/src/Server.cpp
|
||||
+++ b/src/Server.cpp
|
||||
@@ -449,7 +449,7 @@ bool Server::InitTrafficLoop (void) {
|
||||
ClientReverseFirstRead();
|
||||
}
|
||||
if (isTripTime(mSettings)) {
|
||||
- if ((abs(now.getSecs() - mSettings->sent_time.tv_sec)) > MAXDIFFTIMESTAMPSECS) {
|
||||
+ if ((labs(now.getSecs() - mSettings->sent_time.tv_sec)) > MAXDIFFTIMESTAMPSECS) {
|
||||
unsetTripTime(mSettings);
|
||||
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 3f45432..bf9b912 100644
|
||||
--- a/src/histogram.c
|
||||
+++ b/src/histogram.c
|
||||
@@ -173,15 +173,16 @@ void histogram_add(struct histogram *to, struct histogram *from) {
|
||||
}
|
||||
|
||||
void histogram_print(struct histogram *h, double start, double end) {
|
||||
+ int n = 0, ix, delta, lowerci, upperci, outliercnt, fence_lower, fence_upper, upper3stdev;
|
||||
+ int running=0;
|
||||
+ int intervalpopulation, oob_u, oob_l;
|
||||
+ int outside3fences = 0;
|
||||
if (h->final && h->prev) {
|
||||
histogram_clear(h->prev);
|
||||
}
|
||||
if (!h->prev) {
|
||||
h->prev = histogram_init(h->bincount, h->binwidth, h->offset, h->units, h->ci_lower, h->ci_upper, h->id, h->myname);
|
||||
}
|
||||
- int n = 0, ix, delta, lowerci, upperci, outliercnt, fence_lower, fence_upper, upper3stdev;
|
||||
- int running=0;
|
||||
- int intervalpopulation, oob_u, oob_l;
|
||||
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);
|
||||
@@ -192,7 +193,6 @@ void histogram_print(struct histogram *h, double start, double end) {
|
||||
outliercnt=0;
|
||||
fence_lower = 0;
|
||||
fence_upper = 0;
|
||||
- int outside3fences = 0;
|
||||
h->prev->populationcnt = h->populationcnt;
|
||||
oob_l = h->cntloweroutofbounds - h->prev->cntloweroutofbounds;
|
||||
h->prev->cntloweroutofbounds = h->cntloweroutofbounds;
|
||||
diff --git a/src/packet_ring.c b/src/packet_ring.c
|
||||
index 93e7578..f6114e2 100644
|
||||
--- a/src/packet_ring.c
|
||||
+++ b/src/packet_ring.c
|
||||
@@ -56,8 +56,8 @@ Mutex packetringdebug_mutex;
|
||||
#endif
|
||||
|
||||
struct PacketRing * packetring_init (int count, struct Condition *awake_consumer, struct Condition *awake_producer) {
|
||||
- assert(awake_consumer != NULL);
|
||||
struct PacketRing *pr = NULL;
|
||||
+ assert(awake_consumer != NULL);
|
||||
if ((pr = (struct PacketRing *) calloc(1, sizeof(struct PacketRing)))) {
|
||||
pr->bytes = sizeof(struct PacketRing);
|
||||
pr->data = (struct ReportStruct *) calloc(count, sizeof(struct ReportStruct));
|
||||
@@ -89,6 +89,7 @@ struct PacketRing * packetring_init (int count, struct Condition *awake_consumer
|
||||
}
|
||||
|
||||
inline void packetring_enqueue (struct PacketRing *pr, struct ReportStruct *metapacket) {
|
||||
+ int writeindex;
|
||||
while (((pr->producer == pr->maxcount) && (pr->consumer == 0)) || \
|
||||
((pr->producer + 1) == pr->consumer)) {
|
||||
// Signal the consumer thread to process a full queue
|
||||
@@ -114,7 +115,6 @@ inline void packetring_enqueue (struct PacketRing *pr, struct ReportStruct *meta
|
||||
Condition_Unlock((*(pr->awake_producer)));
|
||||
}
|
||||
}
|
||||
- int writeindex;
|
||||
if ((pr->producer + 1) == pr->maxcount)
|
||||
writeindex = 0;
|
||||
else
|
||||
@@ -126,11 +126,11 @@ inline void packetring_enqueue (struct PacketRing *pr, struct ReportStruct *meta
|
||||
}
|
||||
|
||||
inline struct ReportStruct *packetring_dequeue (struct PacketRing *pr) {
|
||||
+ int readindex;
|
||||
struct ReportStruct *packet = NULL;
|
||||
if (pr->producer == pr->consumer)
|
||||
return NULL;
|
||||
|
||||
- int readindex;
|
||||
if ((pr->consumer + 1) == pr->maxcount)
|
||||
readindex = 0;
|
||||
else
|
||||
diff --git a/src/sockets.c b/src/sockets.c
|
||||
index ea2190f..f43d8a3 100644
|
||||
--- a/src/sockets.c
|
||||
+++ b/src/sockets.c
|
||||
@@ -295,10 +295,12 @@ bool setsock_blocking (int fd, bool blocking) {
|
||||
unsigned long mode = blocking ? 0 : 1;
|
||||
return (ioctlsocket(fd, FIONBIO, &mode) == 0) ? TRUE : FALSE;
|
||||
#else
|
||||
+{
|
||||
int flags = fcntl(fd, F_GETFL, 0);
|
||||
if (flags < 0) return FALSE;
|
||||
flags = blocking ? (flags&~O_NONBLOCK) : (flags|O_NONBLOCK);
|
||||
return (fcntl(fd, F_SETFL, flags) == 0) ? TRUE : FALSE;
|
||||
+}
|
||||
#endif
|
||||
}
|
||||
|
||||
--
|
||||
2.30.2
|
||||
|
||||
Reference in New Issue
Block a user