some cleanup for FreeBSD, and further work on TCP_INFO (not finished)
Этот коммит содержится в:
родитель
d842bb6c9c
Коммит
c0c797b0eb
@ -1,5 +1,5 @@
|
|||||||
CFLAGS=-g -Wall
|
CFLAGS=-g -Wall
|
||||||
OBJS=iperf_api.o timer.o net.o tcp_window_size.o units.o uuid.o
|
OBJS=iperf_api.o timer.o net.o tcp_window_size.o units.o uuid.o tcp_info.o locale.o
|
||||||
LDFLAGS=
|
LDFLAGS=
|
||||||
|
|
||||||
UNAME=$(shell uname)
|
UNAME=$(shell uname)
|
||||||
|
@ -46,6 +46,8 @@
|
|||||||
#include "uuid.h"
|
#include "uuid.h"
|
||||||
#include "locale.h"
|
#include "locale.h"
|
||||||
|
|
||||||
|
jmp_buf env; /* to handle longjmp on signal */
|
||||||
|
|
||||||
/*************************************************************/
|
/*************************************************************/
|
||||||
int
|
int
|
||||||
all_data_sent(struct iperf_test * test)
|
all_data_sent(struct iperf_test * test)
|
||||||
@ -201,8 +203,11 @@ add_interval_list(struct iperf_stream_result * rp, struct iperf_interval_results
|
|||||||
ip->next = NULL;
|
ip->next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*************************************************************/
|
||||||
|
|
||||||
|
/* for debugging only */
|
||||||
void
|
void
|
||||||
display_interval_list(struct iperf_stream_result * rp)
|
display_interval_list(struct iperf_stream_result * rp, int tflag)
|
||||||
{
|
{
|
||||||
struct iperf_interval_results *n;
|
struct iperf_interval_results *n;
|
||||||
|
|
||||||
@ -211,19 +216,8 @@ display_interval_list(struct iperf_stream_result * rp)
|
|||||||
while (n)
|
while (n)
|
||||||
{
|
{
|
||||||
printf("Interval = %f\tBytes transferred = %llu\n", n->interval_duration, n->bytes_transferred);
|
printf("Interval = %f\tBytes transferred = %llu\n", n->interval_duration, n->bytes_transferred);
|
||||||
#if defined(linux)
|
if (tflag)
|
||||||
/*
|
print_tcpinfo(n);
|
||||||
* TODO: figure out a way to check command line flag for -T option
|
|
||||||
* here
|
|
||||||
*/
|
|
||||||
printf(report_tcpInfo, n->tcpInfo.tcpi_snd_cwnd, n->tcpInfo.tcpi_snd_ssthresh,
|
|
||||||
n->tcpInfo.tcpi_rcv_ssthresh, n->tcpInfo.tcpi_unacked, n->tcpInfo.tcpi_sacked,
|
|
||||||
n->tcpInfo.tcpi_lost, n->tcpInfo.tcpi_retrans, n->tcpInfo.tcpi_fackets);
|
|
||||||
#endif
|
|
||||||
#if defined(__FreeBSD__)
|
|
||||||
printf(report_tcpInfo, n->tcpInfo.tcpi_snd_cwnd,
|
|
||||||
n->tcpInfo.tcpi_snd_ssthresh, n->tcpInfo.tcpi_rcv_space);
|
|
||||||
#endif
|
|
||||||
n = n->next;
|
n = n->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -886,15 +880,11 @@ iperf_stats_callback(struct iperf_test * test)
|
|||||||
iperf_size_t cumulative_bytes = 0;
|
iperf_size_t cumulative_bytes = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
#if defined(linux) || defined(__FreeBSD__)
|
|
||||||
socklen_t tcp_info_length;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
struct iperf_stream *sp = test->streams;
|
struct iperf_stream *sp = test->streams;
|
||||||
struct iperf_stream_result *rp = test->streams->result;
|
struct iperf_stream_result *rp = test->streams->result;
|
||||||
struct iperf_interval_results *ip, temp;
|
struct iperf_interval_results *ip, temp;
|
||||||
|
|
||||||
//printf("in stats_callback: num_streams = %d \n", test->num_streams);
|
printf("in stats_callback: num_streams = %d \n", test->num_streams);
|
||||||
for (i = 0; i < test->num_streams; i++)
|
for (i = 0; i < test->num_streams; i++)
|
||||||
{
|
{
|
||||||
rp = sp->result;
|
rp = sp->result;
|
||||||
@ -910,16 +900,8 @@ iperf_stats_callback(struct iperf_test * test)
|
|||||||
|
|
||||||
temp.interval_duration = timeval_diff(&sp->result->start_time, &temp.interval_time);
|
temp.interval_duration = timeval_diff(&sp->result->start_time, &temp.interval_time);
|
||||||
|
|
||||||
#if defined(linux) || defined(__FreeBSD__)
|
|
||||||
if (test->tcp_info)
|
if (test->tcp_info)
|
||||||
{
|
get_tcpinfo(test);
|
||||||
tcp_info_length = sizeof(temp.tcpInfo);
|
|
||||||
if (getsockopt(sp->socket, IPPROTO_TCP, TCP_INFO, (void *) &temp.tcpInfo, &tcp_info_length) == 0)
|
|
||||||
{
|
|
||||||
perror("getsockopt");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gettimeofday(&sp->result->end_time, NULL);
|
gettimeofday(&sp->result->end_time, NULL);
|
||||||
add_interval_list(rp, temp);
|
add_interval_list(rp, temp);
|
||||||
@ -942,12 +924,15 @@ iperf_stats_callback(struct iperf_test * test)
|
|||||||
|
|
||||||
gettimeofday(&temp.interval_time, NULL);
|
gettimeofday(&temp.interval_time, NULL);
|
||||||
temp.interval_duration = timeval_diff(&sp->result->start_time, &temp.interval_time);
|
temp.interval_duration = timeval_diff(&sp->result->start_time, &temp.interval_time);
|
||||||
|
if (test->tcp_info)
|
||||||
|
get_tcpinfo(test);
|
||||||
|
|
||||||
gettimeofday(&sp->result->end_time, NULL);
|
gettimeofday(&sp->result->end_time, NULL);
|
||||||
add_interval_list(rp, temp);
|
add_interval_list(rp, temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* display_interval_list(rp); */
|
/* for debugging */
|
||||||
|
/* display_interval_list(rp, test->tcp_info); */
|
||||||
cumulative_bytes = 0;
|
cumulative_bytes = 0;
|
||||||
sp = sp->next;
|
sp = sp->next;
|
||||||
}
|
}
|
||||||
@ -1013,7 +998,7 @@ iperf_reporter_callback(struct iperf_test * test)
|
|||||||
#endif
|
#endif
|
||||||
#if defined(__FreeBSD__)
|
#if defined(__FreeBSD__)
|
||||||
sprintf(message, report_tcpInfo, ip->tcpInfo.tcpi_snd_cwnd,
|
sprintf(message, report_tcpInfo, ip->tcpInfo.tcpi_snd_cwnd,
|
||||||
ip->tcpInfo.tcpi_snd_ssthresh, ip->tcpInfo.tcpi_rcv_space);
|
ip->tcpInfo.tcpi_snd_ssthresh, ip->tcpInfo.tcpi_rcv_space, ip->tcpInfo.__tcpi_retrans);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -1176,6 +1161,7 @@ iperf_free_stream(struct iperf_test * test, struct iperf_stream * sp)
|
|||||||
struct iperf_stream *
|
struct iperf_stream *
|
||||||
iperf_new_stream(struct iperf_test * testp)
|
iperf_new_stream(struct iperf_test * testp)
|
||||||
{
|
{
|
||||||
|
int i=0;
|
||||||
struct iperf_stream *sp;
|
struct iperf_stream *sp;
|
||||||
|
|
||||||
sp = (struct iperf_stream *) malloc(sizeof(struct iperf_stream));
|
sp = (struct iperf_stream *) malloc(sizeof(struct iperf_stream));
|
||||||
@ -1193,8 +1179,8 @@ iperf_new_stream(struct iperf_test * testp)
|
|||||||
|
|
||||||
/* fill in buffer with random stuff */
|
/* fill in buffer with random stuff */
|
||||||
/* XXX: probably better to use truely random stuff here */
|
/* XXX: probably better to use truely random stuff here */
|
||||||
memset_pattern16( sp->buffer, "abcdefghijklmnop", (size_t) testp->default_settings->blksize);
|
for(i=0; i < testp->default_settings->blksize; i++)
|
||||||
|
sp->buffer[i] = i%255;
|
||||||
|
|
||||||
sp->socket = -1;
|
sp->socket = -1;
|
||||||
|
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
approvals from the U.S. Dept. of Energy). All rights reserved.
|
approvals from the U.S. Dept. of Energy). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef IPERF_API_H
|
||||||
|
#define IPERF_API_H
|
||||||
|
|
||||||
typedef uint64_t iperf_size_t;
|
typedef uint64_t iperf_size_t;
|
||||||
|
|
||||||
struct iperf_interval_results
|
struct iperf_interval_results
|
||||||
@ -168,7 +171,6 @@ enum
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define SEC_TO_NS 1000000000 /* too big for enum on some platforms */
|
#define SEC_TO_NS 1000000000 /* too big for enum on some platforms */
|
||||||
jmp_buf env;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* exchange_parameters - handles the param_Exchange part for client
|
* exchange_parameters - handles the param_Exchange part for client
|
||||||
@ -195,7 +197,7 @@ void add_interval_list(struct iperf_stream_result * rp, struct iperf_interv
|
|||||||
* Mainly for DEBUG purpose
|
* Mainly for DEBUG purpose
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void display_interval_list(struct iperf_stream_result * rp);
|
void display_interval_list(struct iperf_stream_result * rp, int tflag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* send_result_to_client - sends result to client via
|
* send_result_to_client - sends result to client via
|
||||||
@ -389,3 +391,9 @@ void iperf_init_stream(struct iperf_stream * sp, struct iperf_test * testp)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void iperf_free_stream(struct iperf_test * test, struct iperf_stream * sp);
|
void iperf_free_stream(struct iperf_test * test, struct iperf_stream * sp);
|
||||||
|
|
||||||
|
void get_tcpinfo(struct iperf_test *test);
|
||||||
|
void print_tcpinfo(struct iperf_interval_results *);
|
||||||
|
|
||||||
|
#endif /* IPERF_API_H */
|
||||||
|
|
||||||
|
333
src/locale.c
Исполняемый файл
333
src/locale.c
Исполняемый файл
@ -0,0 +1,333 @@
|
|||||||
|
|
||||||
|
/*---------------------------------------------------------------
|
||||||
|
* Copyright (c) 1999,2000,2001,2002,2003
|
||||||
|
* The Board of Trustees of the University of Illinois
|
||||||
|
* All Rights Reserved.
|
||||||
|
*---------------------------------------------------------------
|
||||||
|
* Permission is hereby granted, free of charge, to any person
|
||||||
|
* obtaining a copy of this software (Iperf) and associated
|
||||||
|
* documentation files (the "Software"), to deal in the Software
|
||||||
|
* without restriction, including without limitation the
|
||||||
|
* rights to use, copy, modify, merge, publish, distribute,
|
||||||
|
* sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
* persons to whom the Software is furnished to do
|
||||||
|
* so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Redistributions of source code must retain the above
|
||||||
|
* copyright notice, this list of conditions and
|
||||||
|
* the following disclaimers.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
* copyright notice, this list of conditions and the following
|
||||||
|
* disclaimers in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Neither the names of the University of Illinois, NCSA,
|
||||||
|
* nor the names of its contributors may be used to endorse
|
||||||
|
* or promote products derived from this Software without
|
||||||
|
* specific prior written permission.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE CONTIBUTORS OR COPYRIGHT
|
||||||
|
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
* ________________________________________________________________
|
||||||
|
* National Laboratory for Applied Network Research
|
||||||
|
* National Center for Supercomputing Applications
|
||||||
|
* University of Illinois at Urbana-Champaign
|
||||||
|
* http://www.ncsa.uiuc.edu
|
||||||
|
* ________________________________________________________________
|
||||||
|
*
|
||||||
|
* Locale.c
|
||||||
|
* by Ajay Tirumala <tirumala@ncsa.uiuc.edu>
|
||||||
|
* & Mark Gates <mgates@nlanr.net>
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* Strings and other stuff that is locale specific.
|
||||||
|
* ------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifndef IPERF_LOCALE_H
|
||||||
|
#define IPERF_LOCALE_H
|
||||||
|
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------
|
||||||
|
* usage
|
||||||
|
* ------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
const char usage_short[] = "\
|
||||||
|
Usage: %s [-s|-c host] [options]\n\
|
||||||
|
Try `%s --help' for more information.\n";
|
||||||
|
|
||||||
|
const char usage_long1[] = "\
|
||||||
|
Usage: iperf [-s|-c host] [options]\n\
|
||||||
|
iperf [-h|--help] [-v|--version]\n\
|
||||||
|
\n\
|
||||||
|
Client/Server:\n\
|
||||||
|
-f, --format [kmKM] format to report: Kbits, Mbits, KBytes, MBytes\n\
|
||||||
|
-i, --interval # seconds between periodic bandwidth reports\n\
|
||||||
|
-l, --len #[KM] length of buffer to read or write (default 8 KB)\n\
|
||||||
|
-m, --print_mss print TCP maximum segment size (MTU - TCP/IP header)\n\
|
||||||
|
-p, --port # server port to listen on/connect to\n\
|
||||||
|
-u, --udp use UDP rather than TCP\n\
|
||||||
|
-w, --window #[KM] TCP window size (socket buffer size)\n\
|
||||||
|
-M, --mss # set TCP maximum segment size (MTU - 40 bytes)\n\
|
||||||
|
-N, --nodelay set TCP no delay, disabling Nagle's Algorithm\n\
|
||||||
|
-T, --tcpinfo Output detailed TCP info\n\
|
||||||
|
Server specific:\n\
|
||||||
|
-s, --server run in server mode\n\
|
||||||
|
-U, --single_udp run in single threaded UDP mode\n\
|
||||||
|
-D, --daemon run the server as a daemon\n"
|
||||||
|
#ifdef WIN32
|
||||||
|
" -R, --remove remove service in win32\n"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
#ifdef OBSOLETE /* from old iperf: no longer supported. Add someday?? */
|
||||||
|
-o, --output <filename> output the report or error message to this specified file\n\
|
||||||
|
-B, --bind <host> bind to <host>, an interface or multicast address\n\
|
||||||
|
-V, --IPv6Version Set the domain to IPv6\n\
|
||||||
|
-C, --compatibility for use with older versions does not sent extra msgs
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const char usage_long2[] = "\
|
||||||
|
\n\
|
||||||
|
Client specific:\n\
|
||||||
|
-b, --bandwidth #[KM] for UDP, bandwidth to send at in bits/sec\n\
|
||||||
|
(default 1 Mbit/sec, implies -u)\n\
|
||||||
|
-c, --client <host> run in client mode, connecting to <host>\n\
|
||||||
|
-n, --num #[KM] number of bytes to transmit (instead of -t)\n\
|
||||||
|
-t, --time # time in seconds to transmit for (default 10 secs)\n\
|
||||||
|
-P, --parallel # number of parallel client threads to run\n\
|
||||||
|
-T, --tcpinfo Output detailed TCP info (Linux and FreeBSD only)\n\
|
||||||
|
\n\
|
||||||
|
Miscellaneous:\n\
|
||||||
|
-h, --help print this message and quit\n\
|
||||||
|
\n\
|
||||||
|
[KM] Indicates options that support a K or M suffix for kilo- or mega-\n\
|
||||||
|
\n\
|
||||||
|
Report bugs to <iperf-users@lists.sourceforge.net>\n";
|
||||||
|
|
||||||
|
#ifdef OBSOLETE /* from old iperf: no longer supported. Add some of these back someday */
|
||||||
|
-v, --version print version information and quit\n\
|
||||||
|
-Z, --linux-congestion <algo> set TCP congestion control algorithm (Linux only)\n\
|
||||||
|
-d, --dualtest Do a bidirectional test simultaneously\n\
|
||||||
|
-L, --listenport # port to recieve bidirectional tests back on\n\
|
||||||
|
-I, --stdin input the data to be transmitted from stdin\n\
|
||||||
|
-F, --fileinput <name> input the data to be transmitted from a file\n\
|
||||||
|
-r, --tradeoff Do a bidirectional test individually\n\
|
||||||
|
-T, --ttl # time-to-live, for multicast (default 1)\n\
|
||||||
|
-x, --reportexclude [CDMSV] exclude C(connection) D(data) M(multicast) S(settings) V(server) reports\n\
|
||||||
|
-y, --reportstyle C report as a Comma-Separated Values
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//const char version[] = "iperf version " IPERF_VERSION " (" IPERF_VERSION_DATE ") " IPERF_THREADS "\n";
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------
|
||||||
|
* settings
|
||||||
|
* ------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
const char seperator_line[] =
|
||||||
|
"------------------------------------------------------------\n";
|
||||||
|
|
||||||
|
const char server_port[] =
|
||||||
|
"Server listening on %s port %d\n";
|
||||||
|
|
||||||
|
const char client_port[] =
|
||||||
|
"Client connecting to %s, %s port %d\n";
|
||||||
|
|
||||||
|
const char bind_address[] =
|
||||||
|
"Binding to local address %s\n";
|
||||||
|
|
||||||
|
const char multicast_ttl[] =
|
||||||
|
"Setting multicast TTL to %d\n";
|
||||||
|
|
||||||
|
const char join_multicast[] =
|
||||||
|
"Joining multicast group %s\n";
|
||||||
|
|
||||||
|
const char client_datagram_size[] =
|
||||||
|
"Sending %d byte datagrams\n";
|
||||||
|
|
||||||
|
const char server_datagram_size[] =
|
||||||
|
"Receiving %d byte datagrams\n";
|
||||||
|
|
||||||
|
const char tcp_window_size[] =
|
||||||
|
"TCP window size";
|
||||||
|
|
||||||
|
const char udp_buffer_size[] =
|
||||||
|
"UDP buffer size";
|
||||||
|
|
||||||
|
const char window_default[] =
|
||||||
|
"(default)";
|
||||||
|
|
||||||
|
const char wait_server_threads[] =
|
||||||
|
"Waiting for server threads to complete. Interrupt again to force quit.\n";
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------
|
||||||
|
* reports
|
||||||
|
* ------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
const char report_read_lengths[] =
|
||||||
|
"[%3d] Read lengths occurring in more than 5%% of reads:\n";
|
||||||
|
|
||||||
|
const char report_read_length_times[] =
|
||||||
|
"[%3d] %5d bytes read %5d times (%.3g%%)\n";
|
||||||
|
|
||||||
|
const char report_bw_header[] =
|
||||||
|
"[ ID] Interval Transfer Bandwidth\n";
|
||||||
|
|
||||||
|
const char report_bw_format[] =
|
||||||
|
"[%3d] %4.1f-%4.1f sec %ss %ss/sec\n";
|
||||||
|
|
||||||
|
const char report_sum_bw_format[] =
|
||||||
|
"[SUM] %4.1f-%4.1f sec %ss %ss/sec\n";
|
||||||
|
|
||||||
|
const char report_bw_jitter_loss_header[] =
|
||||||
|
"[ ID] Interval Transfer Bandwidth Jitter Lost/Total \
|
||||||
|
Datagrams\n";
|
||||||
|
|
||||||
|
const char report_bw_jitter_loss_format[] =
|
||||||
|
"[%3d] %4.1f-%4.1f sec %ss %ss/sec %5.3f ms %4d/%5d (%.2g%%)\n";
|
||||||
|
|
||||||
|
const char report_sum_bw_jitter_loss_format[] =
|
||||||
|
"[SUM] %4.1f-%4.1f sec %ss %ss/sec %5.3f ms %4d/%5d (%.2g%%)\n";
|
||||||
|
|
||||||
|
const char report_outoforder[] =
|
||||||
|
"[%3d] %4.1f-%4.1f sec %d datagrams received out-of-order\n";
|
||||||
|
|
||||||
|
const char report_sum_outoforder[] =
|
||||||
|
"[SUM] %4.1f-%4.1f sec %d datagrams received out-of-order\n";
|
||||||
|
|
||||||
|
const char report_peer[] =
|
||||||
|
"[%3d] local %s port %u connected with %s port %u\n";
|
||||||
|
|
||||||
|
const char report_mss_unsupported[] =
|
||||||
|
"[%3d] MSS and MTU size unknown (TCP_MAXSEG not supported by OS?)\n";
|
||||||
|
|
||||||
|
const char report_mss[] =
|
||||||
|
"[%3d] MSS size %d bytes (MTU %d bytes, %s)\n";
|
||||||
|
|
||||||
|
const char report_datagrams[] =
|
||||||
|
"[%3d] Sent %d datagrams\n";
|
||||||
|
|
||||||
|
const char report_sum_datagrams[] =
|
||||||
|
"[SUM] Sent %d datagrams\n";
|
||||||
|
|
||||||
|
const char server_reporting[] =
|
||||||
|
"[%3d] Server Report:\n";
|
||||||
|
|
||||||
|
const char reportCSV_peer[] =
|
||||||
|
"%s,%u,%s,%u";
|
||||||
|
|
||||||
|
#if defined(linux)
|
||||||
|
const char report_tcpInfo[] =
|
||||||
|
" event=TCP_Info CWND=%u RCV_WIND=%u SND_SSTHRESH=%u UNACKED=%u SACK=%u LOST=%u RETRANS=%u FACK=%u RTT=%u";
|
||||||
|
#endif
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
const char report_tcpInfo[] =
|
||||||
|
" event=TCP_Info CWND=%u RCV_WIND=%u SND_SSTHRESH=%u RTT=%u";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_QUAD_SUPPORT
|
||||||
|
#ifdef HAVE_PRINTF_QD
|
||||||
|
const char reportCSV_bw_format[] =
|
||||||
|
"%s,%s,%d,%.1f-%.1f,%qd,%qd\n";
|
||||||
|
|
||||||
|
const char reportCSV_bw_jitter_loss_format[] =
|
||||||
|
"%s,%s,%d,%.1f-%.1f,%qd,%qd,%.3f,%d,%d,%.3f,%d\n";
|
||||||
|
#else // HAVE_PRINTF_QD
|
||||||
|
const char reportCSV_bw_format[] =
|
||||||
|
"%s,%s,%d,%.1f-%.1f,%lld,%lld\n";
|
||||||
|
|
||||||
|
const char reportCSV_bw_jitter_loss_format[] =
|
||||||
|
"%s,%s,%d,%.1f-%.1f,%lld,%lld,%.3f,%d,%d,%.3f,%d\n";
|
||||||
|
#endif // HAVE_PRINTF_QD
|
||||||
|
#else // HAVE_QUAD_SUPPORT
|
||||||
|
#ifdef WIN32
|
||||||
|
const char reportCSV_bw_format[] =
|
||||||
|
"%s,%s,%d,%.1f-%.1f,%I64d,%I64d\n";
|
||||||
|
|
||||||
|
const char reportCSV_bw_jitter_loss_format[] =
|
||||||
|
"%s,%s,%d,%.1f-%.1f,%I64d,%I64d,%.3f,%d,%d,%.3f,%d\n";
|
||||||
|
#else
|
||||||
|
const char reportCSV_bw_format[] =
|
||||||
|
"%s,%s,%d,%.1f-%.1f,%d,%d\n";
|
||||||
|
|
||||||
|
const char reportCSV_bw_jitter_loss_format[] =
|
||||||
|
"%s,%s,%d,%.1f-%.1f,%d,%d,%.3f,%d,%d,%.3f,%d\n";
|
||||||
|
#endif //WIN32
|
||||||
|
#endif //HAVE_QUAD_SUPPORT
|
||||||
|
/* -------------------------------------------------------------------
|
||||||
|
* warnings
|
||||||
|
* ------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
const char warn_window_requested[] =
|
||||||
|
" (WARNING: requested %s)";
|
||||||
|
|
||||||
|
const char warn_window_small[] = "\
|
||||||
|
WARNING: TCP window size set to %d bytes. A small window size\n\
|
||||||
|
will give poor performance. See the Iperf documentation.\n";
|
||||||
|
|
||||||
|
const char warn_delay_large[] =
|
||||||
|
"WARNING: delay too large, reducing from %.1f to 1.0 seconds.\n";
|
||||||
|
|
||||||
|
const char warn_no_pathmtu[] =
|
||||||
|
"WARNING: Path MTU Discovery may not be enabled.\n";
|
||||||
|
|
||||||
|
const char warn_no_ack[]=
|
||||||
|
"[%3d] WARNING: did not receive ack of last datagram after %d tries.\n";
|
||||||
|
|
||||||
|
const char warn_ack_failed[]=
|
||||||
|
"[%3d] WARNING: ack of last datagram failed after %d tries.\n";
|
||||||
|
|
||||||
|
const char warn_fileopen_failed[]=
|
||||||
|
"WARNING: Unable to open file stream for transfer\n\
|
||||||
|
Using default data stream. \n";
|
||||||
|
|
||||||
|
const char unable_to_change_win[]=
|
||||||
|
"WARNING: Unable to change the window size\n";
|
||||||
|
|
||||||
|
const char opt_estimate[]=
|
||||||
|
"Optimal Estimate\n";
|
||||||
|
|
||||||
|
const char report_interval_small[] =
|
||||||
|
"WARNING: interval too small, increasing from %3.2f to 0.5 seconds.\n";
|
||||||
|
|
||||||
|
const char warn_invalid_server_option[] =
|
||||||
|
"WARNING: option -%c is not valid for server mode\n";
|
||||||
|
|
||||||
|
const char warn_invalid_client_option[] =
|
||||||
|
"WARNING: option -%c is not valid for client mode\n";
|
||||||
|
|
||||||
|
const char warn_invalid_compatibility_option[] =
|
||||||
|
"WARNING: option -%c is not valid in compatibility mode\n";
|
||||||
|
|
||||||
|
const char warn_implied_udp[] =
|
||||||
|
"WARNING: option -%c implies udp testing\n";
|
||||||
|
|
||||||
|
const char warn_implied_compatibility[] =
|
||||||
|
"WARNING: option -%c has implied compatibility mode\n";
|
||||||
|
|
||||||
|
const char warn_buffer_too_small[] =
|
||||||
|
"WARNING: the UDP buffer was increased to %d for proper operation\n";
|
||||||
|
|
||||||
|
const char warn_invalid_single_threaded[] =
|
||||||
|
"WARNING: option -%c is not valid in single threaded versions\n";
|
||||||
|
|
||||||
|
const char warn_invalid_report_style[] =
|
||||||
|
"WARNING: unknown reporting style \"%s\", switching to default\n";
|
||||||
|
|
||||||
|
const char warn_invalid_report[] =
|
||||||
|
"WARNING: unknown reporting type \"%c\", ignored\n valid options are:\n\t exclude: C(connection) D(data) M(multicast) S(settings) V(server) report\n\n";
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* end extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* IPERF_LOCALE_H */
|
392
src/locale.h
392
src/locale.h
@ -1,329 +1,65 @@
|
|||||||
|
|
||||||
/*---------------------------------------------------------------
|
#ifndef IPERF_LOCALE_H
|
||||||
* Copyright (c) 1999,2000,2001,2002,2003
|
#define IPERF_LOCALE_H
|
||||||
* The Board of Trustees of the University of Illinois
|
|
||||||
* All Rights Reserved.
|
extern char usage_short[];
|
||||||
*---------------------------------------------------------------
|
extern char usage_long1[];
|
||||||
* Permission is hereby granted, free of charge, to any person
|
extern char usage_long2[];
|
||||||
* obtaining a copy of this software (Iperf) and associated
|
|
||||||
* documentation files (the "Software"), to deal in the Software
|
extern char seperator_line[];
|
||||||
* without restriction, including without limitation the
|
|
||||||
* rights to use, copy, modify, merge, publish, distribute,
|
extern char server_port[] ;
|
||||||
* sublicense, and/or sell copies of the Software, and to permit
|
extern char client_port[] ;
|
||||||
* persons to whom the Software is furnished to do
|
extern char bind_address[] ;
|
||||||
* so, subject to the following conditions:
|
extern char multicast_ttl[] ;
|
||||||
*
|
extern char join_multicast[] ;
|
||||||
*
|
extern char client_datagram_size[] ;
|
||||||
* Redistributions of source code must retain the above
|
extern char server_datagram_size[] ;
|
||||||
* copyright notice, this list of conditions and
|
extern char tcp_window_size[] ;
|
||||||
* the following disclaimers.
|
extern char udp_buffer_size[] ;
|
||||||
*
|
extern char window_default[] ;
|
||||||
*
|
extern char wait_server_threads[] ;
|
||||||
* Redistributions in binary form must reproduce the above
|
|
||||||
* copyright notice, this list of conditions and the following
|
extern char report_read_lengths[] ;
|
||||||
* disclaimers in the documentation and/or other materials
|
extern char report_read_length_times[] ;
|
||||||
* provided with the distribution.
|
extern char report_bw_header[] ;
|
||||||
*
|
extern char report_bw_format[] ;
|
||||||
*
|
extern char report_sum_bw_format[] ;
|
||||||
* Neither the names of the University of Illinois, NCSA,
|
extern char report_bw_jitter_loss_header[] ;
|
||||||
* nor the names of its contributors may be used to endorse
|
extern char report_bw_jitter_loss_format[] ;
|
||||||
* or promote products derived from this Software without
|
extern char report_sum_bw_jitter_loss_format[] ;
|
||||||
* specific prior written permission.
|
extern char report_outoforder[] ;
|
||||||
*
|
extern char report_sum_outoforder[] ;
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
extern char report_peer[] ;
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
extern char report_mss_unsupported[] ;
|
||||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
extern char report_mss[] ;
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE CONTIBUTORS OR COPYRIGHT
|
extern char report_datagrams[] ;
|
||||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
extern char report_sum_datagrams[] ;
|
||||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
extern char server_reporting[] ;
|
||||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
extern char reportCSV_peer[] ;
|
||||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
* ________________________________________________________________
|
extern char report_tcpInfo[] ;
|
||||||
* National Laboratory for Applied Network Research
|
extern char report_tcpInfo[] ;
|
||||||
* National Center for Supercomputing Applications
|
|
||||||
* University of Illinois at Urbana-Champaign
|
|
||||||
* http://www.ncsa.uiuc.edu
|
extern char warn_window_requested[] ;
|
||||||
* ________________________________________________________________
|
extern char warn_window_small[] ;
|
||||||
*
|
extern char warn_delay_large[] ;
|
||||||
* Locale.c
|
extern char warn_no_pathmtu[] ;
|
||||||
* by Ajay Tirumala <tirumala@ncsa.uiuc.edu>
|
extern char warn_no_ack[];
|
||||||
* & Mark Gates <mgates@nlanr.net>
|
extern char warn_ack_failed[];
|
||||||
* -------------------------------------------------------------------
|
extern char warn_fileopen_failed[];
|
||||||
* Strings and other stuff that is locale specific.
|
extern char unable_to_change_win[];
|
||||||
* ------------------------------------------------------------------- */
|
extern char opt_estimate[];
|
||||||
|
extern char report_interval_small[] ;
|
||||||
|
extern char warn_invalid_server_option[] ;
|
||||||
|
extern char warn_invalid_client_option[] ;
|
||||||
/* -------------------------------------------------------------------
|
extern char warn_invalid_compatibility_option[] ;
|
||||||
* usage
|
extern char warn_implied_udp[] ;
|
||||||
* ------------------------------------------------------------------- */
|
extern char warn_implied_compatibility[] ;
|
||||||
|
extern char warn_buffer_too_small[] ;
|
||||||
const char usage_short[] = "\
|
extern char warn_invalid_single_threaded[] ;
|
||||||
Usage: %s [-s|-c host] [options]\n\
|
extern char warn_invalid_report_style[] ;
|
||||||
Try `%s --help' for more information.\n";
|
extern char warn_invalid_report[] ;
|
||||||
|
|
||||||
const char usage_long1[] = "\
|
#endif /* IPERF_LOCALE_H */
|
||||||
Usage: iperf [-s|-c host] [options]\n\
|
|
||||||
iperf [-h|--help] [-v|--version]\n\
|
|
||||||
\n\
|
|
||||||
Client/Server:\n\
|
|
||||||
-f, --format [kmKM] format to report: Kbits, Mbits, KBytes, MBytes\n\
|
|
||||||
-i, --interval # seconds between periodic bandwidth reports\n\
|
|
||||||
-l, --len #[KM] length of buffer to read or write (default 8 KB)\n\
|
|
||||||
-m, --print_mss print TCP maximum segment size (MTU - TCP/IP header)\n\
|
|
||||||
-p, --port # server port to listen on/connect to\n\
|
|
||||||
-u, --udp use UDP rather than TCP\n\
|
|
||||||
-w, --window #[KM] TCP window size (socket buffer size)\n\
|
|
||||||
-M, --mss # set TCP maximum segment size (MTU - 40 bytes)\n\
|
|
||||||
-N, --nodelay set TCP no delay, disabling Nagle's Algorithm\n\
|
|
||||||
-T, --tcpinfo Output detailed TCP info\n\
|
|
||||||
Server specific:\n\
|
|
||||||
-s, --server run in server mode\n\
|
|
||||||
-U, --single_udp run in single threaded UDP mode\n\
|
|
||||||
-D, --daemon run the server as a daemon\n"
|
|
||||||
#ifdef WIN32
|
|
||||||
" -R, --remove remove service in win32\n"
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
#ifdef OBSOLETE /* from old iperf: no longer supported. Add someday?? */
|
|
||||||
-o, --output <filename> output the report or error message to this specified file\n\
|
|
||||||
-B, --bind <host> bind to <host>, an interface or multicast address\n\
|
|
||||||
-V, --IPv6Version Set the domain to IPv6\n\
|
|
||||||
-C, --compatibility for use with older versions does not sent extra msgs
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char usage_long2[] = "\
|
|
||||||
\n\
|
|
||||||
Client specific:\n\
|
|
||||||
-b, --bandwidth #[KM] for UDP, bandwidth to send at in bits/sec\n\
|
|
||||||
(default 1 Mbit/sec, implies -u)\n\
|
|
||||||
-c, --client <host> run in client mode, connecting to <host>\n\
|
|
||||||
-n, --num #[KM] number of bytes to transmit (instead of -t)\n\
|
|
||||||
-t, --time # time in seconds to transmit for (default 10 secs)\n\
|
|
||||||
-P, --parallel # number of parallel client threads to run\n\
|
|
||||||
-T, --tcpinfo Output detailed TCP info (Linux and FreeBSD only)\n\
|
|
||||||
\n\
|
|
||||||
Miscellaneous:\n\
|
|
||||||
-h, --help print this message and quit\n\
|
|
||||||
\n\
|
|
||||||
[KM] Indicates options that support a K or M suffix for kilo- or mega-\n\
|
|
||||||
\n\
|
|
||||||
Report bugs to <iperf-users@lists.sourceforge.net>\n";
|
|
||||||
|
|
||||||
#ifdef OBSOLETE /* from old iperf: no longer supported. Add some of these back someday */
|
|
||||||
-v, --version print version information and quit\n\
|
|
||||||
-Z, --linux-congestion <algo> set TCP congestion control algorithm (Linux only)\n\
|
|
||||||
-d, --dualtest Do a bidirectional test simultaneously\n\
|
|
||||||
-L, --listenport # port to recieve bidirectional tests back on\n\
|
|
||||||
-I, --stdin input the data to be transmitted from stdin\n\
|
|
||||||
-F, --fileinput <name> input the data to be transmitted from a file\n\
|
|
||||||
-r, --tradeoff Do a bidirectional test individually\n\
|
|
||||||
-T, --ttl # time-to-live, for multicast (default 1)\n\
|
|
||||||
-x, --reportexclude [CDMSV] exclude C(connection) D(data) M(multicast) S(settings) V(server) reports\n\
|
|
||||||
-y, --reportstyle C report as a Comma-Separated Values
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//const char version[] = "iperf version " IPERF_VERSION " (" IPERF_VERSION_DATE ") " IPERF_THREADS "\n";
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------
|
|
||||||
* settings
|
|
||||||
* ------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
const char seperator_line[] =
|
|
||||||
"------------------------------------------------------------\n";
|
|
||||||
|
|
||||||
const char server_port[] =
|
|
||||||
"Server listening on %s port %d\n";
|
|
||||||
|
|
||||||
const char client_port[] =
|
|
||||||
"Client connecting to %s, %s port %d\n";
|
|
||||||
|
|
||||||
const char bind_address[] =
|
|
||||||
"Binding to local address %s\n";
|
|
||||||
|
|
||||||
const char multicast_ttl[] =
|
|
||||||
"Setting multicast TTL to %d\n";
|
|
||||||
|
|
||||||
const char join_multicast[] =
|
|
||||||
"Joining multicast group %s\n";
|
|
||||||
|
|
||||||
const char client_datagram_size[] =
|
|
||||||
"Sending %d byte datagrams\n";
|
|
||||||
|
|
||||||
const char server_datagram_size[] =
|
|
||||||
"Receiving %d byte datagrams\n";
|
|
||||||
|
|
||||||
const char tcp_window_size[] =
|
|
||||||
"TCP window size";
|
|
||||||
|
|
||||||
const char udp_buffer_size[] =
|
|
||||||
"UDP buffer size";
|
|
||||||
|
|
||||||
const char window_default[] =
|
|
||||||
"(default)";
|
|
||||||
|
|
||||||
const char wait_server_threads[] =
|
|
||||||
"Waiting for server threads to complete. Interrupt again to force quit.\n";
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------
|
|
||||||
* reports
|
|
||||||
* ------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
const char report_read_lengths[] =
|
|
||||||
"[%3d] Read lengths occurring in more than 5%% of reads:\n";
|
|
||||||
|
|
||||||
const char report_read_length_times[] =
|
|
||||||
"[%3d] %5d bytes read %5d times (%.3g%%)\n";
|
|
||||||
|
|
||||||
const char report_bw_header[] =
|
|
||||||
"[ ID] Interval Transfer Bandwidth\n";
|
|
||||||
|
|
||||||
const char report_bw_format[] =
|
|
||||||
"[%3d] %4.1f-%4.1f sec %ss %ss/sec\n";
|
|
||||||
|
|
||||||
const char report_sum_bw_format[] =
|
|
||||||
"[SUM] %4.1f-%4.1f sec %ss %ss/sec\n";
|
|
||||||
|
|
||||||
const char report_bw_jitter_loss_header[] =
|
|
||||||
"[ ID] Interval Transfer Bandwidth Jitter Lost/Total \
|
|
||||||
Datagrams\n";
|
|
||||||
|
|
||||||
const char report_bw_jitter_loss_format[] =
|
|
||||||
"[%3d] %4.1f-%4.1f sec %ss %ss/sec %5.3f ms %4d/%5d (%.2g%%)\n";
|
|
||||||
|
|
||||||
const char report_sum_bw_jitter_loss_format[] =
|
|
||||||
"[SUM] %4.1f-%4.1f sec %ss %ss/sec %5.3f ms %4d/%5d (%.2g%%)\n";
|
|
||||||
|
|
||||||
const char report_outoforder[] =
|
|
||||||
"[%3d] %4.1f-%4.1f sec %d datagrams received out-of-order\n";
|
|
||||||
|
|
||||||
const char report_sum_outoforder[] =
|
|
||||||
"[SUM] %4.1f-%4.1f sec %d datagrams received out-of-order\n";
|
|
||||||
|
|
||||||
const char report_peer[] =
|
|
||||||
"[%3d] local %s port %u connected with %s port %u\n";
|
|
||||||
|
|
||||||
const char report_mss_unsupported[] =
|
|
||||||
"[%3d] MSS and MTU size unknown (TCP_MAXSEG not supported by OS?)\n";
|
|
||||||
|
|
||||||
const char report_mss[] =
|
|
||||||
"[%3d] MSS size %d bytes (MTU %d bytes, %s)\n";
|
|
||||||
|
|
||||||
const char report_datagrams[] =
|
|
||||||
"[%3d] Sent %d datagrams\n";
|
|
||||||
|
|
||||||
const char report_sum_datagrams[] =
|
|
||||||
"[SUM] Sent %d datagrams\n";
|
|
||||||
|
|
||||||
const char server_reporting[] =
|
|
||||||
"[%3d] Server Report:\n";
|
|
||||||
|
|
||||||
const char reportCSV_peer[] =
|
|
||||||
"%s,%u,%s,%u";
|
|
||||||
|
|
||||||
#if defined(linux)
|
|
||||||
const char report_tcpInfo[] =
|
|
||||||
"\t TCP Info: CWND=%u SND_SSTHRESH=%u RCV_SSTHRESH=%u UNACKED=%u SACK=%u LOST=%u RETRANS=%u FACK=%u";
|
|
||||||
#endif
|
|
||||||
#if defined(__FreeBSD__)
|
|
||||||
const char report_tcpInfo[] =
|
|
||||||
"\t TCP Info: CWND=%u SND_SSTHRESH=%u RCV_WIND=%u";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_QUAD_SUPPORT
|
|
||||||
#ifdef HAVE_PRINTF_QD
|
|
||||||
const char reportCSV_bw_format[] =
|
|
||||||
"%s,%s,%d,%.1f-%.1f,%qd,%qd\n";
|
|
||||||
|
|
||||||
const char reportCSV_bw_jitter_loss_format[] =
|
|
||||||
"%s,%s,%d,%.1f-%.1f,%qd,%qd,%.3f,%d,%d,%.3f,%d\n";
|
|
||||||
#else // HAVE_PRINTF_QD
|
|
||||||
const char reportCSV_bw_format[] =
|
|
||||||
"%s,%s,%d,%.1f-%.1f,%lld,%lld\n";
|
|
||||||
|
|
||||||
const char reportCSV_bw_jitter_loss_format[] =
|
|
||||||
"%s,%s,%d,%.1f-%.1f,%lld,%lld,%.3f,%d,%d,%.3f,%d\n";
|
|
||||||
#endif // HAVE_PRINTF_QD
|
|
||||||
#else // HAVE_QUAD_SUPPORT
|
|
||||||
#ifdef WIN32
|
|
||||||
const char reportCSV_bw_format[] =
|
|
||||||
"%s,%s,%d,%.1f-%.1f,%I64d,%I64d\n";
|
|
||||||
|
|
||||||
const char reportCSV_bw_jitter_loss_format[] =
|
|
||||||
"%s,%s,%d,%.1f-%.1f,%I64d,%I64d,%.3f,%d,%d,%.3f,%d\n";
|
|
||||||
#else
|
|
||||||
const char reportCSV_bw_format[] =
|
|
||||||
"%s,%s,%d,%.1f-%.1f,%d,%d\n";
|
|
||||||
|
|
||||||
const char reportCSV_bw_jitter_loss_format[] =
|
|
||||||
"%s,%s,%d,%.1f-%.1f,%d,%d,%.3f,%d,%d,%.3f,%d\n";
|
|
||||||
#endif //WIN32
|
|
||||||
#endif //HAVE_QUAD_SUPPORT
|
|
||||||
/* -------------------------------------------------------------------
|
|
||||||
* warnings
|
|
||||||
* ------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
const char warn_window_requested[] =
|
|
||||||
" (WARNING: requested %s)";
|
|
||||||
|
|
||||||
const char warn_window_small[] = "\
|
|
||||||
WARNING: TCP window size set to %d bytes. A small window size\n\
|
|
||||||
will give poor performance. See the Iperf documentation.\n";
|
|
||||||
|
|
||||||
const char warn_delay_large[] =
|
|
||||||
"WARNING: delay too large, reducing from %.1f to 1.0 seconds.\n";
|
|
||||||
|
|
||||||
const char warn_no_pathmtu[] =
|
|
||||||
"WARNING: Path MTU Discovery may not be enabled.\n";
|
|
||||||
|
|
||||||
const char warn_no_ack[]=
|
|
||||||
"[%3d] WARNING: did not receive ack of last datagram after %d tries.\n";
|
|
||||||
|
|
||||||
const char warn_ack_failed[]=
|
|
||||||
"[%3d] WARNING: ack of last datagram failed after %d tries.\n";
|
|
||||||
|
|
||||||
const char warn_fileopen_failed[]=
|
|
||||||
"WARNING: Unable to open file stream for transfer\n\
|
|
||||||
Using default data stream. \n";
|
|
||||||
|
|
||||||
const char unable_to_change_win[]=
|
|
||||||
"WARNING: Unable to change the window size\n";
|
|
||||||
|
|
||||||
const char opt_estimate[]=
|
|
||||||
"Optimal Estimate\n";
|
|
||||||
|
|
||||||
const char report_interval_small[] =
|
|
||||||
"WARNING: interval too small, increasing from %3.2f to 0.5 seconds.\n";
|
|
||||||
|
|
||||||
const char warn_invalid_server_option[] =
|
|
||||||
"WARNING: option -%c is not valid for server mode\n";
|
|
||||||
|
|
||||||
const char warn_invalid_client_option[] =
|
|
||||||
"WARNING: option -%c is not valid for client mode\n";
|
|
||||||
|
|
||||||
const char warn_invalid_compatibility_option[] =
|
|
||||||
"WARNING: option -%c is not valid in compatibility mode\n";
|
|
||||||
|
|
||||||
const char warn_implied_udp[] =
|
|
||||||
"WARNING: option -%c implies udp testing\n";
|
|
||||||
|
|
||||||
const char warn_implied_compatibility[] =
|
|
||||||
"WARNING: option -%c has implied compatibility mode\n";
|
|
||||||
|
|
||||||
const char warn_buffer_too_small[] =
|
|
||||||
"WARNING: the UDP buffer was increased to %d for proper operation\n";
|
|
||||||
|
|
||||||
const char warn_invalid_single_threaded[] =
|
|
||||||
"WARNING: option -%c is not valid in single threaded versions\n";
|
|
||||||
|
|
||||||
const char warn_invalid_report_style[] =
|
|
||||||
"WARNING: unknown reporting style \"%s\", switching to default\n";
|
|
||||||
|
|
||||||
const char warn_invalid_report[] =
|
|
||||||
"WARNING: unknown reporting type \"%c\", ignored\n valid options are:\n\t exclude: C(connection) D(data) M(multicast) S(settings) V(server) report\n\n";
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} /* end extern "C" */
|
|
||||||
#endif
|
|
||||||
|
65
src/tcp_info.c
Обычный файл
65
src/tcp_info.c
Обычный файл
@ -0,0 +1,65 @@
|
|||||||
|
|
||||||
|
/*
|
||||||
|
* routines related to collection TCP_INFO using getsockopt()
|
||||||
|
*
|
||||||
|
* Brian Tierney, ESnet (bltierney@es.net)
|
||||||
|
*
|
||||||
|
* Note that this is only supported on Linux and FreeBSD, and that for FreeBSD
|
||||||
|
* only the following are returned: tcpi_snd_ssthresh, tcpi_snd_cwnd,
|
||||||
|
* tcpi_rcv_space, tcpi_rtt
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
|
||||||
|
#include "iperf_api.h"
|
||||||
|
#include "locale.h"
|
||||||
|
|
||||||
|
/*************************************************************/
|
||||||
|
void
|
||||||
|
get_tcpinfo(struct iperf_test *test)
|
||||||
|
{
|
||||||
|
#if defined(linux) || defined(__FreeBSD__)
|
||||||
|
socklen_t tcp_info_length;
|
||||||
|
struct tcp_info tcpInfo;
|
||||||
|
struct iperf_stream *sp = test->streams;
|
||||||
|
|
||||||
|
tcp_info_length = sizeof(tcpInfo);
|
||||||
|
memset((char *)&tcpInfo, 0, tcp_info_length);
|
||||||
|
//printf("getting TCP_INFO for socket %d \n", sp->socket);
|
||||||
|
if (getsockopt(sp->socket, IPPROTO_TCP, TCP_INFO, (void *)&tcpInfo, &tcp_info_length) < 0) {
|
||||||
|
perror("getsockopt");
|
||||||
|
}
|
||||||
|
printf("get TCP_INFP: %d, %d, %d, %d\n", tcpInfo.tcpi_snd_cwnd,
|
||||||
|
tcpInfo.tcpi_snd_ssthresh, tcpInfo.tcpi_rcv_space, tcpInfo.tcpi_rtt);
|
||||||
|
/*
|
||||||
|
* memcpy(&temp.tcpInfo, &tcpInfo, sizeof(tcpInfo));
|
||||||
|
*/
|
||||||
|
/* need to copy these results somewhere! */
|
||||||
|
#else
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************************/
|
||||||
|
void
|
||||||
|
print_tcpinfo(struct iperf_interval_results *r)
|
||||||
|
{
|
||||||
|
#if defined(linux)
|
||||||
|
printf(report_tcpInfo, r->tcpInfo.tcpi_snd_cwnd, r->tcpInfo.tcpi_snd_ssthresh,
|
||||||
|
r->tcpInfo.tcpi_rcv_ssthresh, r->tcpInfo.tcpi_unacked, r->tcpInfo.tcpi_sacked,
|
||||||
|
r->tcpInfo.tcpi_lost, r->tcpInfo.tcpi_retrans, r->tcpInfo.tcpi_fackets);
|
||||||
|
#endif
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
printf(report_tcpInfo, r->tcpInfo.tcpi_snd_cwnd, r->tcpInfo.tcpi_rcv_space,
|
||||||
|
r->tcpInfo.tcpi_snd_ssthresh, r->tcpInfo.tcpi_rtt);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Загрузка…
x
Ссылка в новой задаче
Block a user