 |
Flowgrind
Advanced TCP traffic generator
|
Flowgrind controller.
More...
#include "config.h"
#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <math.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <sys/uio.h>
#include <sys/utsname.h>
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
#include <syslog.h>
#include <xmlrpc-c/base.h>
#include <xmlrpc-c/client.h>
#include "flowgrind.h"
#include "common.h"
#include "fg_error.h"
#include "fg_progname.h"
#include "fg_time.h"
#include "fg_definitions.h"
#include "fg_string.h"
#include "debug.h"
#include "fg_rpc_client.h"
#include "fg_argparser.h"
#include "fg_log.h"
Go to the source code of this file.
|
static struct daemon * | add_daemon_by_uuid (const char *server_uuid, char *daemon_url) |
| Add daemon for controller flow by UUID. More...
|
|
static struct rpc_info * | add_flow_endpoint_by_url (const char *server_url, const char *server_name, unsigned short server_port) |
| Add the flow endpoint XML RPC data to the Global linked list. More...
|
|
static void | check_idle (xmlrpc_client *rpc_client) |
| Checks that all nodes are currently idle. More...
|
|
static void | check_mutex (struct ap_Mutex_state ms[], const enum mutex_context_t context, const int argind, int flow_id) |
| Wrapper function for mutex checking and error message printing. More...
|
|
static void | check_version (xmlrpc_client *rpc_client) |
| Checks all the daemons flowgrind version. More...
|
|
static void | close_all_flows (void) |
| Stop test connections for all flows in a test. More...
|
|
static void | close_logfile (void) |
| Close measurement output file. More...
|
|
static size_t | det_num_digits (double value) |
| Determines the length of the integer part of a decimal number. More...
|
|
static void | die_if_fault_occurred (xmlrpc_env *env) |
|
static void | fetch_reports (xmlrpc_client *rpc_client) |
| Reports are fetched from the flow endpoint daemon. More...
|
|
static void | find_daemon (xmlrpc_client *rpc_client) |
| Checks all daemons in flow option. More...
|
|
static char * | guess_topology (unsigned mtu) |
| Maps common MTU sizes to network known technologies. More...
|
|
static void | init_controller_options (void) |
| Initialization of general controller options. More...
|
|
static void | init_flow_options (void) |
| Initilization the flow option to default values. More...
|
|
int | main (int argc, char *argv[]) |
|
static void | open_logfile (void) |
| Create a logfile for measurement output. More...
|
|
static void | parse_cmdline (int argc, char *argv[]) |
| The main commandline argument parsing function. More...
|
|
static void | parse_colon_option (const char *arg) |
| Parse argument for option -c to hide/show intermediated interval report columns. More...
|
|
static void | parse_flow_option (int code, const char *arg, const char *opt_string, int flow_id) |
| Parse flow options without endpoint. More...
|
|
static void | parse_flow_option_endpoint (int code, const char *arg, const char *opt_string, int flow_id, int endpoint_id) |
| Parse flow options with endpoint. More...
|
|
static void | parse_general_option (int code, const char *arg, const char *opt_string) |
| Parse general controller options given on the cmdline. More...
|
|
static void | parse_host_option (const char *hostarg, int flow_id, int endpoint_id) |
| Parse argument for option -H, which specifies the endpoints of a flow. More...
|
|
static void | parse_multi_endpoint_option (int code, const char *arg, const char *opt_string, struct ap_Mutex_state ms[], int argind, int flow_id) |
| Parse flow options for multiple endpoints. More...
|
|
static void | parse_rate_option (const char *arg, int flow_id, int endpoint_id) |
| Parse argument for option -R, which specifies the rate the endpoint will send. More...
|
|
static void | parse_trafgen_option (const char *params, int flow_id, int endpoint_id) |
| Parse option for stochastic traffic generation (option -G). More...
|
|
static void | prepare_all_flows (xmlrpc_client *rpc_client) |
| Prepare test connection for all flows in a test. More...
|
|
static void | prepare_flow (int id, xmlrpc_client *rpc_client) |
| Prepare test connection for a flow between source and destination daemons. More...
|
|
static void | prepare_xmlrpc_client (xmlrpc_client **rpc_client) |
|
static void | print_all_final_reports (void) |
| Print final report (i.e. More...
|
|
static bool | print_column (char **header1, char **header2, char **data, enum column_id column_id, double value, unsigned accuracy) |
| Append measured data for interval report column column_id to given strings. More...
|
|
static bool | print_column_str (char **header1, char **header2, char **data, enum column_id column_id, char *value) |
| Append measured data for interval report column column_id to given strings. More...
|
|
static void | print_final_report (unsigned short flow_id, enum endpoint_t e) |
| Print final report (i.e. More...
|
|
static void | print_headline (void) |
| Print headline with various informations before the actual measurement will be begin. More...
|
|
static void | print_interval_report (unsigned short flow_id, enum endpoint_t e, struct report *report) |
| Print interval report report for endpoint e of flow flow_id . More...
|
|
static void | print_output (const char *fmt,...) |
| Print measurement output to logfile and / or to stdout. More...
|
|
static void | report_flow (struct report *report) |
| Reports are fetched from the flow endpoint daemon. More...
|
|
static void | sanity_check (void) |
| Sanity checking flow options. More...
|
|
static double | scale_thruput (double thruput) |
| Scale the given throughput thruput in either Mebibyte per seconds or in Megabits per seconds. More...
|
|
static void | set_column_unit (const char *unit, unsigned nargs,...) |
| To set the unit the in header of intermediated interval report columns. More...
|
|
static void | set_column_visibility (bool visibility, unsigned nargs,...) |
| To show/hide intermediated interval report columns. More...
|
|
static void | set_flow_endpoint_daemon (const char *server_uuid, char *server_url) |
| Set the daemon for controller flow endpoint. More...
|
|
static struct rpc_info * | set_rpc_info (const char *server_url, const char *server_name, unsigned short server_port) |
| Set the flow endpoint XML RPC data for a given server_url. More...
|
|
static struct daemon * | set_unique_daemon_by_uuid (const char *server_uuid, char *daemon_url) |
| Determine the daemons for controller flow by UUID. More...
|
|
static void | sighandler (int sig) |
| Signal handler to catching signals. More...
|
|
static void | start_all_flows (xmlrpc_client *rpc_client) |
| Start test connections for all flows in a test. More...
|
|
static bool | update_column_width (struct column *column, unsigned column_width) |
| Determines if the current column width column_width is larger or smaller than the old one and updates the state of column column accordingly. More...
|
|
static void | usage (short status) __attribute__((noreturn)) |
|
static void | usage_sockopt (void) |
| Print usage or error message and exit. More...
|
|
static void | usage_trafgenopt (void) |
| Print help on flowgrind's traffic generation facilities and exit with EXIT_SUCCESS. More...
|
|
Flowgrind controller.
Definition in file flowgrind.c.
◆ HIDE_COLUMNS
To hide intermediated interval report columns.
Definition at line 78 of file flowgrind.c.
◆ PARSE_ERR
#define PARSE_ERR |
( |
|
err_msg, |
|
|
|
... |
|
) |
| |
Value: do { \
errx(err_msg, ##__VA_ARGS__); \
usage(EXIT_FAILURE); \
} while (0)
Print error message, usage string and exit.
Used for cmdline parsing errors.
Definition at line 86 of file flowgrind.c.
◆ SET_COLUMN_UNIT
To set the unit of intermediated interval report columns.
Definition at line 82 of file flowgrind.c.
◆ SHOW_COLUMNS
To show intermediated interval report columns.
Definition at line 74 of file flowgrind.c.
◆ add_daemon_by_uuid()
static struct daemon* add_daemon_by_uuid |
( |
const char * |
server_uuid, |
|
|
char * |
daemon_url |
|
) |
| |
|
static |
Add daemon for controller flow by UUID.
Stores the daemons data and push the data in linked list which contains daemons UUID and daemons XML RPC url
- Parameters
-
[in,out] | server_uuid | UUID from daemons |
[in,out] | daemon_url | URL from daemons |
Definition at line 720 of file flowgrind.c.
727 logging(LOG_ALERT,
"could not allocate memory for daemon");
◆ add_flow_endpoint_by_url()
static struct rpc_info* add_flow_endpoint_by_url |
( |
const char * |
server_url, |
|
|
const char * |
server_name, |
|
|
unsigned short |
server_port |
|
) |
| |
|
static |
Add the flow endpoint XML RPC data to the Global linked list.
- Parameters
-
[in] | XML-RPC | connection url |
[in] | server_name | flow endpoints IP address |
[in] | server_port | controller - daemon XML-RPC connection port Nr |
- Returns
- rpc_info flow endpoint XML RPC structure data
Definition at line 2195 of file flowgrind.c.
2200 flow_rpc_info = malloc((
sizeof(
struct rpc_info)));
2202 if (!flow_rpc_info ) {
2203 logging(LOG_ALERT,
"could not allocate memory for flows rpc info");
2207 memset(flow_rpc_info, 0,
sizeof(
struct rpc_info));
2213 return flow_rpc_info;
◆ check_idle()
static void check_idle |
( |
xmlrpc_client * |
rpc_client | ) |
|
|
static |
Checks that all nodes are currently idle.
Get the daemon's flow start status and number of flows running in a daemon. This piece of information is used to determine, whether the daemon in a node is busy or idle.
- Parameters
-
[in,out] | rpc_client | to connect controller to daemon |
Definition at line 845 of file flowgrind.c.
847 xmlrpc_value * resultP = 0;
857 xmlrpc_client_call2f(&
rpc_env, rpc_client,
859 "get_status", &resultP,
"()");
868 xmlrpc_decompose_value(&
rpc_env, resultP,
869 "{s:i,s:i,*}",
"started",
877 critx(
"node %s is busy. %d flows, started=%d",
880 xmlrpc_DECREF(resultP);
◆ check_mutex()
Wrapper function for mutex checking and error message printing.
Defines the cmdline options and distinguishes option types (flow, general, ...) and tokenizes flow options which can have several endpoints.
- Parameters
-
[in] | ms | array of mutex states |
[in] | context | the mutex context of this option (see enum #mutex_contexts) |
[in] | argind | option record index |
[in] | flow_id | ID of the flow to show in error message |
Definition at line 2807 of file flowgrind.c.
2814 PARSE_ERR(
"Option %s conflicts with option %s",
2819 PARSE_ERR(
"In flow %i: option %s conflicts with option %s",
◆ check_version()
static void check_version |
( |
xmlrpc_client * |
rpc_client | ) |
|
|
static |
Checks all the daemons flowgrind version.
Collect the daemons flowgrind version, XML-RPC API version, OS name and release details. Store these information in the daemons linked list for the result display
- Parameters
-
[in,out] | rpc_client | to connect controller to daemon |
Definition at line 652 of file flowgrind.c.
654 xmlrpc_value * resultP = 0;
667 "get_version", &resultP,
"()");
668 if ((
rpc_env.fault_occurred) && (strcasestr(
rpc_env.fault_string,
"response code is 400")))
669 critx(
"node %s could not parse request.You are "
670 "probably trying to use a numeric IPv6 address "
671 "and the node's libxmlrpc is too old, please "
683 xmlrpc_decompose_value(&
rpc_env, resultP,
"{s:s,s:i,s:s,s:s,*}",
692 warnx(
"node %s uses version %s",
701 xmlrpc_DECREF(resultP);
◆ close_all_flows()
static void close_all_flows |
( |
void |
| ) |
|
|
static |
Stop test connections for all flows in a test.
All the test connection are stopped, but the test connection flow in the controller and in daemon are different. In the controller, test connection are respective to number of flows in a test,but in daemons test connection are respective to flow endpoints. Single daemons can maintain multiple flows endpoints, So controller should stop a daemon only once.
Definition at line 1538 of file flowgrind.c.
1541 xmlrpc_client *client;
1544 DEBUG_MSG(LOG_WARNING,
"closing flow %u",
id);
1550 xmlrpc_env_init(&env);
1551 xmlrpc_client_create(&env, XMLRPC_CLIENT_NO_FLAGS,
"Flowgrind",
FLOWGRIND_VERSION, NULL, 0, &client);
1553 xmlrpc_env_clean(&env);
1556 xmlrpc_value * resultP = 0;
1558 if (
cflow[
id].endpoint_id[*i] == -1 ||
1559 cflow[
id].finished[*i])
1565 xmlrpc_env_init(&env);
1566 xmlrpc_client_call2f(&env, client,
1568 "stop_flow", &resultP,
"({s:i})",
1571 xmlrpc_DECREF(resultP);
1573 xmlrpc_env_clean(&env);
1579 xmlrpc_client_destroy(client);
1580 DEBUG_MSG(LOG_WARNING,
"closed flow %u",
id);
◆ close_logfile()
static void close_logfile |
( |
void |
| ) |
|
|
static |
Close measurement output file.
Definition at line 576 of file flowgrind.c.
◆ det_num_digits()
static size_t det_num_digits |
( |
double |
value | ) |
|
|
inlinestatic |
Determines the length of the integer part of a decimal number.
- Parameters
-
- Returns
- length of integer part
Definition at line 1590 of file flowgrind.c.
1596 return floor(log10(abs((
int)value))) + 1;
◆ die_if_fault_occurred()
static void die_if_fault_occurred |
( |
xmlrpc_env * |
env | ) |
|
|
inlinestatic |
Definition at line 608 of file flowgrind.c.
610 if (env->fault_occurred)
611 critx(
"XML-RPC Fault: %s (%d)", env->fault_string, env->fault_code);
◆ fetch_reports()
static void fetch_reports |
( |
xmlrpc_client * |
rpc_client | ) |
|
|
static |
Reports are fetched from the flow endpoint daemon.
Single daemon can maintain multiple flows endpoints and daemons combine all its flows reports and send them to the controller. So controller should call a daemon in its flows only once.
- Parameters
-
[in,out] | rpc_client | to connect controller to daemon |
- Bug:
- Kernel metrics (tcp_info). Other OS than Linux may not send valid values here. For the moment we don't care and handle this in the output/display routines. However, this do not work in heterogeneous environments
Definition at line 1297 of file flowgrind.c.
1300 xmlrpc_value * resultP = 0;
1306 int array_size, has_more;
1307 xmlrpc_value *rv = 0;
1312 "get_reports", &resultP,
"()");
1314 errx(
"XML-RPC fault: %s (%d)",
rpc_env.fault_string,
1322 array_size = xmlrpc_array_size(&
rpc_env, resultP);
1324 warnx(
"empty array in get_reports reply");
1328 xmlrpc_array_read_item(&
rpc_env, resultP, 0, &rv);
1329 xmlrpc_read_int(&
rpc_env, rv, &has_more);
1331 errx(
"XML-RPC fault: %s (%d)",
rpc_env.fault_string,
1338 for (
int i = 1; i < array_size; i++) {
1339 xmlrpc_value *rv = 0;
1341 xmlrpc_array_read_item(&
rpc_env, resultP, i, &rv);
1344 int begin_sec, begin_nsec, end_sec, end_nsec;
1346 int tcpi_snd_ssthresh;
1351 int tcpi_retransmits;
1353 int tcpi_reordering;
1360 int bytes_read_low, bytes_read_high;
1361 int bytes_written_low, bytes_written_high;
1363 xmlrpc_decompose_value(&
rpc_env, rv,
1365 "{s:i,s:i,s:i,s:i,s:i,s:i,s:i,*}"
1366 "{s:i,s:i,s:i,s:i,*}"
1367 "{s:i,s:i,s:i,s:i,*}"
1368 "{s:d,s:d,s:d,s:d,s:d,s:d,s:d,s:d,s:d,*}"
1370 "{s:i,s:i,s:i,s:i,s:i,*}"
1371 "{s:i,s:i,s:i,s:i,s:i,*}"
1372 "{s:i,s:i,s:i,s:i,s:i,*}"
1379 "begin_tv_sec", &begin_sec,
1380 "begin_tv_nsec", &begin_nsec,
1381 "end_tv_sec", &end_sec,
1382 "end_tv_nsec", &end_nsec,
1384 "bytes_read_high", &bytes_read_high,
1385 "bytes_read_low", &bytes_read_low,
1386 "bytes_written_high", &bytes_written_high,
1387 "bytes_written_low", &bytes_written_low,
1407 "tcpi_snd_cwnd", &tcpi_snd_cwnd,
1408 "tcpi_snd_ssthresh", &tcpi_snd_ssthresh,
1409 "tcpi_unacked", &tcpi_unacked,
1410 "tcpi_sacked", &tcpi_sacked,
1411 "tcpi_lost", &tcpi_lost,
1413 "tcpi_retrans", &tcpi_retrans,
1414 "tcpi_retransmits", &tcpi_retransmits,
1415 "tcpi_fackets", &tcpi_fackets,
1416 "tcpi_reordering", &tcpi_reordering,
1417 "tcpi_rtt", &tcpi_rtt,
1419 "tcpi_rttvar", &tcpi_rttvar,
1420 "tcpi_rto", &tcpi_rto,
1421 "tcpi_backoff", &tcpi_backoff,
1422 "tcpi_ca_state", &tcpi_ca_state,
1423 "tcpi_snd_mss", &tcpi_snd_mss,
1428 #ifdef HAVE_UNSIGNED_LONG_LONG_INT
1429 report.
bytes_read = ((
long long)bytes_read_high << 32) + (uint32_t)bytes_read_low;
1430 report.
bytes_written = ((
long long)bytes_written_high << 32) + (uint32_t)bytes_written_low;
1465 xmlrpc_DECREF(resultP);
1468 goto has_more_reports;
◆ find_daemon()
static void find_daemon |
( |
xmlrpc_client * |
rpc_client | ) |
|
|
static |
Checks all daemons in flow option.
Daemon UUID is retrieved and this information is used to determine daemon in the controller flow information.
The UUID is used to detect if the same daemon instance is controlling flows via different IP adresses.
- Parameters
-
[in,out] | rpc_client | to connect controller to daemon |
Definition at line 805 of file flowgrind.c.
807 xmlrpc_value * resultP = 0;
817 xmlrpc_client_call2f(&
rpc_env, rpc_client,
819 "get_uuid", &resultP,
"()");
825 char* server_uuid = 0;
827 xmlrpc_decompose_value(&
rpc_env, resultP,
"{s:s,*}",
828 "server_uuid", &server_uuid);
831 xmlrpc_DECREF(resultP);
◆ guess_topology()
static char* guess_topology |
( |
unsigned |
mtu | ) |
|
|
static |
Maps common MTU sizes to network known technologies.
- Parameters
-
- Returns
- return network technology as string
Definition at line 1963 of file flowgrind.c.
1970 static const struct mtu_hint mtu_hints[] = {
1971 {65535,
"Hyperchannel"},
1972 {17914,
"16 MB/s Token Ring"},
1973 {16436,
"Linux Loopback device"},
1974 {16384,
"FreeBSD Loopback device"},
1975 {16352,
"Darwin Loopback device"},
1976 {9000,
"Gigabit Ethernet (Jumboframes)"},
1977 {8166,
"802.4 Token Bus"},
1978 {4464,
"4 MB/s Token Ring"},
1980 {1500,
"Ethernet/PPP"},
1983 {1280,
"IPv6 Tunnel"},
1985 {576,
"X.25 & ISDN"},
1986 {296,
"PPP (low delay)"},
1989 size_t array_size =
sizeof(mtu_hints) /
sizeof(
struct mtu_hint);
1990 for (
unsigned short i = 0; i < array_size; i++)
1991 if (mtu == mtu_hints[i].mtu)
1992 return mtu_hints[i].topology;
◆ init_controller_options()
static void init_controller_options |
( |
void |
| ) |
|
|
static |
Initialization of general controller options.
Definition at line 466 of file flowgrind.c.
◆ init_flow_options()
static void init_flow_options |
( |
void |
| ) |
|
|
static |
Initilization the flow option to default values.
Initializes the controller flow option settings, final report for both source and destination daemon in the flow.
Definition at line 486 of file flowgrind.c.
500 strcpy(
cflow[
id].endpoint[*i].test_address,
"localhost");
540 int data = open(
"/dev/urandom", O_RDONLY);
541 int rc = read(data, &
cflow[
id].random_seed,
sizeof (
int) );
544 crit(
"read /dev/urandom failed");
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 3111 of file flowgrind.c.
3113 struct sigaction sa;
3116 sigemptyset (&sa.sa_mask);
3117 if (sigaction(SIGINT, &sa, NULL))
3118 critx(
"could not set handler for SIGINT");
3120 xmlrpc_client *rpc_client = 0;
3122 xmlrpc_client_setup_global_const(&
rpc_env);
3135 DEBUG_MSG(LOG_WARNING,
"check daemons in the flows");
3139 DEBUG_MSG(LOG_WARNING,
"check flowgrindds versions");
3143 DEBUG_MSG(LOG_WARNING,
"check if flowgrindds are idle");
3147 DEBUG_MSG(LOG_WARNING,
"prepare all flows");
3151 DEBUG_MSG(LOG_WARNING,
"print headline");
3155 DEBUG_MSG(LOG_WARNING,
"start all flows");
3159 DEBUG_MSG(LOG_WARNING,
"close all flows");
3162 DEBUG_MSG(LOG_WARNING,
"print all final report");
3171 xmlrpc_client_destroy(rpc_client);
3173 xmlrpc_client_teardown_global_const();
◆ open_logfile()
static void open_logfile |
( |
void |
| ) |
|
|
static |
Create a logfile for measurement output.
Definition at line 551 of file flowgrind.c.
560 critx(
"could not allocate memory for log filename");
564 critx(
"log file exists");
◆ parse_cmdline()
static void parse_cmdline |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
|
static |
The main commandline argument parsing function.
Defines the cmdline options and distinguishes option types (flow, general, ...) and tokenizes flow options which can have several endpoints.
- Parameters
-
[in] | argc | number of arguments (as in main()) |
[in] | argv | array of argument strings (as in main()) |
Definition at line 2883 of file flowgrind.c.
2886 int cur_num_flows = 0;
2888 int max_flow_specifier = 0;
2933 if (!
ap_init(&
parser, argc, (
const char*
const*) argv, options, 0))
2934 critx(
"could not allocate memory for option parser");
2946 current_flow_ids[i] = i;
2964 char *argcpy = strdup(arg);
2965 for (
char *token = strtok(argcpy,
","); token;
2966 token = strtok(NULL,
",")) {
2967 rc = sscanf(token,
"%d", &optint);
2969 PARSE_ERR(
"%s",
"Malformed flow specifier");
2974 current_flow_ids[i] = i;
2979 current_flow_ids[cur_num_flows++] = optint;
2991 current_flow_ids[0]);
2992 for (
int i = 0; i < cur_num_flows; i++)
2994 current_flow_ids[i]);
2997 for (
int i = 0; i < cur_num_flows; i++)
2999 opt_string, ms, argind,
3000 current_flow_ids[i]);
3003 PARSE_ERR(
"%s",
"uncaught option tag!");
3009 PARSE_ERR(
"%s",
"must not specify option for non-existing flow");
3026 option->
optname = TCP_NODELAY;
3034 option->optlen =
sizeof(v);
3035 memcpy(option->optval, &v,
sizeof(v));
◆ parse_colon_option()
static void parse_colon_option |
( |
const char * |
arg | ) |
|
|
static |
Parse argument for option -c to hide/show intermediated interval report columns.
- Parameters
-
[in] | arg | argument for option -c |
Definition at line 2654 of file flowgrind.c.
2670 char *argcpy = strdup(arg);
2671 for (
char *token = strtok(argcpy,
","); token;
2672 token = strtok(NULL,
",")) {
2673 if (!strcmp(token,
"interval"))
2675 else if (!strcmp(token,
"through"))
2677 else if (!strcmp(token,
"transac"))
2679 else if (!strcmp(token,
"blocks"))
2681 else if (!strcmp(token,
"rtt"))
2683 else if (!strcmp(token,
"iat"))
2685 else if (!strcmp(token,
"delay"))
2687 else if (!strcmp(token,
"kernel"))
2695 else if (!strcmp(token,
"status"))
2699 PARSE_ERR(
"%s",
"malformed option '-c'");
◆ parse_flow_option()
static void parse_flow_option |
( |
int |
code, |
|
|
const char * |
arg, |
|
|
const char * |
opt_string, |
|
|
int |
flow_id |
|
) |
| |
|
static |
Parse flow options without endpoint.
- Parameters
-
[in] | code | the code of the cmdline option |
[in] | arg | the argument string of the cmdline option |
[in] | opt_string | contains the real cmdline option string |
[in] | flow_id | ID of flow to apply option to |
Definition at line 2617 of file flowgrind.c.
2620 unsigned optunsigned = 0;
2631 if (sscanf(arg,
"%u", &optunsigned) != 1)
2632 PARSE_ERR(
"option %s needs an integer argument",
◆ parse_flow_option_endpoint()
static void parse_flow_option_endpoint |
( |
int |
code, |
|
|
const char * |
arg, |
|
|
const char * |
opt_string, |
|
|
int |
flow_id, |
|
|
int |
endpoint_id |
|
) |
| |
|
static |
Parse flow options with endpoint.
- Parameters
-
[in] | code | the code of the cmdline option |
[in] | arg | the argument of the cmdline option |
[in] | opt_string | contains the real cmdline option string |
[in] | flow_id | ID of flow to apply option to |
[in] | endpoint_id | endpoint to apply option to |
Definition at line 2479 of file flowgrind.c.
2484 double optdouble = 0.0;
2498 if (sscanf(arg,
"%u", &optint) != 1 || optint < 0)
2499 PARSE_ERR(
"in flow %i: option %s needs positive integer",
2507 if (sscanf(arg,
"%x", &optint) != 1 || (optint & ~0x3f))
2508 PARSE_ERR(
"in flow %i: option %s service code point "
2509 "is malformed",
flow_id, opt_string);
2510 settings->
dscp = optint;
2520 PARSE_ERR(
"in flow %i: option %s requires a value "
2521 "for each endpoint",
flow_id, opt_string);
2523 if (!strcmp(arg,
"TCP_CORK")) {
2525 }
else if (!strcmp(arg,
"TCP_ELCN")) {
2527 }
else if (!strcmp(arg,
"TCP_LCD")) {
2529 }
else if (!strcmp(arg,
"TCP_MTCP")) {
2531 }
else if (!strcmp(arg,
"TCP_NODELAY")) {
2533 }
else if (!strcmp(arg,
"ROUTE_RECORD")) {
2536 }
else if (!memcmp(arg,
"TCP_CONG_MODULE=", 16)) {
2538 PARSE_ERR(
"in flow %i: option %s: too large "
2539 "string for TCP_CONG_MODULE",
2541 strcpy(settings->
cc_alg, arg + 16);
2542 }
else if (!memcmp(arg,
"TCP_CONGESTION=", 15)) {
2544 PARSE_ERR(
"in flow %i: option %s: too large "
2545 "string for TCP_CONGESTION",
2547 strcpy(settings->
cc_alg, arg + 15);
2548 }
else if (!strcmp(arg,
"SO_DEBUG")) {
2550 }
else if (!strcmp(arg,
"IP_MTU_DISCOVER")) {
2553 PARSE_ERR(
"in flow %i: option %s: unknown socket "
2554 "option or socket option not implemented",
2559 settings->
pushy = 1;
2563 PARSE_ERR(
"in flow %i: option %s requires a value "
2564 "for each given endpoint",
flow_id, opt_string);
2568 if (sscanf(arg,
"%u", &optint) != 1 || optint < 0)
2569 PARSE_ERR(
"in flow %i: option %s needs positive integer",
2575 if ((
signed)optint >
2583 if (sscanf(arg,
"%lf", &optdouble) != 1 || optdouble < 0)
2584 PARSE_ERR(
"in flow %i: option %s needs positive number",
2589 if (sscanf(arg,
"%u", &optint) != 1 || optint < 0)
2590 PARSE_ERR(
"in flow %i: option %s needs positive integer",
2595 if (sscanf(arg,
"%u", &optint) != 1 || optint < 0)
2596 PARSE_ERR(
"in flow %i: option %s needs non-negative number",
2601 if (sscanf(arg,
"%lf", &optdouble) != 1 || optdouble < 0)
2602 PARSE_ERR(
"in flow %i: option %s needs non-negative number",
◆ parse_general_option()
static void parse_general_option |
( |
int |
code, |
|
|
const char * |
arg, |
|
|
const char * |
opt_string |
|
) |
| |
|
static |
Parse general controller options given on the cmdline.
- Parameters
-
[in] | code | the code of the cmdline option |
[in] | arg | the argument string of the cmdline option |
[in] | opt_string | contains the real cmdline option string |
Definition at line 2711 of file flowgrind.c.
2719 if (!arg || !strlen(arg))
2720 usage(EXIT_SUCCESS);
2721 else if (!strcmp(arg,
"socket"))
2723 else if (!strcmp(arg,
"traffic"))
2726 PARSE_ERR(
"invalid argument '%s' for %s", arg, opt_string);
2729 fprintf(stdout,
"%s %s\n%s\n%s\n\n%s\n",
progname,
2749 PARSE_ERR(
"option %s needs a positive number "
2750 "(in seconds)", opt_string);
2764 PARSE_ERR(
"option %s (number of flows) must be within "
2777 if (!strcmp(arg,
"segment"))
2779 else if (!strcmp(arg,
"byte"))
2782 PARSE_ERR(
"invalid argument '%s' for option %s",
◆ parse_host_option()
static void parse_host_option |
( |
const char * |
hostarg, |
|
|
int |
flow_id, |
|
|
int |
endpoint_id |
|
) |
| |
|
static |
Parse argument for option -H, which specifies the endpoints of a flow.
- Parameters
-
[in] | hostarg | argument for option -H in form of HOST[/CONTROL[:PORT]]
- HOST: test address where the actual test connection goes to
- CONTROL: RPC address, where this program connects to
- PORT: port for the control connection
|
[in] | flow_id | ID of flow to apply option to |
[in] | endpoint_id | endpoint to apply option to |
Definition at line 2410 of file flowgrind.c.
2412 struct sockaddr_in6 source_in6;
2413 source_in6.sin6_family = AF_INET6;
2415 bool extra_rpc =
false;
2416 bool is_ipv6 =
false;
2417 char *rpc_address, *url = 0, *sepptr = 0;
2418 char *arg = strdup(hostarg);
2422 sepptr = strchr(arg,
'/');
2425 rpc_address = sepptr + 1;
2432 if (strchr(arg,
':')) {
2433 if (inet_pton(AF_INET6, arg, (
char*)&source_in6.sin6_addr) <= 0)
2434 PARSE_ERR(
"flow %i: invalid IPv6 address '%s' for "
2435 "test connection", flow_id, arg);
2444 if (is_ipv6 && (inet_pton(AF_INET6, rpc_address,
2445 (
char*)&source_in6.sin6_addr) <= 0))
2446 PARSE_ERR(
"flow %i: invalid IPv6 address '%s' for RPC",
2448 if (port < 1 || port > 65535)
2449 PARSE_ERR(
"flow %i: invalid port for RPC", flow_id);
2453 PARSE_ERR(
"flow %i: no test host given in argument", flow_id);
2457 rc = asprintf(&url,
"http://[%s]:%d/RPC2", rpc_address,
port);
2459 rc = asprintf(&url,
"http://%s:%d/RPC2", rpc_address,
port);
2462 critx(
"could not allocate memory for RPC URL");
◆ parse_multi_endpoint_option()
static void parse_multi_endpoint_option |
( |
int |
code, |
|
|
const char * |
arg, |
|
|
const char * |
opt_string, |
|
|
struct ap_Mutex_state |
ms[], |
|
|
int |
argind, |
|
|
int |
flow_id |
|
) |
| |
|
static |
Parse flow options for multiple endpoints.
This iterates through the endpoints given in the argument string (e.g. s=#,d=# or b=#).
- Parameters
-
[in] | code | the code of the cmdline option |
[in] | arg | the argument of the multi-endpoint flow option |
[in] | opt_string | contains the real cmdline option string |
[in] | ms | array of mutex states |
[in] | argind | index of the option |
[in] | flow_id | ID of flow to apply option to |
Definition at line 2838 of file flowgrind.c.
2843 char *argcpy = strdup(arg);
2844 for (
char *token = strtok(argcpy,
","); token;
2845 token = strtok(NULL,
",")) {
2847 char type = token[0];
2850 if (token[1] ==
'=')
2855 if (type !=
's' && type !=
'd' && type !=
'b')
2856 PARSE_ERR(
"Invalid endpoint specifier in Option %s",
2860 if (type ==
's' || type ==
'b') {
2865 if (type ==
'd' || type ==
'b') {
◆ parse_rate_option()
static void parse_rate_option |
( |
const char * |
arg, |
|
|
int |
flow_id, |
|
|
int |
endpoint_id |
|
) |
| |
|
static |
Parse argument for option -R, which specifies the rate the endpoint will send.
- Parameters
-
[in] | arg | argument for option -R in form of #.#(z|k|M|G)(b|B|o) |
[in] | flow_id | ID of flow to apply option to |
[in] | endpoint_id | endpoint to apply option to |
Definition at line 2349 of file flowgrind.c.
2351 char unit = 0, type = 0;
2352 double optdouble = 0.0;
2354 int rc = sscanf(arg,
"%lf%c%c%c",
2355 &optdouble, &unit, &type, &unit);
2356 if (rc < 1 || rc > 4)
2357 PARSE_ERR(
"flow %i: option -R: malformed rate", flow_id);
2359 if (optdouble == 0.0)
2360 PARSE_ERR(
"flow %i: option -R: rate of 0", flow_id);
2381 PARSE_ERR(
"flow %i: option -R: illegal unit specifier", flow_id);
2385 if (type !=
'b' && type !=
'B')
2386 PARSE_ERR(
"flow %i: option -R: illegal type specifier "
2387 "(either 'b' or 'B')", flow_id);
2391 if (optdouble > 5e9)
2392 warnx(
"rate of flow %d too high", flow_id);
◆ parse_trafgen_option()
static void parse_trafgen_option |
( |
const char * |
params, |
|
|
int |
flow_id, |
|
|
int |
endpoint_id |
|
) |
| |
|
static |
Parse option for stochastic traffic generation (option -G).
- Parameters
-
[in] | params | parameter string in the form 'x=(q|p|g):(C|U|E|N|L|P|W):#1:[#2]' |
[in] | flow_id | ID of flow to apply option to |
[in] | endpoint_id | endpoint to apply option to |
Definition at line 2251 of file flowgrind.c.
2254 double param1 = 0, param2 = 0, unused;
2255 char typechar, distchar;
2258 rc = sscanf(params,
"%c:%c:%lf:%lf:%lf", &typechar, &distchar,
2259 ¶m1, ¶m2, &unused);
2260 if (rc != 3 && rc != 4)
2261 PARSE_ERR(
"flow %i: option -G: malformed traffic generation "
2262 "parameters", flow_id);
2267 if (!param1 || !param2)
2268 PARSE_ERR(
"flow %i: option -G: normal distribution "
2269 "needs two non-zero parameters", flow_id);
2273 if (!param1 || !param2)
2274 PARSE_ERR(
"flow %i: option -G: weibull distribution "
2275 "needs two non-zero parameters", flow_id);
2279 if (param1 <= 0 || param2 <= 0 || (param1 > param2))
2280 PARSE_ERR(
"flow %i: option -G: uniform distribution "
2281 "needs two positive parameters", flow_id);
2286 PARSE_ERR(
"flow %i: option -G: exponential distribution "
2287 "needs one positive parameter", flow_id);
2291 if (!param1 || !param2)
2292 PARSE_ERR(
"flow %i: option -G: pareto distribution "
2293 "needs two non-zero parameters", flow_id);
2297 if (!param1 || !param2)
2298 PARSE_ERR(
"flow %i: option -G: lognormal distribution "
2299 "needs two non-zero parameters", flow_id);
2304 PARSE_ERR(
"flow %i: option -G: constant distribution "
2305 "needs one positive parameters", flow_id);
2308 PARSE_ERR(
"flow %i: option -G: syntax error: %c is not a "
2309 "distribution", flow_id, distchar);
2334 cflow[flow_id].settings[*i].maximum_block_size < param1)
2337 cflow[flow_id].settings[*i].maximum_block_size < param2)
◆ prepare_all_flows()
static void prepare_all_flows |
( |
xmlrpc_client * |
rpc_client | ) |
|
|
static |
Prepare test connection for all flows in a test.
- Parameters
-
[in,out] | rpc_client | to connect controller to daemon |
Definition at line 1219 of file flowgrind.c.
◆ prepare_flow()
static void prepare_flow |
( |
int |
id, |
|
|
xmlrpc_client * |
rpc_client |
|
) |
| |
|
static |
Prepare test connection for a flow between source and destination daemons.
Controller sends the flow option to source and destination daemons separately through XML RPC connection and get backs the flow id and snd/rcx buffer size from the daemons.
- Parameters
-
[in] | id | flow id to prepare the test connection in daemons |
[in,out] | rpc_client | to connect controller to daemon |
Definition at line 991 of file flowgrind.c.
993 xmlrpc_value *resultP, *extra_options;
995 int listen_data_port;
996 DEBUG_MSG(LOG_WARNING,
"prepare flow %d destination",
id);
999 extra_options = xmlrpc_array_new(&
rpc_env);
1001 xmlrpc_value *value;
1002 xmlrpc_value *option = xmlrpc_build_value(&
rpc_env,
"{s:i,s:i}",
1004 "optname",
cflow[
id].settings[
DESTINATION].extra_socket_options[i].optname);
1008 xmlrpc_struct_set_value(&
rpc_env, option,
"value", value);
1010 xmlrpc_array_append_item(&
rpc_env, extra_options, option);
1011 xmlrpc_DECREF(value);
1012 xmlrpc_DECREF(option);
1014 xmlrpc_client_call2f(&
rpc_env, rpc_client,
1016 "add_flow_destination", &resultP,
1020 "{s:d,s:d,s:d,s:d,s:d}"
1023 "{s:b,s:b,s:b,s:b,s:b}"
1030 "{s:i,s:i,s:i,s:i,s:i}"
1086 "extra_socket_options", extra_options);
1090 xmlrpc_parse_value(&
rpc_env, resultP,
"{s:i,s:i,s:i,s:i,*}",
1092 "listen_data_port", &listen_data_port,
1098 xmlrpc_DECREF(resultP);
1101 extra_options = xmlrpc_array_new(&
rpc_env);
1104 xmlrpc_value *value;
1105 xmlrpc_value *option = xmlrpc_build_value(&
rpc_env,
"{s:i,s:i}",
1106 "level",
cflow[
id].settings[
SOURCE].extra_socket_options[i].level,
1107 "optname",
cflow[
id].settings[
SOURCE].extra_socket_options[i].optname);
1109 value = xmlrpc_base64_new(&
rpc_env,
cflow[
id].settings[
SOURCE].extra_socket_options[i].optlen, (
unsigned char*)
cflow[
id].settings[
SOURCE].extra_socket_options[i].optval);
1111 xmlrpc_struct_set_value(&
rpc_env, option,
"value", value);
1113 xmlrpc_array_append_item(&
rpc_env, extra_options, option);
1114 xmlrpc_DECREF(value);
1115 xmlrpc_DECREF(option);
1117 DEBUG_MSG(LOG_WARNING,
"prepare flow %d source",
id);
1119 xmlrpc_client_call2f(&
rpc_env, rpc_client,
1121 "add_flow_source", &resultP,
1125 "{s:d,s:d,s:d,s:d,s:d}"
1128 "{s:b,s:b,s:b,s:b,s:b}"
1135 "{s:i,s:i,s:i,s:i,s:i}"
1193 "extra_socket_options", extra_options,
1197 "destination_port", listen_data_port,
1201 xmlrpc_DECREF(extra_options);
1203 xmlrpc_parse_value(&
rpc_env, resultP,
"{s:i,s:i,s:i,*}",
1210 xmlrpc_DECREF(resultP);
1211 DEBUG_MSG(LOG_WARNING,
"prepare flow %d completed",
id);
◆ prepare_xmlrpc_client()
static void prepare_xmlrpc_client |
( |
xmlrpc_client ** |
rpc_client | ) |
|
|
static |
Definition at line 615 of file flowgrind.c.
617 struct xmlrpc_clientparms clientParms;
618 size_t clientParms_cpsize = XMLRPC_CPSIZE(transport);
623 #ifdef HAVE_STRUCT_XMLRPC_CURL_XPORTPARMS_DONT_ADVERTISE
624 struct xmlrpc_curl_xportparms curlParms;
625 memset(&curlParms, 0,
sizeof(curlParms));
627 curlParms.dont_advertise = 1;
628 clientParms.transportparmsP = &curlParms;
629 clientParms.transportparm_size = XMLRPC_CXPSIZE(dont_advertise);
630 clientParms_cpsize = XMLRPC_CPSIZE(transportparm_size);
635 clientParms.transport =
"curl";
637 DEBUG_MSG(LOG_WARNING,
"prepare xmlrpc client");
638 xmlrpc_client_create(&
rpc_env, XMLRPC_CLIENT_NO_FLAGS,
"Flowgrind",
640 clientParms_cpsize, rpc_client);
◆ print_all_final_reports()
static void print_all_final_reports |
( |
void |
| ) |
|
|
static |
Print final report (i.e.
summary line) for all configured flows.
Definition at line 2176 of file flowgrind.c.
2182 free(
cflow[
id].final_report[*i]);
◆ print_column()
static bool print_column |
( |
char ** |
header1, |
|
|
char ** |
header2, |
|
|
char ** |
data, |
|
|
enum column_id |
column_id, |
|
|
double |
value, |
|
|
unsigned |
accuracy |
|
) |
| |
|
static |
Append measured data for interval report column column_id
to given strings.
For the intermediated interval report column column_id
, append measured data value
to the destination data string data
, and the name and unit of intermediated interval column header to header1
and header2
.
- Parameters
-
[in,out] | header1 | 1st header string (name) to append to |
[in,out] | header2 | 2nd header string (unit) to append to |
[in,out] | data | data value string to append to |
[in] | column_id | ID of intermediated interval report column |
[in] | value | measured data value to be append |
[in] | accuracy | number of decimal places to be append |
- Returns
- true if column width has changed, false otherwise
Definition at line 1711 of file flowgrind.c.
1717 switch ((
int)value) {
1737 unsigned data_len =
det_num_digits(value) + (accuracy ? accuracy + 1 : 0);
1740 unsigned column_width = MAX(data_len, header_len);
1746 char *fmt_num = NULL, *fmt_str = NULL;
1748 if (asprintf(&fmt_num,
"%%%zu.%df", width +
GUARDBAND, accuracy) == -1 ||
1749 asprintf(&fmt_str,
"%%%zus", width +
GUARDBAND) == -1)
1750 critx(
"could not allocate memory for interval report");
◆ print_column_str()
static bool print_column_str |
( |
char ** |
header1, |
|
|
char ** |
header2, |
|
|
char ** |
data, |
|
|
enum column_id |
column_id, |
|
|
char * |
value |
|
) |
| |
|
static |
Append measured data for interval report column column_id
to given strings.
For the intermediated interval report column column_id
, append measured data value
to the destination data string data
, and the name and unit of intermediated interval column header to header1
and header2
.
- Parameters
-
[in,out] | header1 | 1st header string (name) to append to |
[in,out] | header2 | 2nd header string (unit) to append to |
[in,out] | data | data value string to append to |
[in] | column_id | ID of intermediated interval report column |
[in] | value | measured data string to be append |
- Returns
- true if column width has changed, false otherwise
Definition at line 1663 of file flowgrind.c.
1673 unsigned data_len = strlen(value);
1676 unsigned column_width = MAX(data_len, header_len);
1682 char *fmt_str = NULL;
1684 if (asprintf(&fmt_str,
"%%%zus", width +
GUARDBAND) == -1)
1685 critx(
"could not allocate memory for interval report");
◆ print_final_report()
static void print_final_report |
( |
unsigned short |
flow_id, |
|
|
enum endpoint_t |
e |
|
) |
| |
|
static |
Print final report (i.e.
summary line) for endpoint e
of flow flow_id
.
- Parameters
-
[in] | flow_id | flow a final report will be created for |
[in] | e | flow endpoint (SOURCE or DESTINATION) |
Definition at line 2002 of file flowgrind.c.
2013 if (asprintf(&buf,
"# ID %3d %s: ", flow_id, e ?
"D" :
"S") == -1)
2014 critx(
"could not allocate memory for final report");;
2042 endpoint->receive_buffer_size_real,
2061 double delta_write = 0.0, delta_read = 0.0;
2070 double real_write = settings->
duration[
WRITE] + delta_write;
2071 double real_read = settings->
duration[
READ] + delta_read;
2085 if (isnan(thruput_read))
2087 if (isnan(thruput_write))
2088 thruput_write = 0.0;
2095 thruput_write, thruput_read);
2098 thruput_write, thruput_read);
2153 if (settings->
pushy)
2163 if (
cflow[flow_id].late_connect)
2165 if (
cflow[flow_id].shutdown)
◆ print_headline()
static void print_headline |
( |
void |
| ) |
|
|
static |
Print headline with various informations before the actual measurement will be begin.
Definition at line 931 of file flowgrind.c.
936 print_output(
"# Date: %s, controlling host = %s, number of flows = %d, "
937 "reporting interval = %.2fs, [through] = %s (%s)\n",
938 ctimenow(
false), (rc == -1 ?
"(unknown)" : me.nodename),
940 (
copt.
mbyte ?
"2**20 bytes/second":
"10**6 bit/second"),
944 bool involved_os[] = {[0 ...
NUM_OSes-1] =
false};
950 involved_os[
LINUX] =
true;
954 involved_os[
DARWIN] =
true;
958 if (!involved_os[
LINUX])
970 struct daemon *daemon_firstnode = firstnode->
data;
974 strcmp(daemon_firstnode->
os_name,
"Linux")))
◆ print_interval_report()
static void print_interval_report |
( |
unsigned short |
flow_id, |
|
|
enum endpoint_t |
e, |
|
|
struct report * |
report |
|
) |
| |
|
static |
Print interval report report
for endpoint e
of flow flow_id
.
In addition, if the width of one intermediated interval report columns has been changed, the interval column header will be printed again.
- Parameters
-
[in] | flow_id | flow an interval report will be created for |
[in] | e | flow endpoint (SOURCE or DESTINATION) |
[in] | report | interval report to be printed |
Definition at line 1771 of file flowgrind.c.
1775 bool changed =
false;
1777 char *header1 = NULL, *header2 = NULL, *data = NULL;
1782 asprintf(&data,
"%s%3d", e ?
"D" :
"S", flow_id) == -1)
1783 critx(
"could not allocate memory for interval report");
1786 double diff_first_last =
time_diff(&
cflow[flow_id].start_timestamp[e],
1788 double diff_first_now =
time_diff(&
cflow[flow_id].start_timestamp[e],
1791 diff_first_last, 3);
1797 (diff_first_now - diff_first_last);
1804 (diff_first_now - diff_first_last);
1815 double rtt_avg = 0.0;
1829 double iat_avg = 0.0;
1843 double delay_avg = 0.0;
1852 delay_avg * 1e3, 3);
1885 char *ca_state = NULL;
1890 case TCP_CA_Disorder:
1891 ca_state =
"disorder";
1896 case TCP_CA_Recovery:
1897 ca_state =
"recover";
1903 ca_state =
"unknown";
1917 char *fg_state = NULL;
1918 if (
cflow[flow_id].finished[e]) {
1919 rc = asprintf(&fg_state,
"(stopped)");
1923 if (ws !=
'd' || ws !=
'l' || ws !=
'o' || ws !=
'f' ||
1924 ws !=
'c' || ws !=
'n')
1929 if (rs !=
'd' || rs !=
'l' || rs !=
'o' || rs !=
'f' ||
1930 rs !=
'c' || rs !=
'n')
1932 rc = asprintf(&fg_state,
"(%c/%c)", ws, rs);
1936 critx(
"could not allocate memory for flowgrind status string");
1946 static unsigned short printed_reports = 0;
◆ print_output()
static void print_output |
( |
const char * |
fmt, |
|
|
|
... |
|
) |
| |
|
inlinestatic |
Print measurement output to logfile and / or to stdout.
- Parameters
-
[in] | fmt | format string |
[in] | ... | parameters used to fill fmt |
Definition at line 592 of file flowgrind.c.
◆ report_flow()
static void report_flow |
( |
struct report * |
report | ) |
|
|
static |
Reports are fetched from the flow endpoint daemon.
Single daemon can maintain multiple flows endpoints and daemons combine all it flows report and send the controller. So controller give the flow ID to daemons, while prepare the flow.Controller flow ID is maintained by the daemons to maintain its flow endpoints.So When getting back the reports from the daemons, the controller use those flow ID registered for the daemon in the prepare flow as reference to distinguish the report
. The daemon also send back the details regarding flow endpoints i.e. source or destination. So this information is also used by the daemons to distinguish the report in the report flow.
- Parameters
-
[in] | report | report from the daemon |
- Todo:
- Maybe just use compare daemon pointers?
Definition at line 1487 of file flowgrind.c.
1491 struct cflow *f = NULL;
1501 goto exit_outer_loop;
1509 DEBUG_MSG(LOG_DEBUG,
"received final report for flow %d",
id);
1519 DEBUG_MSG(LOG_DEBUG,
"remaining active flows: "
◆ sanity_check()
static void sanity_check |
( |
void |
| ) |
|
|
static |
Sanity checking flow options.
Definition at line 3062 of file flowgrind.c.
3065 DEBUG_MSG(LOG_DEBUG,
"sanity checking parameter set of flow %d",
id);
3070 errx(
"server flow %d starts earlier than client "
3071 "flow while late connecting",
id);
3076 errx(
"client flow %d has a delay but no runtime",
id);
3081 errx(
"server flow %d has a delay but no runtime",
id);
3086 errx(
"server and client flow have both zero runtime "
3094 errx(
"flow %d has flow control enabled but no "
3102 errx(
"client block size for flow %u is too big for "
3103 "specified rate",
id);
3107 DEBUG_MSG(LOG_DEBUG,
"sanity check parameter set of flow %d completed",
id);
◆ scale_thruput()
static double scale_thruput |
( |
double |
thruput | ) |
|
|
inlinestatic |
Scale the given throughput thruput
in either Mebibyte per seconds or in Megabits per seconds.
- Parameters
-
[in] | thruput | throughput in byte per seconds |
- Returns
- scaled throughput in MiB/s or Mb/s
Definition at line 1606 of file flowgrind.c.
1609 return thruput / (1<<20);
1610 return thruput / 1e6 * (1<<3);
◆ set_column_unit()
static void set_column_unit |
( |
const char * |
unit, |
|
|
unsigned |
nargs, |
|
|
|
... |
|
) |
| |
|
static |
To set the unit the in header of intermediated interval report columns.
- Parameters
-
[in] | unit | unit of column header as string |
[in] | nargs | length of variable argument list |
[in] | ... | column IDs |
- See also
- enum column_id
Definition at line 914 of file flowgrind.c.
◆ set_column_visibility()
static void set_column_visibility |
( |
bool |
visibility, |
|
|
unsigned |
nargs, |
|
|
|
... |
|
) |
| |
|
static |
To show/hide intermediated interval report columns.
- Parameters
-
[in] | visibility | show/hide column |
[in] | nargs | length of variable argument list |
[in] | ... | column IDs |
- See also
- enum column_id
Definition at line 893 of file flowgrind.c.
◆ set_flow_endpoint_daemon()
static void set_flow_endpoint_daemon |
( |
const char * |
server_uuid, |
|
|
char * |
server_url |
|
) |
| |
|
static |
Set the daemon for controller flow endpoint.
- Parameters
-
[in,out] | server_uuid | UUID from daemons |
[in,out] | daemon_url | URL from daemons |
Definition at line 779 of file flowgrind.c.
◆ set_rpc_info()
static struct rpc_info* set_rpc_info |
( |
const char * |
server_url, |
|
|
const char * |
server_name, |
|
|
unsigned short |
server_port |
|
) |
| |
|
static |
Set the flow endpoint XML RPC data for a given server_url.
- Parameters
-
[in] | XML-RPC | connection url |
[in] | server_name | flow endpoints IP address |
[in] | server_port | controller - daemon XML-RPC connection port Nr |
- Returns
- rpc_info flow endpoint XML RPC structure data
Definition at line 2224 of file flowgrind.c.
2238 return flow_rpc_info;
◆ set_unique_daemon_by_uuid()
static struct daemon* set_unique_daemon_by_uuid |
( |
const char * |
server_uuid, |
|
|
char * |
daemon_url |
|
) |
| |
|
static |
Determine the daemons for controller flow by UUID.
Determine the daemons memory block size by number of server in the controller flow option.
- Parameters
-
[in,out] | server_uuid | UUID from daemons |
[in,out] | daemon_url | URL from daemons |
Definition at line 747 of file flowgrind.c.
◆ sighandler()
static void sighandler |
( |
int |
sig | ) |
|
|
static |
Signal handler to catching signals.
- Parameters
-
Definition at line 448 of file flowgrind.c.
452 DEBUG_MSG(LOG_ERR,
"caught %s", strsignal(sig));
455 warnx(
"caught SIGINT, trying to gracefully close flows. "
456 "Press CTRL+C again to force termination \n");
◆ start_all_flows()
static void start_all_flows |
( |
xmlrpc_client * |
rpc_client | ) |
|
|
static |
Start test connections for all flows in a test.
All the test connection are started, but test connection flow in the controller and in daemon are different. In the controller, test connection are respective to number of flows in a test,but in daemons test connection are respective to flow endpoints. Single daemons can maintain multiple flows endpoints, So controller should start a daemon only once.
- Parameters
-
[in,out] | rpc_client | to connect controller to daemon |
Definition at line 1240 of file flowgrind.c.
1242 xmlrpc_value * resultP = 0;
1244 struct timespec lastreport_end;
1245 struct timespec lastreport_begin;
1246 struct timespec now;
1260 xmlrpc_client_call2f(&
rpc_env, rpc_client,
1262 "start_flows", &resultP,
"({s:i})",
1263 "start_timestamp", now.tv_sec + 2);
1266 xmlrpc_DECREF(resultP);
◆ update_column_width()
static bool update_column_width |
( |
struct column * |
column, |
|
|
unsigned |
column_width |
|
) |
| |
|
static |
Determines if the current column width column_width
is larger or smaller than the old one and updates the state of column column
accordingly.
- Parameters
-
[in,out] | column | column that state to be updated |
[in] | column_width | current column width |
- Returns
- true if column state has been updated, false otherwise
Definition at line 1621 of file flowgrind.c.
1624 bool has_changed =
false;
◆ usage()
static void usage |
( |
short |
status | ) |
|
|
static |
◆ usage_sockopt()
static void usage_sockopt |
( |
void |
| ) |
|
|
static |
Print usage or error message and exit.
Print help on flowgrind's socket options and exit with EXIT_SUCCESS.
Depending on exit status status
print either the usage or an error message. In all cases it call exit() with the given exit status status
.
- Parameters
-
Definition at line 206 of file flowgrind.c.
228 if (status != EXIT_SUCCESS) {
229 fprintf(stderr,
"Try '%s -h' for more information\n",
progname);
234 "Usage: %1$s [OPTION]...\n"
235 "Advanced TCP traffic generator for Linux, FreeBSD, and Mac OS X.\n\n"
237 "Mandatory arguments to long options are mandatory for short options too.\n\n"
240 " -h, --help[=WHAT]\n"
241 " display help and exit. Optional WHAT can either be 'socket' for\n"
242 " help on socket options or 'traffic' traffic generation help\n"
243 " -v, --version print version information and exit\n\n"
245 "Controller options:\n"
246 " -c, --show-colon=TYPE[,TYPE]...\n"
247 " display intermediated interval report column TYPE in output.\n"
248 " Allowed values for TYPE are: 'interval', 'through', 'transac',\n"
249 " 'iat', 'kernel' (all show per default), and 'blocks', 'rtt',\n"
251 " 'delay', 'status' (optional)\n"
253 " 'delay' (optional)\n"
256 " -d, --debug increase debugging verbosity. Add option multiple times to\n"
257 " increase the verbosity\n"
259 " -e, --dump-prefix=PRE\n"
260 " prepend prefix PRE to pcap dump filename (default: \"%3$s\")\n"
261 " -i, --report-interval=#.#\n"
262 " reporting interval, in seconds (default: 0.05s)\n"
263 " --log-file[=FILE]\n"
264 " write output to logfile FILE (default: %1$s-'timestamp'.log)\n"
265 " -m report throughput in 2**20 bytes/s (default: 10**6 bit/s)\n"
266 " -n, --flows=# number of test flows (default: 1)\n"
267 " -o overwrite existing log files (default: don't)\n"
268 " -p don't print symbolic values (like INT_MAX) instead of numbers\n"
269 " -q, --quiet be quiet, do not log to screen (default: off)\n"
270 " -s, --tcp-stack=TYPE\n"
271 " don't determine unit of source TCP stacks automatically. Force\n"
272 " unit to TYPE, where TYPE is 'segment' or 'byte'\n"
273 " -w write output to logfile (same as --log-file)\n\n"
276 " Some of these options take the flow endpoint as argument, denoted by 'x' in\n"
277 " the option syntax. 'x' needs to be replaced with either 's' for the source\n"
278 " endpoint, 'd' for the destination endpoint or 'b' for both endpoints. To\n"
279 " specify different values for each endpoints, separate them by comma. For\n"
280 " instance -W s=8192,d=4096 sets the advertised window to 8192 at the source\n"
281 " and 4096 at the destination.\n\n"
282 " -A x use minimal response size needed for RTT calculation\n"
283 " (same as -G s=p,C,%2$d)\n"
284 " -B x=# set requested sending buffer, in bytes\n"
285 " -C x stop flow if it is experiencing local congestion\n"
286 " -D x=DSCP DSCP value for TOS byte\n"
287 " -E enumerate bytes in payload instead of sending zeros\n"
288 " -F #[,#]... flow options following this option apply only to the given flow \n"
289 " IDs. Useful in combination with -n to set specific options\n"
290 " for certain flows. Numbering starts with 0, so -F 1 refers\n"
291 " to the second flow. With -1 all flow are refered\n"
293 " -G x=(q|p|g):(C|U|E|N|L|P|W):#1:[#2]\n"
295 " -G x=(q|p|g):(C|U):#1:[#2]\n"
297 " activate stochastic traffic generation and set parameters\n"
298 " according to the used distribution. For additional information \n"
299 " see 'flowgrind --help=traffic'\n"
300 " -H x=HOST[/CONTROL[:PORT]]\n"
301 " test from/to HOST. Optional argument is the address and port\n"
302 " for the CONTROL connection to the same host.\n"
303 " An endpoint that isn't specified is assumed to be localhost\n"
304 " -J # use random seed # (default: read /dev/urandom)\n"
305 " -I enable one-way delay calculation (no clock synchronization)\n"
306 " -L call connect() on test socket immediately before starting to\n"
307 " send data (late connect). If not specified the test connection\n"
308 " is established in the preparation phase before the test starts\n"
309 " -M x dump traffic using libpcap. flowgrindd must be run as root\n"
310 " -N shutdown() each socket direction after test flow\n"
311 " -O x=OPT set socket option OPT on test socket. For additional information\n"
312 " see 'flowgrind --help=socket'\n"
313 " -P x do not iterate through select() to continue sending in case\n"
314 " block size did not suffice to fill sending queue (pushy)\n"
315 " -Q summarize only, no intermediated interval reports are\n"
316 " computed (quiet)\n"
317 " -R x=#.#(z|k|M|G)(b|B)\n"
318 " send at specified rate per second, where: z = 2**0, k = 2**10,\n"
319 " M = 2**20, G = 2**30, and b = bits/s (default), B = bytes/s\n"
320 " -S x=# set block (message) size, in bytes (same as -G s=q,C,#)\n"
321 " -T x=#.# set flow duration, in seconds (default: s=10,d=0)\n"
322 " -U x=# set application buffer size, in bytes (default: 8192)\n"
323 " truncates values if used with stochastic traffic generation\n"
324 " -W x=# set requested receiver buffer (advertised window), in bytes\n"
325 " -Y x=#.# set initial delay before the host starts to send, in seconds\n"
◆ usage_trafgenopt()
static void usage_trafgenopt |
( |
void |
| ) |
|
|
static |
Print help on flowgrind's traffic generation facilities and exit with EXIT_SUCCESS.
Definition at line 383 of file flowgrind.c.
386 "%s supports stochastic traffic generation, which allows to conduct\n"
387 "besides normal bulk also advanced rate-limited and request-response data\n"
390 "The stochastic traffic generation option '-G' takes the flow endpoint as\n"
391 "argument, denoted by 'x' in the option syntax. 'x' needs to be replaced with\n"
392 "either 's' for the source endpoint, 'd' for the destination endpoint or 'b' for\n"
393 "both endpoints. However, please note that bidirectional traffic generation can\n"
394 "lead to unexpected results. To specify different values for each endpoints,\n"
395 "separate them by comma.\n\n"
397 "Stochastic traffic generation:\n"
399 " -G x=(q|p|g):(C|U|E|N|L|P|W):#1:[#2]\n"
401 " -G x=(q|p|g):(C|U):#1:[#2]\n"
404 " q = request size (in bytes)\n"
405 " p = response size (in bytes)\n"
406 " g = request interpacket gap (in seconds)\n\n"
409 " C = constant (#1: value, #2: not used)\n"
410 " U = uniform (#1: min, #2: max)\n"
412 " E = exponential (#1: lamba - lifetime, #2: not used)\n"
413 " N = normal (#1: mu - mean value, #2: sigma_square - variance)\n"
414 " L = lognormal (#1: zeta - mean, #2: sigma - std dev)\n"
415 " P = pareto (#1: k - shape, #2 x_min - scale)\n"
416 " W = weibull (#1: lambda - scale, #2: k - shape)\n"
418 " advanced distributions are only available if compiled with libgsl\n"
420 " -U x=# specify a cap for the calculated values for request and response\n"
421 " size (not needed for constant values or uniform distribution),\n"
422 " values over this cap are recalculated\n\n"
426 " use contant request size of 40 bytes\n"
427 " -G s=p:N:2000:50\n"
428 " use normal distributed response size with mean 2000 bytes and\n"
430 " -G s=g:U:0.005:0.01\n"
431 " use uniform distributed interpacket gap with minimum 0.005s and\n"
435 " - The man page contains more explained examples\n"
436 " - Using bidirectional traffic generation can lead to unexpected results\n"
437 " - Usage of -G in conjunction with -A, -R, -S is not recommended, as they\n"
438 " overwrite each other. -A, -R and -S exist as shortcut only\n",
◆ active_flows
unsigned short active_flows = 0 |
|
static |
Number of currently active flows.
Definition at line 125 of file flowgrind.c.
◆ cflow
Infos about all flows including flow options.
Definition at line 119 of file flowgrind.c.
◆ column_info
Infos about the intermediated interval report columns.
Definition at line 131 of file flowgrind.c.
◆ copt
◆ flows_rpc_info
Global linked list to the flow endpoints XML RPC connection information.
Definition at line 107 of file flowgrind.c.
◆ log_filename
char* log_filename = NULL |
|
static |
◆ log_stream
Logfile for measurement output.
Definition at line 95 of file flowgrind.c.
◆ parser
Command line option parser.
Definition at line 113 of file flowgrind.c.
◆ progname
String containing name the program is called with.
Definition at line 35 of file fg_progname.c.
◆ rpc_env
◆ sigint_caught
bool sigint_caught = false |
|
static |
◆ unique_daemons
Global linked list to the daemons containing UUID and daemons flowgrind version.
Definition at line 110 of file flowgrind.c.
@ UNIFORM
Uniform distribution.
#define DEBUG_MSG(LVL, MSG,...)
Print debug message to standard error.
char byte_counting
Enumerate bytes in payload instead of sending zeros (option -E).
static void set_flow_endpoint_daemon(const char *server_uuid, char *server_url)
Set the daemon for controller flow endpoint.
static void parse_multi_endpoint_option(int code, const char *arg, const char *opt_string, struct ap_Mutex_state ms[], int argind, int flow_id)
Parse flow options for multiple endpoints.
static void print_final_report(unsigned short flow_id, enum endpoint_t e)
Print final report (i.e.
@ COL_TCP_LOST
Metric from the Linux / BSD TCP stack.
bool mbyte
Report in MByte/s instead of MBit/s (option -m).
@ COL_BLOCK_REQU
Blocks per second.
@ MUTEX_CONTEXT_DESTINATION
Context for flow options on destination side.
#define ASSIGN_MAX(s, c)
Assign value if it's greater than current one.
static struct linked_list unique_daemons
Global linked list to the daemons containing UUID and daemons flowgrind version.
@ MUTEX_CONTEXT_CONTROLLER
Context for controller options.
static struct daemon * add_daemon_by_uuid(const char *server_uuid, char *daemon_url)
Add daemon for controller flow by UUID.
enum distribution_t distribution
The stochastic distribution to draw values from.
static bool print_column_str(char **header1, char **header2, char **data, enum column_id column_id, char *value)
Append measured data for interval report column column_id to given strings.
const struct ap_Option * ap_option(const struct arg_parser *const ap, const int i)
Get the user-defined option for a given record position.
#define MAX_EXTRA_SOCKET_OPTIONS
Max number of arbitrary extra socket options which may sent to the deamon.
static void usage(short status) __attribute__((noreturn))
@ COL_IAT_AVG
Application level inter-arrival time.
size_t fg_list_size(struct linked_list *const list)
Returns the number of elements in the list.
double rtt_max
Maximum round-trip time.
int ap_code(const struct arg_parser *const ap, const int i)
Returns the code of a parsed option with given index.
char shutdown
shutdown() each socket direction after test flow (option (-N).
double time_diff(const struct timespec *tp1, const struct timespec *tp2)
Returns the time difference between two the specific points in time tp1 and tp2.
const char * ap_argument(const struct arg_parser *const ap, const int i)
Returns the argument of a parsed option.
const char * ap_error(const struct arg_parser *const ap)
Get the string containing errors encountered during parsing.
#define HIDE_COLUMNS(...)
To hide intermediated interval report columns.
double rtt_sum
Accumulated round-trip time.
#define MAX_EXTRA_SOCKET_OPTION_VALUE_LENGTH
Ensures extra options are limited in length on both controller and deamon.
static void parse_rate_option(const char *arg, int flow_id, int endpoint_id)
Parse argument for option -R, which specifies the rate the endpoint will send.
Intermediated interval report column.
static void print_headline(void)
Print headline with various informations before the actual measurement will be begin.
static void fetch_reports(xmlrpc_client *rpc_client)
Reports are fetched from the flow endpoint daemon.
bool log_to_stdout
Write output to screen (option -q).
#define crit(...)
To report an critical error w/ the corresponding system error message.
#define FLOWGRIND_COPYRIGHT
Flowgrind's copyright year.
static void parse_flow_option_endpoint(int code, const char *arg, const char *opt_string, int flow_id, int endpoint_id)
Parse flow options with endpoint.
static void check_version(xmlrpc_client *rpc_client)
Checks all the daemons flowgrind version.
int dscp
DSCP value for TOS byte (option -D).
static void parse_general_option(int code, const char *arg, const char *opt_string)
Parse general controller options given on the cmdline.
static void prepare_all_flows(xmlrpc_client *rpc_client)
Prepare test connection for all flows in a test.
int requested_read_buffer_size
Request receiver buffer, advertised window in bytes (option -W).
double delay_max
Maximum one-way delay.
struct flow_settings settings[2]
Flow specific options.
static struct arg_parser parser
Command line option parser.
struct report * final_report[2]
Final report from the daemon.
unsigned request_blocks_written
@ COL_TCP_UACK
Metric from the Linux / BSD TCP stack.
const char * name
First header row: name of the column.
static char * guess_topology(unsigned mtu)
Maps common MTU sizes to network known technologies.
void logging(int priority, const char *fmt,...)
@ LOG_FILE_OPTION
Pseudo short option for option –log-file.
unsigned long long bytes_read
@ COL_STATUS
Read / write status.
double iat_sum
Accumulated inter-arrival time.
struct flow_settings::extra_socket_options extra_socket_options[MAX_EXTRA_SOCKET_OPTIONS]
static char * log_filename
Name of logfile.
static struct rpc_info * set_rpc_info(const char *server_url, const char *server_name, unsigned short server_port)
Set the flow endpoint XML RPC data for a given server_url.
@ COL_TCP_TRET
Metric from the Linux / BSD TCP stack.
@ COL_IAT_MAX
Application level inter-arrival time.
static void usage_sockopt(void)
Print usage or error message and exit.
#define UNUSED_ARGUMENT(x)
Suppress warning for unused argument.
@ COL_RTT_MIN
Application level round-trip time.
@ COL_RTT_AVG
Application level round-trip time.
@ DESTINATION
Endpoint that accepts the connection.
@ ap_no
Option without argument (flag).
double duration[2]
Duration of flow in seconds (option -T).
#define MAX_FLOWS_CONTROLLER
Maximal number of parallel flows supported by one controller.
void ap_reset_mutex(struct ap_Mutex_state *const ms)
Reset a mutex context.
#define warnx(...)
To report a warning w/ a system error message.
static bool sigint_caught
SIGINT (CTRL-C) received?
int cork
Sets SO_DEBUG on test socket (option -O).
@ COL_TCP_RTTVAR
Metric from the Linux / BSD TCP stack.
@ COL_TCP_REOR
Metric from the Linux / BSD TCP stack.
@ COL_THROUGH
Throughput per seconds.
static struct column column_info[]
Infos about the intermediated interval report columns.
double delay_min
Minimum one-way delay.
@ PARETO
Pareto distribution.
char test_address[1000]
network address where the actual test connection goes to.
double param_two
Second mathematical parameter of the distribution, if required.
void * data
Pointer to user defined data stored with this node.
char cc_alg[TCP_CA_NAME_MAX]
Set congestion control algorithm ALG on test socket (option -O).
int receive_buffer_size_real
Receiver buffer (SO_RCVBUF).
struct trafgen_options response_trafgen_options
Stochastic traffic generation settings for the response size.
char summarize_only
Summarize only, no intermediated interval reports (option -Q).
static void die_if_fault_occurred(xmlrpc_env *env)
Infos about a flowgrind daemon.
struct rpc_info * rpc_info
Pointer to manage flow endpoint XMLRPC information.
int endpoint_id[2]
ID used internally by the deamon to distinguish its flows.
static void sanity_check(void)
Sanity checking flow options.
int api_version
Flowgrind API version supported by this daemon.
struct trafgen_options interpacket_gap_trafgen_options
Stochastic traffic generation settings for the interpacket gap.
static void print_interval_report(unsigned short flow_id, enum endpoint_t e, struct report *report)
Print interval report report for endpoint e of flow flow_id.
static void find_daemon(xmlrpc_client *rpc_client)
Checks all daemons in flow option.
@ OPT_FLOW_ENDPOINT
Flow option with endpoint string.
@ COL_BLOCK_RESP
Blocks per second.
static struct controller_options copt
Controller options.
char uuid[38]
UUID of the daemon.
@ ap_yes
Argument required.
struct column_state state
State of the column.
double time_diff_now(const struct timespec *tp)
Returns time difference between now and the specific point in time tp.
unsigned oversized
How often the current column width was too high.
Contains the state of all mutex.
int traffic_dump
Dump traffic using libpcap (option -M).
@ COL_TCP_SSTH
Metric from the Linux / BSD TCP stack.
distribution_t
Stochastic distributions for traffic generation.
int ipmtudiscover
Set IP_MTU_DISCOVER on test socket (option -O).
Infos about the flow endpoint.
static void init_controller_options(void)
Initialization of general controller options.
@ OPT_SELECTOR
Selects a subset of flows to apply options to (-F).
@ COL_TCP_RETR
Metric from the Linux / BSD TCP stack.
char late_connect
Call connect() immediately before sending data (option -L).
static bool print_column(char **header1, char **header2, char **data, enum column_id column_id, double value, unsigned accuracy)
Append measured data for interval report column column_id to given strings.
static void parse_cmdline(int argc, char *argv[])
The main commandline argument parsing function.
@ COL_IAT_MIN
Application level inter-arrival time.
double reporting_interval
Length of reporting interval, in seconds (option -i).
int maximum_block_size
Application buffer size in bytes (option -U).
void increase_debuglevel()
Decrease debug level.
@ LOGNORMAL
Log Normal distribution.
@ OPT_FLOW
Flow option without endpoint string.
int flow_control
Stop flow if it is experiencing local congestion (option -C).
@ COL_SMSS
Metric from the Linux / BSD TCP stack.
@ CONSTANT
No stochastic distribution.
@ COL_BEGIN
Report interval.
bool ap_set_check_mutex(const struct arg_parser *const ap, struct ap_Mutex_state *const ms, const int i, int *conflict)
Check a new option record for mutex and register it at the same time.
int flow_id
Flow ID maintained by controller.
static void print_output(const char *fmt,...)
Print measurement output to logfile and / or to stdout.
int send_buffer_size_real
Sending buffer (SO_SNDBUF).
static void report_flow(struct report *report)
Reports are fetched from the flow endpoint daemon.
struct timespec start_timestamp[2]
Timestamp set just before starting flow.
static void parse_flow_option(int code, const char *arg, const char *opt_string, int flow_id)
Parse flow options without endpoint.
unsigned random_seed
Random seed for stochastic traffic generation (option -J).
#define errx(...)
To report an error w/o a system error message.
@ WEIBULL
Weibull distribution.
double iat_max
Maximum inter-arrival time.
static void prepare_flow(int id, xmlrpc_client *rpc_client)
Prepare test connection for a flow between source and destination daemons.
static bool update_column_width(struct column *column, unsigned column_width)
Determines if the current column width column_width is larger or smaller than the old one and updates...
static void close_logfile(void)
Close measurement output file.
@ MUTEX_CONTEXT_SOURCE
Context for flow options on source side.
char server_name[257]
Name of the XMLRPC server.
void ap_free(struct arg_parser *const ap)
Free internal state of arg-parser.
int tag
User tag for distinction of options.
int num_extra_socket_options
static void sighandler(int sig)
Signal handler to catching signals.
int pushy
Do not iterate through select() to continue sending in case block size did not suffice to fill sendin...
#define FLOWGRIND_COPYING
Standard GPL3 no warranty message.
#define critx(...)
To report an critical error w/o a system error message.
#define unlikely(x)
These macros gain us a few percent of speed.
int nonagle
Disable nagle algorithm on test socket (option -O).
static void parse_host_option(const char *hostarg, int flow_id, int endpoint_id)
Parse argument for option -H, which specifies the endpoints of a flow.
#define SHOW_COLUMNS(...)
To show intermediated interval report columns.
int fg_list_clear(struct linked_list *const list)
Removes and destroys all elements from the list, leaving it with a size of 0.
#define MIN_BLOCK_SIZE
Minium block (message) size we can send.
@ COL_END
Report interval.
char os_release[257]
Release number of the OS.
#define FLOWGRIND_AUTHORS
Flowgrind's authors in a printable string.
bool symbolic
Don't use symbolic values instead of number (option -p).
static void usage_trafgenopt(void)
Print help on flowgrind's traffic generation facilities and exit with EXIT_SUCCESS.
enum protocol_t proto
Used transport protocol.
int ap_arguments(const struct arg_parser *const ap)
Number of arguments parsed (may be different from argc).
unsigned long long bytes_written
void ap_free_mutex_state(struct ap_Mutex_state *const ms)
Free a mutex context.
int write_rate
The actual rate we should send.
static xmlrpc_env rpc_env
static void prepare_xmlrpc_client(xmlrpc_client **rpc_client)
@ SOURCE
Endpoint that opens the connection.
int elcn
Set TCP_ELCN (20) on test socket (option -O).
unsigned short num_flows
Number of test flows (option -n).
@ OPT_CONTROLLER
General controller options.
Defines a valid command line option.
int daemon(int, int)
Remap daemon() function.
static double scale_thruput(double thruput)
Scale the given throughput thruput in either Mebibyte per seconds or in Megabits per seconds.
@ EXPONENTIAL
Exponential distribution.
@ COL_TCP_BKOF
Metric from the Linux / BSD TCP stack.
#define FLOWGRIND_VERSION
Flowgrind version number.
static void open_logfile(void)
Create a logfile for measurement output.
unsigned pmtu
Discovered Path MTU.
static FILE * log_stream
Logfile for measurement output.
@ PROTO_TCP
Transmission Control Protocol.
double delay[2]
Delay of flow in seconds (option -Y).
column_id
IDs to explicit address an intermediated interval report column.
unsigned short server_port
Port of the XMLRPC server.
int lcd
Set TCP_LCD (21) on test socket (option -O).
#define free_all(...)
To free() an arbitrary number of variables.
double delay_sum
Accumulated one-way delay.
char os_name[257]
OS on which this daemon runs.
static void close_all_flows(void)
Stop test connections for all flows in a test.
@ COL_PMTU
Metric from the Linux / BSD TCP stack.
unsigned response_blocks_written
#define GUARDBAND
Number of whitespaces between to two interval report columns.
#define MAX_REPORTS_IN_ROW
Number of emited reports before interval header is printed again.
const char * progname
String containing name the program is called with.
static struct rpc_info * add_flow_endpoint_by_url(const char *server_url, const char *server_name, unsigned short server_port)
Add the flow endpoint XML RPC data to the Global linked list.
void set_progname(const char *argv0)
Set global variable 'progname', based on argv[0].
int fg_list_push_back(struct linked_list *const list, void *const data)
Inserts a new element at the end of the list.
@ COL_TCP_CA_STATE
Metric from the Linux / BSD TCP stack.
@ NUM_OSes
Number of elements in enum.
@ MUTEX_CONTEXT_TWO_SIDED
Context for flow options for both endpoints.
@ COL_TCP_SACK
Metric from the Linux / BSD TCP stack.
static size_t det_num_digits(double value)
Determines the length of the integer part of a decimal number.
char server_url[1000]
XMLRPC URL for this daemon.
const char * unit
Second header row: unit of the column.
Infos about the flow including flow options.
size_t last_width
Last width of the column.
static void check_mutex(struct ap_Mutex_state ms[], const enum mutex_context_t context, const int argind, int flow_id)
Wrapper function for mutex checking and error message printing.
enum report_t type
Report type - either INTERVAL or FINAL report.
Infos about a flowgrind daemon and daemon-controller connection.
static void init_flow_options(void)
Initilization the flow option to default values.
Single element in a doubly linked list.
@ COL_DLY_AVG
Application level one-way delay.
enum endpoint_t endpoint
Daemon endpoint - either source or destination.
unsigned imtu
Interface MTU.
char * url
Pointer to daemon XMLPRC URL.
const char * ap_opt_string(const struct arg_parser *const ap, const int i)
Get the real command line option string (may be the short or long version).
@ COL_RTT_MAX
Application level round-trip time.
bool ap_init_mutex_state(const struct arg_parser *const ap, struct ap_Mutex_state *const ms)
Initialize a new mutex state table.
int asprintf_append(char **strp, const char *fmt,...)
struct list_node * next
Pointer to the previous node in the list.
char finished[2]
Flag if final report for the flow is received.
@ COL_DLY_MIN
Application level one-way delay.
static void start_all_flows(xmlrpc_client *rpc_client)
Start test connections for all flows in a test.
@ ap_maybe
Optional Argument.
@ COL_TCP_RTO
Metric from the Linux / BSD TCP stack.
#define DEFAULT_LISTEN_PORT
Daemon's default listen port.
@ COL_DLY_MAX
Application level one-way delay.
#define PARSE_ERR(err_msg,...)
Print error message, usage string and exit.
const char * dump_prefix
Prefix for dumpfile (option -e).
#define SET_COLUMN_UNIT(unit,...)
To set the unit of intermediated interval report columns.
struct fg_tcp_info tcp_info
#define MAX_COLUM_TOO_LARGE
How often an interval report column can be too large before get shrinked.
static void parse_trafgen_option(const char *params, int flow_id, int endpoint_id)
Parse option for stochastic traffic generation (option -G).
bool clobber
Overwrite existing log files (option -o).
unsigned request_blocks_read
int mtcp
Set TCP_MTCP (15) on test socket (option -O).
const char * write_rate_str
Send at specified rate per second (option -R).
@ BYTE_BASED
FreeBSD and OS X stack is a bytes-based stack.
@ COL_TCP_FACK
Metric from the Linux / BSD TCP stack.
bool visible
Dynamically turn an column on/off.
static void parse_colon_option(const char *arg)
Parse argument for option -c to hide/show intermediated interval report columns.
double rtt_min
Minimum round-trip time.
bool ap_init(struct arg_parser *const ap, const int argc, const char *const argv[], const struct ap_Option options[], const char in_order)
Initialize the arg-parser given command line and user-defined options.
double param_one
First mathemathical parameter of the distribution.
static struct linked_list flows_rpc_info
Global linked list to the flow endpoints XML RPC connection information.
bool log_to_file
Write output to logfile (option -w).
@ NORMAL
Normal distribution.
@ COL_TCP_CWND
Metric from the Linux / BSD TCP stack.
struct trafgen_options request_trafgen_options
Stochastic traffic generation settings for the request size.
enum tcp_stack_t force_unit
Force kernel output to specific unit (option -s).
@ COL_TCP_RTT
Metric from the Linux / BSD TCP stack.
int so_debug
Sets SO_DEBUG on test socket (option -O).
struct column_header header
Column header (name and unit).
struct flow_endpoint endpoint[2]
Infos about flow endpoint.
int gettime(struct timespec *tp)
Returns the current wall-clock time with nanosecond precision.
static unsigned short active_flows
Number of currently active flows.
int fg_list_init(struct linked_list *const list)
Initializes the list by setting its head and tail to NULL and its size to 0.
const char * ctimenow(bool ns)
Returns the current wall-clock time as null-terminated string.
static void print_all_final_reports(void)
Print final report (i.e.
static struct daemon * set_unique_daemon_by_uuid(const char *server_uuid, char *daemon_url)
Determine the daemons for controller flow by UUID.
@ SEGMENT_BASED
Linux is a segment-based stack.
double iat_min
Minimum inter-arrival time.
void parse_rpc_address(char **rpc_address, int *port, bool *is_ipv6)
Parse RPC address for the xmlrpc control connection.
@ COL_TRANSAC
Transactions per second.
int requested_send_buffer_size
Request sender buffer in bytes (option -B).
const struct list_node * fg_list_front(struct linked_list *const list)
Returns the first element of the list.
static void check_idle(xmlrpc_client *rpc_client)
Checks that all nodes are currently idle.
struct daemon * daemon
Pointer to manage flow endpoint daemon.
unsigned response_blocks_read
int route_record
Sets ROUTE_RECORD on test socket (option -O).
Settings that describe a flow between from a endpoint's perspective.