1/* 2 Copyright (C) 1993-2012 Hewlett-Packard Company 3*/ 4 5/* libraried performance include file */ 6/* the define NOPERFEXTERN tels us not to re-define all the */ 7 8/* defines and defaults */ 9#define HOSTNAMESIZE 255 10#define PORTBUFSIZE 10 11#define DEFAULT_SIZE 32768 12#define HOST_NAME "127.0.0.1" 13#define TEST_PORT "12865" 14 15/* output controlling variables */ 16#define DEBUG 0 /* debugging level */ 17#define VERBOSITY 0 /* verbosity level */ 18 19/* the end-test conditions for the tests - either transactions, bytes, */ 20/* or time. different vars used for clarity - space is cheap ;-) */ 21#define TEST_TIME 10 /* test ends by time */ 22#define TEST_BYTES 0 /* test ends on byte count */ 23#define TEST_TRANS 0 /* test ends on tran count */ 24 25/* the alignment conditions for the tests */ 26#define LOC_RECV_ALIGN 4 /* alignment for local receives */ 27#define LOC_SEND_ALIGN 4 /* alignment for local sends */ 28#define REM_RECV_ALIGN 4 /* alignment for remote receive */ 29#define REM_SEND_ALIGN 4 /* alignment for remote sends */ 30 31/* which way are we going and what are we doing in this handbasket?-) */ 32#define NETPERF_XMIT 0x2 33#define NETPERF_RECV 0x4 34 35#define NETPERF_IS_RR(x) (((x & NETPERF_XMIT) && (x & NETPERF_RECV)) || \ 36 (!((x & NETPERF_XMIT) || (x & NETPERF_RECV)))) 37 38#define NETPERF_RECV_ONLY(x) ((x & NETPERF_RECV) && !(x & NETPERF_XMIT)) 39 40#define NETPERF_XMIT_ONLY(x) ((x & NETPERF_XMIT) && !(x & NETPERF_RECV)) 41 42#define NETPERF_CC(x) (!(x & NETPERF_XMIT) && !(x & NETPERF_RECV)) 43 44 45/* misc defines for the hell of it */ 46#ifndef MAXLONG 47#define MAXLONG 4294967295UL 48#endif /* MAXLONG */ 49 50#ifdef WANT_DCCP 51 52/* include netinet/in.h to see if SOCK_DCCP and IPPROTO_DCCP are there */ 53#include <netinet/in.h> 54 55#ifndef SOCK_DCCP 56#define DCCP_WARNING 57#define SOCK_DCCP 6 58#endif 59 60#ifndef IPPROTO_DCCP 61#define DCCP_WARNING 62#define IPPROTO_DCCP 33 /* defined by the IANA */ 63#endif 64 65#ifndef SOL_DCCP 66#define DCCP_WARNING 67#define SOL_DCCP 269 68#endif 69 70#ifdef DCCP_WARNING 71#warning This platform is missing one of sock_dccp ipproto_dccp or sol_dccp 72#endif 73 74#endif 75 76#ifndef NETSH 77extern char *program; /* program invocation name */ 78extern char *command_line; /* how we were invoked */ 79 80extern char *passphrase; 81 82/* stuff to say where this test is going */ 83extern char host_name[HOSTNAMESIZE];/* remote host name or ip addr */ 84extern char local_host_name[HOSTNAMESIZE]; 85extern char test_port[PORTBUFSIZE]; /* where is the test waiting */ 86extern char local_test_port[PORTBUFSIZE]; 87extern int address_family; 88extern int local_address_family; 89extern int parse_address_family(char family_string[]); 90extern int parse_socket_type(char socket_string[]); 91extern int parse_protocol(char protocol_string[]); 92extern int parse_direction(char direction_string[]); 93extern void set_defaults(); 94extern void scan_cmd_line(int argc, char *argv[]); 95extern void dump_globals(); 96extern void break_args(char *s, char *arg1, char *arg2); 97extern void break_args_explicit(char *s, char *arg1, char *arg2); 98extern void break_args_explicit_sep(char *s, int sep, char *arg1, char *arg2); 99extern void print_netserver_usage(); 100 101/* output controlling variables */ 102extern int 103 debug, /* debugging level */ 104 print_headers, /* do/don't print test headers */ 105 verbosity, /* verbosity level */ 106 keep_histogram, /* do we keep a histogram of interesting times? */ 107 keep_statistics; /* do we keep/calculate expensive statistics? */ 108 109/* the end-test conditions for the tests - either transactions, bytes, */ 110/* or time. different vars used for clarity - space is cheap ;-) */ 111extern int 112 test_time, /* test ends by time */ 113 test_len_ticks, 114 test_bytes, /* test ends on byte count */ 115 test_trans; /* test ends on tran count */ 116 117/* wait time between control/data connection establishment and start 118 of data traffic */ 119extern int wait_time_secs; 120 121/* the alignment conditions for the tests */ 122extern int 123 local_recv_align, /* alignment for local receives */ 124 local_send_align, /* alignment for local sends */ 125 remote_recv_align, /* alignment for remote receives */ 126 remote_send_align, /* alignment for remote sends */ 127 local_send_offset, 128 local_recv_offset, 129 remote_send_offset, 130 remote_recv_offset, 131 remote_send_width, 132 remote_recv_width; 133 134/* hoist these above the #if to deal with either netperf or netserver 135 configured for it */ 136 137extern int interval_usecs; 138extern int interval_wate; 139extern int interval_burst; 140extern int remote_interval_usecs; 141extern int remote_interval_burst; 142 143 144#ifdef DIRTY 145extern int rem_dirty_count; 146extern int rem_clean_count; 147extern int loc_dirty_count; 148extern int loc_clean_count; 149#endif /* DIRTY */ 150 151/* stuff for confidence intervals */ 152 153extern int confidence_level; 154extern int iteration_min; 155extern int iteration_max; 156extern int result_confidence_only; 157extern double interval; 158extern double interval_pct; 159 160extern int cpu_binding_requested; 161 162/* stuff to control the bufferspace "width" */ 163extern int send_width; 164extern int recv_width; 165 166/* control the socket priority */ 167extern int local_socket_prio; 168extern int remote_socket_prio; 169 170extern int local_socket_tos; 171extern int remote_socket_tos; 172 173/* address family */ 174extern int af; 175 176/* different options for other things */ 177extern int 178 local_cpu_usage, 179 remote_cpu_usage; 180 181extern float 182 local_cpu_rate, 183 remote_cpu_rate; 184 185extern int 186 shell_num_cpus; 187 188extern char 189 test_name[BUFSIZ]; 190 191extern char 192 local_fill_file[BUFSIZ], 193 remote_fill_file[32]; 194 195extern char * 196 result_brand; 197 198extern int 199 no_control; 200 201#ifdef WANT_DLPI 202 203extern int 204 loc_ppa, 205 rem_ppa; 206 207extern int 208 dlpi_sap; 209 210#endif /* WANT_DLPI */ 211 212#endif 213 214extern int parse_ipqos(const char *cp); 215extern const char * iptos2str(int iptos); 216 217