mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-21 19:20:08 +02:00
645 lines
30 KiB
Plaintext
645 lines
30 KiB
Plaintext
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 e977433..29d3ad0 100644
|
|
--- a/src/ReportOutputs.c
|
|
+++ b/src/ReportOutputs.c
|
|
@@ -253,8 +253,8 @@ void tcp_output_read_enhanced (struct TransferInfo *stats) {
|
|
}
|
|
void tcp_output_read_triptime (struct TransferInfo *stats) {
|
|
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->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);
|
|
_print_stats_common(stats);
|
|
- 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);
|
|
@@ -436,9 +436,9 @@ void tcp_output_write (struct TransferInfo *stats) {
|
|
}
|
|
|
|
void tcp_output_write_bb (struct TransferInfo *stats) {
|
|
+ char rps_string[80];
|
|
HEADING_PRINT_COND(report_client_bb_bw);
|
|
_print_stats_common(stats);
|
|
- 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)
|
|
@@ -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;
|
|
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,
|
|
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;
|
|
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,
|
|
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) {
|
|
- assert(report->common);
|
|
- // copy the inet_ntop into temp buffers, to avoid overwriting
|
|
char local_addr[REPORT_ADDRLEN];
|
|
char remote_addr[REPORT_ADDRLEN];
|
|
- struct sockaddr *local = ((struct sockaddr*)&report->common->local);
|
|
- struct sockaddr *peer = ((struct sockaddr*)&report->common->peer);
|
|
+ struct sockaddr *local;
|
|
+ struct sockaddr *peer;
|
|
+ char *b;
|
|
+ assert(report->common);
|
|
+ // copy the inet_ntop into temp buffers, to avoid overwriting
|
|
+ local = ((struct sockaddr*)&report->common->local);
|
|
+ peer = ((struct sockaddr*)&report->common->peer);
|
|
outbuffer[0]='\0';
|
|
outbufferext[0]='\0';
|
|
- char *b = &outbuffer[0];
|
|
+ b = &outbuffer[0];
|
|
|
|
#if HAVE_DECL_TCP_WINDOW_CLAMP
|
|
if (!isUDP(report->common) && isRxClamp(report->common)) {
|
|
@@ -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 timeval now;
|
|
+ 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);
|
|
@@ -1931,7 +1943,6 @@ void reporter_print_connection_report (struct ConnectionInfo *report) {
|
|
#else
|
|
gettimeofday(&now, NULL);
|
|
#endif
|
|
- 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 bbd6fd5..eb2ab0f 100644
|
|
--- a/src/Reporter.c
|
|
+++ b/src/Reporter.c
|
|
@@ -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) {
|
|
+ bool rc = false;
|
|
assert(data != NULL);
|
|
|
|
- bool rc = false;
|
|
#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);
|
|
@@ -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) {
|
|
+ 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;
|
|
|
|
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
|
|
@@ -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) {
|
|
+ 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
|
|
@@ -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
|
|
- 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
|
|
@@ -615,8 +622,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);
|
|
@@ -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);
|
|
+ double deltaTransit;
|
|
if (stats->latency_histogram) {
|
|
histogram_insert(stats->latency_histogram, transit, NULL);
|
|
}
|
|
- double deltaTransit;
|
|
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)) {
|
|
stats->total.Bytes.current += packet->packetLen;
|
|
- double bbrtt = TimeDifference(packet->packetTime, packet->sentTime);
|
|
- double bbowdto = TimeDifference(packet->sentTimeRX, packet->sentTime);
|
|
- double bbowdfro = TimeDifference(packet->packetTime, packet->sentTimeTX);
|
|
- double asym = bbowdfro - bbowdto;
|
|
+ bbrtt = TimeDifference(packet->packetTime, packet->sentTime);
|
|
+ bbowdto = TimeDifference(packet->sentTimeRX, packet->sentTime);
|
|
+ bbowdfro = TimeDifference(packet->packetTime, packet->sentTimeTX);
|
|
+ asym = bbowdfro - bbowdto;
|
|
stats->ts.prevpacketTime = packet->packetTime;
|
|
#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, INTERVAL);
|
|
struct TransferInfo emptystats;
|
|
+ reporter_set_timestamps_time(stats, INTERVAL);
|
|
memset(&emptystats, 0, sizeof(struct TransferInfo));
|
|
emptystats.ts.iStart = stats->ts.iStart;
|
|
emptystats.ts.iEnd = stats->ts.iEnd;
|
|
@@ -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;
|
|
stats->cntBytes = stats->total.Bytes.current - stats->total.Bytes.prev;
|
|
- int ix;
|
|
if (stats->framelatency_histogram) {
|
|
stats->framelatency_histogram->final = 0;
|
|
}
|
|
- 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) {
|
|
+ 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.
|
|
@@ -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;
|
|
- 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);
|
|
diff --git a/src/Reports.c b/src/Reports.c
|
|
index 008f7f4..06e32de 100644
|
|
--- a/src/Reports.c
|
|
+++ b/src/Reports.c
|
|
@@ -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) {
|
|
+ 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')) {
|
|
@@ -386,9 +387,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);
|
|
}
|
|
@@ -522,6 +524,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);
|
|
@@ -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);
|
|
- int refcnt = --sumreport->reference.count;
|
|
+ refcnt = --sumreport->reference.count;
|
|
Mutex_Unlock(&sumreport->reference.lock);
|
|
// thread_debug("unlock hdr=%p", (void *)sumreport);
|
|
return refcnt;
|
|
@@ -545,8 +548,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);
|
|
}
|
|
@@ -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) {
|
|
ireport->GroupSumReport = inSettings->mSumReport;
|
|
}
|
|
@@ -796,8 +801,10 @@ struct ReportHeader* InitIndividualReport (struct thread_Settings *inSettings) {
|
|
* and to extend.
|
|
*/
|
|
struct ReportHeader* InitConnectionReport (struct thread_Settings *inSettings) {
|
|
+ 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);
|
|
}
|
|
@@ -808,7 +815,7 @@ struct ReportHeader* InitConnectionReport (struct thread_Settings *inSettings) {
|
|
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);
|
|
tcpstats_copy(&creport->tcpinitstats, &inSettings->tcpinitstats);
|
|
// Fill out known fields for the connection report
|
|
@@ -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) {
|
|
+ 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);
|
|
}
|
|
@@ -866,7 +875,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;
|
|
@@ -902,6 +911,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);
|
|
@@ -915,9 +927,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);
|
|
@@ -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;
|
|
- 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);
|
|
@@ -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) {
|
|
+ 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));
|
|
- int readlen = ((ackpacket_length * 2) > len * 2) ? (ackpacket_length * 2) : (len * 2);
|
|
- char *ackPacket = (char *) calloc(1, readlen);
|
|
- int success = 0;
|
|
+ ackpacket_length = (int) (sizeof(struct UDP_datagram) + sizeof(struct server_hdr));
|
|
+ readlen = ((ackpacket_length * 2) > len * 2) ? (ackpacket_length * 2) : (len * 2);
|
|
+ ackPacket = (char *) calloc(1, readlen);
|
|
+ success = 0;
|
|
assert(ackPacket);
|
|
- fd_set readSet;
|
|
- int rc = 1;
|
|
- struct timeval timeout;
|
|
+ rc = 1;
|
|
|
|
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
|
|
@@ -1043,7 +1062,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 c271cd7..cea672a 100644
|
|
--- a/src/Server.cpp
|
|
+++ b/src/Server.cpp
|
|
@@ -610,7 +610,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 3a9b82c..53d01a6 100644
|
|
--- a/src/histogram.c
|
|
+++ b/src/histogram.c
|
|
@@ -192,15 +192,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);
|
|
@@ -211,7 +212,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/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(×tamp.tv_sec) : *localtime(×tamp.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
|
|
+++ 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
|
|
--
|
|
2.37.3
|
|
|