1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
|
/*
Copyright (C) 1993-1995 Hewlett-Packard Company
*/
/* library routine specifc defines */
#define MAXSPECDATA 62 /* how many ints worth of data */
/* can tests send... */
#define MAXTIMES 4 /* how many times may we loop */
/* to calibrate */
#define MAXCPUS 32 /* how many CPU's can we track */
#define MAXMESSAGESIZE 65536
#define MAXALIGNMENT 16384
#define MAXOFFSET 4096
#define DATABUFFERLEN MAXMESSAGESIZE+MAXALIGNMENT+MAXOFFSET
#define DEBUG_ON 1
#define DEBUG_OFF 2
#define DEBUG_OK 3
#define NODE_IDENTIFY 4
#define CPU_CALIBRATE 5
#define DO_TCP_STREAM 10
#define TCP_STREAM_RESPONSE 11
#define TCP_STREAM_RESULTS 12
#define DO_TCP_RR 13
#define TCP_RR_RESPONSE 14
#define TCP_RR_RESULTS 15
#define DO_UDP_STREAM 16
#define UDP_STREAM_RESPONSE 17
#define UDP_STREAM_RESULTS 18
#define DO_UDP_RR 19
#define UDP_RR_RESPONSE 20
#define UDP_RR_RESULTS 21
#define DO_DLPI_CO_STREAM 22
#define DLPI_CO_STREAM_RESPONSE 23
#define DLPI_CO_STREAM_RESULTS 24
#define DO_DLPI_CO_RR 25
#define DLPI_CO_RR_RESPONSE 26
#define DLPI_CO_RR_RESULTS 27
#define DO_DLPI_CL_STREAM 28
#define DLPI_CL_STREAM_RESPONSE 29
#define DLPI_CL_STREAM_RESULTS 30
#define DO_DLPI_CL_RR 31
#define DLPI_CL_RR_RESPONSE 32
#define DLPI_CL_RR_RESULTS 33
#define DO_TCP_CRR 34
#define TCP_CRR_RESPONSE 35
#define TCP_CRR_RESULTS 36
#define DO_STREAM_STREAM 37
#define STREAM_STREAM_RESPONSE 38
#define STREAM_STREAM_RESULTS 39
#define DO_STREAM_RR 40
#define STREAM_RR_RESPONSE 41
#define STREAM_RR_RESULTS 42
#define DO_DG_STREAM 43
#define DG_STREAM_RESPONSE 44
#define DG_STREAM_RESULTS 45
#define DO_DG_RR 46
#define DG_RR_RESPONSE 47
#define DG_RR_RESULTS 48
#define DO_FORE_STREAM 49
#define FORE_STREAM_RESPONSE 50
#define FORE_STREAM_RESULTS 51
#define DO_FORE_RR 52
#define FORE_RR_RESPONSE 53
#define FORE_RR_RESULTS 54
#define DO_HIPPI_STREAM 55
#define HIPPI_STREAM_RESPONSE 56
#define HIPPI_STREAM_RESULTS 57
#define DO_HIPPI_RR 52
#define HIPPI_RR_RESPONSE 53
#define HIPPI_RR_RESULTS 54
#define DO_XTI_TCP_STREAM 55
#define XTI_TCP_STREAM_RESPONSE 56
#define XTI_TCP_STREAM_RESULTS 57
#define DO_XTI_TCP_RR 58
#define XTI_TCP_RR_RESPONSE 59
#define XTI_TCP_RR_RESULTS 60
#define DO_XTI_UDP_STREAM 61
#define XTI_UDP_STREAM_RESPONSE 62
#define XTI_UDP_STREAM_RESULTS 63
#define DO_XTI_UDP_RR 64
#define XTI_UDP_RR_RESPONSE 65
#define XTI_UDP_RR_RESULTS 66
#define DO_XTI_TCP_CRR 67
#define XTI_TCP_CRR_RESPONSE 68
#define XTI_TCP_CRR_RESULTS 69
#define DO_TCP_TRR 70
#define TCP_TRR_RESPONSE 71
#define TCP_TRR_RESULTS 72
#define DO_TCP_NBRR 73
#define TCP_NBRR_RESPONSE 74
#define TCP_NBRR_RESULTS 75
#define DO_TCPIPV6_STREAM 76
#define TCPIPV6_STREAM_RESPONSE 77
#define TCPIPV6_STREAM_RESULTS 78
#define DO_TCPIPV6_RR 79
#define TCPIPV6_RR_RESPONSE 80
#define TCPIPV6_RR_RESULTS 81
#define DO_UDPIPV6_STREAM 82
#define UDPIPV6_STREAM_RESPONSE 83
#define UDPIPV6_STREAM_RESULTS 84
#define DO_UDPIPV6_RR 85
#define UDPIPV6_RR_RESPONSE 86
#define UDPIPV6_RR_RESULTS 87
#define DO_TCPIPV6_CRR 88
#define TCPIPV6_CRR_RESPONSE 89
#define TCPIPV6_CRR_RESULTS 90
#define DO_TCPIPV6_TRR 91
#define TCPIPV6_TRR_RESPONSE 92
#define TCPIPV6_TRR_RESULTS 93
#define DO_LWPSTR_STREAM 100
#define LWPSTR_STREAM_RESPONSE 110
#define LWPSTR_STREAM_RESULTS 120
#define DO_LWPSTR_RR 130
#define LWPSTR_RR_RESPONSE 140
#define LWPSTR_RR_RESULTS 150
#define DO_LWPDG_STREAM 160
#define LWPDG_STREAM_RESPONSE 170
#define LWPDG_STREAM_RESULTS 180
#define DO_LWPDG_RR 190
#define LWPDG_RR_RESPONSE 200
#define LWPDG_RR_RESULTS 210
#define DO_TCP_CC 300
#define TCP_CC_RESPONSE 301
#define TCP_CC_RESULTS 302
/* some of the fields in these structures are going to be doubles and */
/* such. so, we probably want to ensure that they will start on */
/* "double" boundaries. this will break compatability to pre-2.1 */
/* releases, but then, backwards compatability has never been a */
/* stated goal of netperf. raj 11/95 */
union netperf_request_struct {
struct {
int request_type;
int dummy;
int test_specific_data[MAXSPECDATA];
} content;
double dummy;
};
union netperf_response_struct {
struct {
int response_type;
int serv_errno;
int test_specific_data[MAXSPECDATA];
} content;
double dummy;
};
struct ring_elt {
struct ring_elt *next; /* next element in the ring */
char *buffer_base; /* in case we have to free it at somepoint */
char *buffer_ptr; /* the aligned and offset pointer */
};
/* the diferent codes to denote the type of CPU utilization */
/* methods used */
#define CPU_UNKNOWN 0
#define HP_IDLE_COUNTER 1
#define PSTAT 2
#define TIMES 3
#define LOOPER 4
#define GETRUSAGE 5
#define NT_METHOD 6
#define BADCH ('?')
#ifndef NETLIB
#ifdef WIN32
#ifndef _GETOPT_
#define _GETOPT_
int getopt(int argc, char **argv, char *optstring);
extern char *optarg; /* returned arg to go with this option */
extern int optind; /* index to next argv element to process */
extern int opterr; /* should error messages be printed? */
extern int optopt; /* */
#endif /* _GETOPT_ */
extern int win_kludge_socket;
#endif /* WIN32 */
extern union netperf_request_struct netperf_request;
extern union netperf_response_struct netperf_response;
extern char libfmt;
extern int cpu_method;
extern int lib_num_loc_cpus;
extern int server_sock;
extern int times_up;
extern FILE *where;
extern int loops_per_msec;
extern float lib_local_per_cpu_util[];
extern void netlib_init();
extern void install_signal_catchers();
extern void establish_control();
extern void shutdown_control();
extern void init_stat();
extern void send_request();
extern void recv_response();
extern void send_response();
extern void recv_request();
extern void dump_request();
extern void start_timer();
extern void stop_timer();
extern void cpu_start();
extern void cpu_stop();
extern void calculate_confidence();
extern void retrieve_confident_values();
extern void display_confidence();
extern char *format_units();
extern double ntohd();
extern double htond();
extern void libmain();
extern double calc_thruput();
extern float calc_xfered();
extern float calibrate_local_cpu();
extern float calibrate_remote_cpu();
extern float calc_cpu_util();
extern float calc_service_demand();
extern void catcher();
extern struct ring_elt *allocate_buffer_ring();
extern int dl_connect();
extern int dl_bind();
extern int dl_open();
extern char format_cpu_method();
extern unsigned int convert();
/* these are all for the confidence interval stuff */
extern double confidence;
#endif
/* if your system has bcopy and bzero, include it here, otherwise, we */
/* will try to use memcpy aand memset. fix from Bruce Barnett @ GE. */
#ifdef hpux
#define HAVE_BCOPY
#define HAVE_BZERO
#endif
#ifndef HAVE_BCOPY
#define bcopy(s,d,h) memcpy((d),(s),(h))
#endif /* HAVE_BCOPY */
#ifndef HAVE_BZERO
#define bzero(p,h) memset((p),0,(h))
#endif /* HAVE_BZERO */
#ifndef HAVE_MIN
#define min(a,b) ((a < b) ? a : b)
#endif /* HAVE_MIN */
|