summaryrefslogtreecommitdiff
path: root/ACE/apps
diff options
context:
space:
mode:
authorsma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-06-17 09:31:15 +0000
committersma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-06-17 09:31:15 +0000
commitd7da11e74927e99c45ff995741243b96d26975cf (patch)
treed1eeeec400351dba97de73bedb8d0ad01d252783 /ACE/apps
parent86cf0bec30f4c205040011f1396b6c346788b4bd (diff)
downloadATCD-d7da11e74927e99c45ff995741243b96d26975cf.tar.gz
ChangeLogTag: Tue Jun 17 09:30:00 UTC 2008 Simon Massey <sma at prismtech dot com>
Diffstat (limited to 'ACE/apps')
-rw-r--r--ACE/apps/JAWS/clients/WebSTONE/src/bench.c2
-rw-r--r--ACE/apps/JAWS/clients/WebSTONE/src/errexit.c6
-rw-r--r--ACE/apps/JAWS/clients/WebSTONE/src/genrand.c2
-rw-r--r--ACE/apps/JAWS/clients/WebSTONE/src/timefunc.c4
-rw-r--r--ACE/apps/JAWS/clients/WebSTONE/src/webclient.c1044
-rw-r--r--ACE/apps/JAWS/clients/WebSTONE/src/webmaster.c1025
6 files changed, 1040 insertions, 1043 deletions
diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/bench.c b/ACE/apps/JAWS/clients/WebSTONE/src/bench.c
index 3c3d84a34f6..1cf9aebc76b 100644
--- a/ACE/apps/JAWS/clients/WebSTONE/src/bench.c
+++ b/ACE/apps/JAWS/clients/WebSTONE/src/bench.c
@@ -1,7 +1,7 @@
/* $Id$ */
/**************************************************************************
*
- * Copyright (C) 1995 Silicon Graphics, Inc.
+ * Copyright (C) 1995 Silicon Graphics, Inc.
*
* These coded instructions, statements, and computer programs were
* developed by SGI for public use. If any changes are made to this code
diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/errexit.c b/ACE/apps/JAWS/clients/WebSTONE/src/errexit.c
index 8f2fcba176c..51cccc14805 100644
--- a/ACE/apps/JAWS/clients/WebSTONE/src/errexit.c
+++ b/ACE/apps/JAWS/clients/WebSTONE/src/errexit.c
@@ -1,7 +1,7 @@
/* $Id$ */
/**************************************************************************
*
- * Copyright (C) 1995 Silicon Graphics, Inc.
+ * Copyright (C) 1995 Silicon Graphics, Inc.
*
* These coded instructions, statements, and computer programs were
* developed by SGI for public use. If any changes are made to this code
@@ -25,10 +25,10 @@
#include "bench.h"
#ifdef HAVE_VPRINTF
-#define VPRINTF(stderr, format, args) vfprintf((stderr), (format), (args))
+#define VPRINTF(stderr, format, args) vfprintf((stderr), (format), (args))
#else
#ifdef HAVE_DOPRNT
-#define VPRINTF(stderr, format, args) _doprnt((format), (args), (stderr))
+#define VPRINTF(stderr, format, args) _doprnt((format), (args), (stderr))
#endif /* HAVE_DOPRNT */
#endif /* HAVE_VPRINTF */
diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/genrand.c b/ACE/apps/JAWS/clients/WebSTONE/src/genrand.c
index 400e88a55b1..e6100fc1d0b 100644
--- a/ACE/apps/JAWS/clients/WebSTONE/src/genrand.c
+++ b/ACE/apps/JAWS/clients/WebSTONE/src/genrand.c
@@ -1,7 +1,7 @@
/* $Id$ */
/**************************************************************************
*
- * Copyright (C) 1995 Silicon Graphics, Inc.
+ * Copyright (C) 1995 Silicon Graphics, Inc.
*
* These coded instructions, statements, and computer programs were
* developed by SGI for public use. If any changes are made to this code
diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/timefunc.c b/ACE/apps/JAWS/clients/WebSTONE/src/timefunc.c
index 38def53033a..4dd9239aa33 100644
--- a/ACE/apps/JAWS/clients/WebSTONE/src/timefunc.c
+++ b/ACE/apps/JAWS/clients/WebSTONE/src/timefunc.c
@@ -128,7 +128,7 @@ sqtime(struct timeval *Time, struct timeval *SqTime)
double sec;
sec = timevaldouble(Time);
- sec *= sec; /* square */
+ sec *= sec; /* square */
doubletimeval(sec, SqTime);
}
@@ -167,5 +167,3 @@ thruputpersec(const double n, struct timeval *t)
else
return 0;
}
-
-
diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/webclient.c b/ACE/apps/JAWS/clients/WebSTONE/src/webclient.c
index 42084842904..cd8f3b48391 100644
--- a/ACE/apps/JAWS/clients/WebSTONE/src/webclient.c
+++ b/ACE/apps/JAWS/clients/WebSTONE/src/webclient.c
@@ -1,13 +1,13 @@
/* $Id$ */
/**************************************************************************
* *
- * Copyright (C) 1995 Silicon Graphics, Inc. *
- * *
- * These coded instructions, statements, and computer programs were *
+ * Copyright (C) 1995 Silicon Graphics, Inc. *
+ * *
+ * These coded instructions, statements, and computer programs were *
* developed by SGI for public use. If any changes are made to this code*
* please try to get the changes back to the author. Feel free to make *
- * modifications and changes to the code and release it. *
- * *
+ * modifications and changes to the code and release it. *
+ * *
**************************************************************************/
/* FUZZ: disable check_for_math_include */
@@ -65,42 +65,42 @@
#define DEFAULTWWWPORT 80
#define LOG_FILE "logfile"
#ifdef WIN32
-#define DEBUG_FILE "c:/tmp/webstone-debug"
+#define DEBUG_FILE "c:/tmp/webstone-debug"
#else
-#define DEBUG_FILE "/tmp/webstone-debug"
+#define DEBUG_FILE "/tmp/webstone-debug"
#endif /* WIN32 */
#define NCCARGS 4096
/* global variables */
- THREAD FILE *debugfile = stderr;
+ THREAD FILE *debugfile = stderr;
page_list_t *load_file_list; /* actually a dynamic array */
-int amclient = 0;
-int havewebserver = 0;
-int haveproxyserver = 0;
-int savefile = 0;
-NETPORT portnum = DEFAULTWWWPORT;
-int timeexpired = 0;
+int amclient = 0;
+int havewebserver = 0;
+int haveproxyserver = 0;
+int savefile = 0;
+NETPORT portnum = DEFAULTWWWPORT;
+int timeexpired = 0;
int debug = 0;
-long int number_of_pages = 0;
-char webmaster[MAXHOSTNAMELEN];
-char webserver[MAXHOSTNAMELEN];
-char proxyserver[MAXHOSTNAMELEN];
+long int number_of_pages = 0;
+char webmaster[MAXHOSTNAMELEN];
+char webserver[MAXHOSTNAMELEN];
+char proxyserver[MAXHOSTNAMELEN];
#ifdef WIN32
-HANDLE hSemaphore;
-int CounterSemaphore = 0; /* counter semaphore for children */
+HANDLE hSemaphore;
+int CounterSemaphore = 0; /* counter semaphore for children */
#endif /* WIN32 */
static void ClientThread(void *);
/* used to bypass DNS/YP name resolution for every page */
-struct hostent webserv_phe, webmast_phe;
-struct protoent webserv_ppe, webmast_ppe;
-unsigned long webserv_addr, webmast_addr;
-short webserv_type, webmast_type; /* socket type */
+struct hostent webserv_phe, webmast_phe;
+struct protoent webserv_ppe, webmast_ppe;
+unsigned long webserv_addr, webmast_addr;
+short webserv_type, webmast_type; /* socket type */
/* End of globals */
@@ -109,7 +109,7 @@ static void
usage(const char *progname)
{
returnerr("Usage: %s [-d] [-w webserver] [-p port_num]\n",
- progname);
+ progname);
returnerr("\t[-c masterhost:port] [-t run_time | -l loops]\n");
returnerr("\t[-n numclients] [-R]\n");
returnerr("\t[-f config_file] [-u uilfile | url ...]\n");
@@ -146,26 +146,26 @@ childhandler(void)
*/
int resolve_addrs(char *host, char *protocol, struct hostent *host_phe, struct protoent *proto_ppe, unsigned long *addr,
- short *type) {
+ short *type) {
struct hostent *phe;
struct protoent *ppe;
/* if IP address given, convert to internal form */
if (host[0] >= '0' && host[0] <= '9') {
- *addr = inet_addr(host);
- if (*addr == INADDR_NONE)
- return(returnerr("Invalid IP address %s\n", host));
+ *addr = inet_addr(host);
+ if (*addr == INADDR_NONE)
+ return(returnerr("Invalid IP address %s\n", host));
} else {
- /* look up by name */
- phe = gethostbyname(host);
- if (phe == 0)
- {
- D_PRINTF( "Gethostbyname failed: %s", neterrstr() );
- return(returnerr("Can't get %s host entry\n", host));
- }
- memcpy(host_phe, phe, sizeof(struct hostent));
- memcpy((char *)addr, phe->h_addr, sizeof(*addr));
+ /* look up by name */
+ phe = gethostbyname(host);
+ if (phe == 0)
+ {
+ D_PRINTF( "Gethostbyname failed: %s", neterrstr() );
+ return(returnerr("Can't get %s host entry\n", host));
+ }
+ memcpy(host_phe, phe, sizeof(struct hostent));
+ memcpy((char *)addr, phe->h_addr, sizeof(*addr));
}
/* Map protocol name to protocol number */
@@ -173,8 +173,8 @@ struct protoent *ppe;
if (ppe == 0)
{
- D_PRINTF( "protobyname returned %d\n", ppe );
- return(returnerr("Can't get %s protocol entry\n",protocol));
+ D_PRINTF( "protobyname returned %d\n", ppe );
+ return(returnerr("Can't get %s protocol entry\n",protocol));
}
memcpy(proto_ppe, ppe, sizeof(struct protoent));
@@ -183,13 +183,13 @@ struct protoent *ppe;
/* Use protocol to choose a socket type */
if (strcmp(protocol,"udp") == 0)
{
- *type = SOCK_DGRAM;
+ *type = SOCK_DGRAM;
}
else
{
- *type = SOCK_STREAM;
- D_PRINTF( "Choosing SOCK_STREAM %d type %d %s\n",
- SOCK_STREAM, *type, neterrstr() );
+ *type = SOCK_STREAM;
+ D_PRINTF( "Choosing SOCK_STREAM %d type %d %s\n",
+ SOCK_STREAM, *type, neterrstr() );
}
return 0;
@@ -199,14 +199,14 @@ struct protoent *ppe;
SOCKET
connectsock(char *host, NETPORT portnum, char *protocol)
{
- struct sockaddr_in sin; /* an Internet endpoint address */
- SOCKET s; /* socket descriptor */
- int type; /* socket type */
- short proto;
- int returnval; /* temporary return value */
+ struct sockaddr_in sin; /* an Internet endpoint address */
+ SOCKET s; /* socket descriptor */
+ int type; /* socket type */
+ short proto;
+ int returnval; /* temporary return value */
D_PRINTF( "Beginning connectsock; host=%s port=%d proto=%s\n", host,
- portnum, protocol );
+ portnum, protocol );
sin.sin_family = AF_INET;
memset((char *)&sin, 0, sizeof(sin));
@@ -227,13 +227,13 @@ connectsock(char *host, NETPORT portnum, char *protocol)
proto = webmast_ppe.p_proto;
type = webmast_type;
} else {
- struct hostent host_phe;
- struct protoent host_ppe;
- unsigned long host_addr;
- short host_type; /* socket type */
+ struct hostent host_phe;
+ struct protoent host_ppe;
+ unsigned long host_addr;
+ short host_type; /* socket type */
if (resolve_addrs(host, "tcp", &host_phe, &host_ppe, &host_addr, &host_type))
- return returnerr("Can't resolve hostname %s in get()\n", host);
+ return returnerr("Can't resolve hostname %s in get()\n", host);
sin.sin_addr.S_ADDR = host_addr;
sin.sin_family = PF_INET;
proto = host_ppe.p_proto;
@@ -243,7 +243,7 @@ connectsock(char *host, NETPORT portnum, char *protocol)
/* Allocate a socket */
s = socket(PF_INET, type, proto);
D_PRINTF( "Socket %d returned %d, %s\n",
- type, s, neterrstr() );
+ type, s, neterrstr() );
if (BADSOCKET(s))
{
@@ -253,14 +253,14 @@ connectsock(char *host, NETPORT portnum, char *protocol)
/* Connect the socket */
D_PRINTF( "Trying to connect %d with size %d, %s\n",
- s, sizeof(sin), neterrstr() );
+ s, sizeof(sin), neterrstr() );
D_PRINTF( "Address is family %d, port %d, addr %s\n",
- sin.sin_family, ntohs(sin.sin_port),
- inet_ntoa(sin.sin_addr) );
+ sin.sin_family, ntohs(sin.sin_port),
+ inet_ntoa(sin.sin_addr) );
returnval = connect(s, (struct sockaddr *)&sin, sizeof(sin));
D_PRINTF( "Connect returned %d, %s\n",
- returnval, neterrstr() );
+ returnval, neterrstr() );
if (returnval < 0)
{
D_PRINTF( "Can't connect: %s\n", neterrstr() );
@@ -277,11 +277,11 @@ connectsock(char *host, NETPORT portnum, char *protocol)
SOCKET
connecttomaster(char *str)
{
- char *tempch;
- SOCKET sock;
- char msg[100];
- char ConnectStr[100]; /* Fix to handle multiple threads */
- int tries;
+ char *tempch;
+ SOCKET sock;
+ char msg[100];
+ char ConnectStr[100]; /* Fix to handle multiple threads */
+ int tries;
strcpy(ConnectStr, str);
@@ -295,9 +295,9 @@ connecttomaster(char *str)
* HOSTNAME:PORT OR HOST-IP:PORT
*/
D_PRINTF( "Incorrect format %s: use hostname:port or ip_addr:port\n",
- ConnectStr );
- return(returnerr("Incorrect format %s: use host:port or ip_addr:port\n",
- ConnectStr));
+ ConnectStr );
+ return(returnerr("Incorrect format %s: use host:port or ip_addr:port\n",
+ ConnectStr));
}
/*
@@ -311,21 +311,21 @@ connecttomaster(char *str)
* reject a connection if there are a lot of client processes
*/
#define MAXTRIES 30
-#define TRYDELAY_SEC 1
+#define TRYDELAY_SEC 1
for (tries = 0; tries < MAXTRIES; tries++) {
sock = connectsock(ConnectStr,(NETPORT)atoi(tempch),"tcp");
- if (!BADSOCKET(sock))
- break;
+ if (!BADSOCKET(sock))
+ break;
- sleep(TRYDELAY_SEC);
+ sleep(TRYDELAY_SEC);
}
if (BADSOCKET(sock))
{
- /* ERROR CONNECTING TO MASTER PROCESS */
- return(returnerr("Could not connect to master process\n"));
+ /* ERROR CONNECTING TO MASTER PROCESS */
+ return(returnerr("Could not connect to master process\n"));
}
/*
@@ -335,15 +335,15 @@ connecttomaster(char *str)
*/
if(NETWRITE(sock,READYSTR,READYSTRLEN) != READYSTRLEN)
{
- return(returnerr("Error sending READY message to master"));
+ return(returnerr("Error sending READY message to master"));
}
memset(msg,0,GOSTRLEN+1);
if(NETREAD(sock,msg,GOSTRLEN) != GOSTRLEN)
{
- D_PRINTF( "Error receiving GO message from master: %s\n", neterrstr()
- );
- return(returnerr("Error receiving GO message from master\n"));
+ D_PRINTF( "Error receiving GO message from master: %s\n", neterrstr()
+ );
+ return(returnerr("Error receiving GO message from master\n"));
}
if(strncmp(GOSTR,msg,GOSTRLEN))
@@ -351,7 +351,7 @@ connecttomaster(char *str)
/*
* WE RECEIVED A MESSAGE OTHER THAN GO. PRINT IT OUT AND RETURN ERROR
*/
- return(returnerr("Received non-GO message %s\n",msg));
+ return(returnerr("Received non-GO message %s\n",msg));
}
return(sock);
@@ -362,36 +362,36 @@ connecttomaster(char *str)
static void
accumstats(rqst_timer_t *rqsttimer, page_stats_t *pagestats, stats_t *timestat)
{
- rqst_stats_t rqststats;
+ rqst_stats_t rqststats;
-#define TFMT "%10u:%10u"
+#define TFMT "%10u:%10u"
/*
* DUMP THE TIMING INFORMATION HERE, OR COMPUTE WHAT YOU WANT TO
* PRINT OUT LATER.
*/
D_PRINTF( "Total bytes read: %d \t Body size read: %d\n",
- rqsttimer->totalbytes,
- rqsttimer->bodybytes );
+ rqsttimer->totalbytes,
+ rqsttimer->bodybytes );
D_PRINTF( "Enter time: " TFMT " \t Exit Time: " TFMT "\n",
- rqsttimer->entertime.tv_sec,
- rqsttimer->entertime.tv_usec,
- rqsttimer->exittime.tv_sec,
- rqsttimer->exittime.tv_usec );
+ rqsttimer->entertime.tv_sec,
+ rqsttimer->entertime.tv_usec,
+ rqsttimer->exittime.tv_sec,
+ rqsttimer->exittime.tv_usec );
D_PRINTF( "Before connect: " TFMT " \t After connect: " TFMT "\n",
- rqsttimer->beforeconnect.tv_sec,
- rqsttimer->beforeconnect.tv_usec,
- rqsttimer->afterconnect.tv_sec,
- rqsttimer->afterconnect.tv_usec );
+ rqsttimer->beforeconnect.tv_sec,
+ rqsttimer->beforeconnect.tv_usec,
+ rqsttimer->afterconnect.tv_sec,
+ rqsttimer->afterconnect.tv_usec );
D_PRINTF( "Before header: " TFMT " \t After header: " TFMT "\n",
- rqsttimer->beforeheader.tv_sec,
- rqsttimer->beforeheader.tv_usec,
- rqsttimer->afterheader.tv_sec,
- rqsttimer->afterheader.tv_usec );
+ rqsttimer->beforeheader.tv_sec,
+ rqsttimer->beforeheader.tv_usec,
+ rqsttimer->afterheader.tv_sec,
+ rqsttimer->afterheader.tv_usec );
D_PRINTF( "After body: " TFMT "\n",
- rqsttimer->afterbody.tv_sec,
- rqsttimer->afterbody.tv_usec );
+ rqsttimer->afterbody.tv_sec,
+ rqsttimer->afterbody.tv_usec );
rqstat_times(&(rqststats), rqsttimer);
rqstat_sum(&(timestat->rs), &(rqststats));
@@ -399,7 +399,7 @@ accumstats(rqst_timer_t *rqsttimer, page_stats_t *pagestats, stats_t *timestat)
if (rqsttimer->page_number != 999)
{
- timestat->page_numbers[rqsttimer->page_number] += 1;
+ timestat->page_numbers[rqsttimer->page_number] += 1;
}
#undef TFMT
@@ -411,7 +411,7 @@ accumstats(rqst_timer_t *rqsttimer, page_stats_t *pagestats, stats_t *timestat)
*
* maxcount = the number of files in the WWW page
* pageval = the number of the WWW page (offset in load_file_list[])
- * (if -1, use page # 0 - does this still work?)
+ * (if -1, use page # 0 - does this still work?)
*
* returns the number of files retrieved
*/
@@ -426,7 +426,7 @@ makeload(int maxcount, int pageval, THREAD rqst_timer_t *timerarray, THREAD stat
NETPORT loc_portnum;
D_PRINTF( "Starting makeload(maxcount %d, pageval %d)\n",
- maxcount, pageval );
+ maxcount, pageval );
strcpy( server, webserver); /* Put in default value */
@@ -435,24 +435,24 @@ makeload(int maxcount, int pageval, THREAD rqst_timer_t *timerarray, THREAD stat
for (cnt = 0; cnt < maxcount; cnt++)
{
- D_PRINTF( "Loop count %d in makeload()\n", cnt );
- if (pageval == -1)
- {
- pageval = cnt;
- }
- if (timeexpired)
- {
- break;
- }
-
- /* check for a filename */
- if (strlen(load_file_list[pageval].filename[cnt]) < 1)
- {
- D_PRINTF( "Bad filename at pageval %d, count %d\n",
- pageval, cnt );
- return(returnerr("Bad filename at pageval %d, count %d\n",
- pageval, cnt));
- }
+ D_PRINTF( "Loop count %d in makeload()\n", cnt );
+ if (pageval == -1)
+ {
+ pageval = cnt;
+ }
+ if (timeexpired)
+ {
+ break;
+ }
+
+ /* check for a filename */
+ if (strlen(load_file_list[pageval].filename[cnt]) < 1)
+ {
+ D_PRINTF( "Bad filename at pageval %d, count %d\n",
+ pageval, cnt );
+ return(returnerr("Bad filename at pageval %d, count %d\n",
+ pageval, cnt));
+ }
/* if (load_file_list[pageval].port_number[cnt] != 0)
{
@@ -464,66 +464,66 @@ makeload(int maxcount, int pageval, THREAD rqst_timer_t *timerarray, THREAD stat
} */
loc_portnum = portnum;
if ((load_file_list[pageval].servername[cnt] != 0)
- &&
- *load_file_list[pageval].servername[cnt])
- {
- D_PRINTF( "Copying URL server %s to server\n",
- load_file_list[pageval].servername[cnt] );
- strcpy(server, load_file_list[pageval].servername[cnt]);
- }
-
- if (haveproxyserver)
- {
- D_PRINTF( "Copying proxy %s to webserver\n", proxyserver );
- strcpy(server, proxyserver);
- }
-
-
- D_PRINTF( "Calling get(%s, %d, %s, &(timearray[%d]))\n",
- server, loc_portnum, load_file_list[pageval].filename[cnt],
- cnt );
-
- returnval = get(server, loc_portnum,
- load_file_list[pageval].filename[cnt],
- &(timerarray[cnt]));
- if (returnval < 0)
- {
- D_PRINTF( "***GET() RETURNED AN ERROR\n" );
- }
-
- /*
- * DID GET() RETURN A VALID TIME?
- */
- if ((returnval == 0) && (timerarray[cnt].valid == 2))
- {
- timerarray[cnt].page_number = pageval;
-
- accumstats(&timerarray[cnt], &page_stats_tmp, timestat);
- }
- else if (!timeexpired) /* INVALID, INCREMENT THE ERROR COUNTER */
- {
- D_PRINTF( "GET error counter incremented\n" );
- timestat->rs.totalerrs++;
- }
-
- if (amclient) {
- fd_set readfds;
- struct timeval timeout;
- int rv;
-
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
- FD_ZERO(&readfds);
- FD_SET(mastersock, &readfds);
-
- /* if the webmaster has aborted, quit */
- D_PRINTF("Before select() on webmaster socket\n");
- if (rv = select(FD_SETSIZE, &readfds, 0, 0, &timeout)) {
- D_PRINTF("select() returned %d\n", rv);
- D_PRINTF("Client terminating at request of webmaster\n");
- exit(2);
- }
- }
+ &&
+ *load_file_list[pageval].servername[cnt])
+ {
+ D_PRINTF( "Copying URL server %s to server\n",
+ load_file_list[pageval].servername[cnt] );
+ strcpy(server, load_file_list[pageval].servername[cnt]);
+ }
+
+ if (haveproxyserver)
+ {
+ D_PRINTF( "Copying proxy %s to webserver\n", proxyserver );
+ strcpy(server, proxyserver);
+ }
+
+
+ D_PRINTF( "Calling get(%s, %d, %s, &(timearray[%d]))\n",
+ server, loc_portnum, load_file_list[pageval].filename[cnt],
+ cnt );
+
+ returnval = get(server, loc_portnum,
+ load_file_list[pageval].filename[cnt],
+ &(timerarray[cnt]));
+ if (returnval < 0)
+ {
+ D_PRINTF( "***GET() RETURNED AN ERROR\n" );
+ }
+
+ /*
+ * DID GET() RETURN A VALID TIME?
+ */
+ if ((returnval == 0) && (timerarray[cnt].valid == 2))
+ {
+ timerarray[cnt].page_number = pageval;
+
+ accumstats(&timerarray[cnt], &page_stats_tmp, timestat);
+ }
+ else if (!timeexpired) /* INVALID, INCREMENT THE ERROR COUNTER */
+ {
+ D_PRINTF( "GET error counter incremented\n" );
+ timestat->rs.totalerrs++;
+ }
+
+ if (amclient) {
+ fd_set readfds;
+ struct timeval timeout;
+ int rv;
+
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 0;
+ FD_ZERO(&readfds);
+ FD_SET(mastersock, &readfds);
+
+ /* if the webmaster has aborted, quit */
+ D_PRINTF("Before select() on webmaster socket\n");
+ if (rv = select(FD_SETSIZE, &readfds, 0, 0, &timeout)) {
+ D_PRINTF("select() returned %d\n", rv);
+ D_PRINTF("Client terminating at request of webmaster\n");
+ exit(2);
+ }
+ }
} /* END for cnt */
@@ -532,28 +532,28 @@ makeload(int maxcount, int pageval, THREAD rqst_timer_t *timerarray, THREAD stat
* WHY NOT USE returnval HERE?
*/
if ((returnval == 0) &&
- (cnt == load_file_list[pageval].num_of_files) &&
- (timerarray[cnt-1].valid == 2))
+ (cnt == load_file_list[pageval].num_of_files) &&
+ (timerarray[cnt-1].valid == 2))
{
- rqst_stats_t *ps_rs;
- rqst_stats_t *pst_rs;
+ rqst_stats_t *ps_rs;
+ rqst_stats_t *pst_rs;
- ps_rs = &(page_stats[pageval].rs);
- pst_rs = &(page_stats_tmp.rs);
+ ps_rs = &(page_stats[pageval].rs);
+ pst_rs = &(page_stats_tmp.rs);
- rqstat_sum(ps_rs, pst_rs);
+ rqstat_sum(ps_rs, pst_rs);
- page_stats[pageval].totalpages++;
+ page_stats[pageval].totalpages++;
- if (page_stats[pageval].page_size == 0)
- {
- page_stats[pageval].page_size = (unsigned)
- page_stats_tmp.rs.totalbody;
- }
+ if (page_stats[pageval].page_size == 0)
+ {
+ page_stats[pageval].page_size = (unsigned)
+ page_stats_tmp.rs.totalbody;
+ }
}
D_PRINTF( "\nMakeload output page %d: %d errors, %d pages\n",
- pageval, timestat->rs.totalerrs, page_stats[pageval].totalpages );
+ pageval, timestat->rs.totalerrs, page_stats[pageval].totalpages );
D_PRINTF( "Makeload returning %d\n", cnt );
return(cnt);
@@ -569,34 +569,34 @@ void sock_cleanup(void) {
#endif /* WIN32 */
/* globalize variables that were in main() */
-long int numfiles = 0;
-int testtime = 0;
-int numloops = 0;
-int numclients = 0;
-int record_all_transactions = 0;
-int uil_filelist_f = 0; /* filedescriptor of URLs to fetch? */
-int verbose = 0;
+long int numfiles = 0;
+int testtime = 0;
+int numloops = 0;
+int numclients = 0;
+int record_all_transactions = 0;
+int uil_filelist_f = 0; /* filedescriptor of URLs to fetch? */
+int verbose = 0;
int total_weight;
-char uil_filelist[NCCARGS];
-char filelist[MAXNUMOFFILES][MAXPATHLEN];
-char configfile[MAXPATHLEN];
-char connectstr[MAXHOSTNAMELEN+10];
+char uil_filelist[NCCARGS];
+char filelist[MAXNUMOFFILES][MAXPATHLEN];
+char configfile[MAXPATHLEN];
+char connectstr[MAXHOSTNAMELEN+10];
void
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
- int file_count=0;
- int getoptch;
- int currarg;
- extern char *optarg;
- extern int optind;
- int i, j;
- char *tempch;
- int err;
+ int file_count=0;
+ int getoptch;
+ int currarg;
+ extern char *optarg;
+ extern int optind;
+ int i, j;
+ char *tempch;
+ int err;
#define SLEEP_USEC 100
#ifdef WIN32
- WSADATA WSAData;
+ WSADATA WSAData;
#else
struct timeval sleeptime;
@@ -611,13 +611,13 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
debugfile = stderr;
#ifdef WIN32
- MessageBeep(~0U); /* announce our existence */
+ MessageBeep(~0U); /* announce our existence */
MessageBeep(~0U);
MessageBeep(~0U);
err = WSAStartup(MAKEWORD(1,1), &WSAData);
if (err != 0) {
- errexit("Error in WSAStartup()\n");
+ errexit("Error in WSAStartup()\n");
}
atexit(sock_cleanup);
@@ -628,7 +628,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
hSemaphore = CreateSemaphore(0, 0, 1, 0);
if(hSemaphore == 0)
{
- errexit("Create semaphore failed: %d", GetLastError());
+ errexit("Create semaphore failed: %d", GetLastError());
}
#endif /* WIN32 */
@@ -645,51 +645,51 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
switch(getoptch)
{
- case 'c':
+ case 'c':
sprintf(connectstr, "%s", optarg);
- amclient = 1;
+ amclient = 1;
printf("%s", OKSTR); /* sent back to webmaster */
fflush(stdout);
- break;
+ break;
case 'd':
debug = 0; /* sumedh */
break;
- case 'f':
- sprintf(configfile, "%s", optarg);
- break;
+ case 'f':
+ sprintf(configfile, "%s", optarg);
+ break;
case 'l':
numloops = atoi(optarg);
break;
case 'n':
numclients = atoi(optarg);
break;
- case 'u':
- sprintf(uil_filelist, "%s", optarg);
- uil_filelist_f = 1;
- break;
- case 'p':
- portnum = atoi(optarg);
- break;
- case 's':
- savefile = 1;
- break;
+ case 'u':
+ sprintf(uil_filelist, "%s", optarg);
+ uil_filelist_f = 1;
+ break;
+ case 'p':
+ portnum = atoi(optarg);
+ break;
+ case 's':
+ savefile = 1;
+ break;
case 't':
testtime = 60 * atoi(optarg);
break;
- case 'v':
- verbose = 1;
- break;
+ case 'v':
+ verbose = 1;
+ break;
case 'w':
havewebserver = 1;
sprintf(webserver,"%s",optarg);
break;
- case 'P':
- haveproxyserver = 1;
- sprintf(proxyserver, "%s", optarg);
- break;
- case 'R':
- record_all_transactions = 1;
- break;
+ case 'P':
+ haveproxyserver = 1;
+ sprintf(proxyserver, "%s", optarg);
+ break;
+ case 'R':
+ record_all_transactions = 1;
+ break;
default:
usage(argv[0]);
}
@@ -700,12 +700,12 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
/* print the command line */
for (i = 0; i < argc; i++)
- D_PRINTF( "%s ", argv[i] );
+ D_PRINTF( "%s ", argv[i] );
D_PRINTF( "\n\n" );
if(testtime && numloops)
{
- /*
+ /*
* EITHER numloops OR testtime, BUT NOT BOTH.
*/
usage(argv[0]);
@@ -720,9 +720,9 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
returnerr("No WWW Server specified\n");
usage(argv[0]);
#else
- /* IF IT ISN'T, WE ASSUME LOCALHOST */
- sprintf(webserver, "%s", "localhost");
- havewebserver = 1;
+ /* IF IT ISN'T, WE ASSUME LOCALHOST */
+ sprintf(webserver, "%s", "localhost");
+ havewebserver = 1;
#endif /* WIN32 */
}
@@ -734,8 +734,8 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
* GET THE URLS TO RETRIEVE.
*/
if (numfiles == MAXNUMOFFILES) {
- returnerr("Maximum of %d files on the command line.\n");
- usage(argv[0]);
+ returnerr("Maximum of %d files on the command line.\n");
+ usage(argv[0]);
}
sscanf(argv[currarg],"%s",filelist[numfiles]);
numfiles++;
@@ -744,8 +744,8 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
if ((numfiles != 0) && uil_filelist_f)
{
- returnerr("Both a filelist and UIL specified.\n");
- usage(argv[0]);
+ returnerr("Both a filelist and UIL specified.\n");
+ usage(argv[0]);
}
if((numfiles == 0) && !(uil_filelist_f))
@@ -753,7 +753,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
/*
* AT LEAST ONE FILE MUST BE SPECIFIED
*/
- returnerr("No UIL resources or filelist specified \n");
+ returnerr("No UIL resources or filelist specified \n");
usage(argv[0]);
}
@@ -766,37 +766,37 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
}
if(numclients > MAXPROCSPERNODE || numclients < 1)
{
- returnerr("Number of Clients must be between 1 and %d\n", MAXPROCSPERNODE);
- exit(1);
+ returnerr("Number of Clients must be between 1 and %d\n", MAXPROCSPERNODE);
+ exit(1);
}
/* allow use of IP address */
if(amclient) {
- if((tempch = strpbrk(connectstr,":")) == 0)
- {
- /*
- * INCORRECT FORMAT OF ConnectStr. CORRECT FORMAT IS
- * HOSTNAME:PORT OR HOST-IP:PORT
- */
- D_PRINTF( "Incorrect format %s: use hostname:port or ip_addr:port\n",
- connectstr );
- returnerr("Incorrect format %s: use host:port or ip_addr:port\n", connectstr);
- exit(1);
- } else {
- strncpy(webmaster, connectstr, tempch-connectstr);
- }
- if(resolve_addrs(webmaster, "tcp", &webmast_phe, &webmast_ppe, &webmast_addr, &webmast_type))
- exit(1);
+ if((tempch = strpbrk(connectstr,":")) == 0)
+ {
+ /*
+ * INCORRECT FORMAT OF ConnectStr. CORRECT FORMAT IS
+ * HOSTNAME:PORT OR HOST-IP:PORT
+ */
+ D_PRINTF( "Incorrect format %s: use hostname:port or ip_addr:port\n",
+ connectstr );
+ returnerr("Incorrect format %s: use host:port or ip_addr:port\n", connectstr);
+ exit(1);
+ } else {
+ strncpy(webmaster, connectstr, tempch-connectstr);
+ }
+ if(resolve_addrs(webmaster, "tcp", &webmast_phe, &webmast_ppe, &webmast_addr, &webmast_type))
+ exit(1);
}
if (haveproxyserver)
{
- D_PRINTF( "Copying proxy %s to webserver\n", proxyserver );
- strcpy(webserver, proxyserver);
+ D_PRINTF( "Copying proxy %s to webserver\n", proxyserver );
+ strcpy(webserver, proxyserver);
}
if (resolve_addrs(webserver, "tcp", &webserv_phe, &webserv_ppe, &webserv_addr, &webserv_type))
- exit(1);
+ exit(1);
/*
* INITIALIZE DATA
@@ -815,41 +815,41 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
/* IF WE HAVE A FILELIST, PARSE IT */
/* allocate memory */
D_PRINTF( "Allocating page list: %ld by %d\n",
- number_of_pages, numfiles );
+ number_of_pages, numfiles );
for (i=0; i<number_of_pages; i++)
- {
- for (j=0; j<MAXNUMOFFILES; j++)
- {
- load_file_list[i].servername[j] =
- (char *)mymalloc(URL_SIZE);
- load_file_list[i].filename[j] =
- (char *)mymalloc(URL_SIZE);
- }
- }
+ {
+ for (j=0; j<MAXNUMOFFILES; j++)
+ {
+ load_file_list[i].servername[j] =
+ (char *)mymalloc(URL_SIZE);
+ load_file_list[i].filename[j] =
+ (char *)mymalloc(URL_SIZE);
+ }
+ }
D_PRINTF( "Parsing file list: %s\n", uil_filelist );
parse_file_list(uil_filelist, load_file_list,
- &number_of_pages, &numfiles);
+ &number_of_pages, &numfiles);
/* free memory for pages that won't be used? */
D_PRINTF( "Actual page list: %ld by %d\n",
- number_of_pages, MAXNUMOFFILES );
+ number_of_pages, MAXNUMOFFILES );
D_PRINTF( "Setting up weighting for %ld pages\n",
- number_of_pages );
+ number_of_pages );
total_weight = load_percent(load_file_list, number_of_pages);
/* total_weight = load_percent(load_file_list, number_of_pages, pages); */
}
else
{
- /* no uil file */
- number_of_pages = numfiles;
+ /* no uil file */
+ number_of_pages = numfiles;
}
if (number_of_pages < 1)
{
- /* no pages - exit */
- D_PRINTF( "No valid URLs found\n" );
- errexit("No valid URLs found\n");
+ /* no pages - exit */
+ D_PRINTF( "No valid URLs found\n" );
+ errexit("No valid URLs found\n");
}
#ifndef WIN32
@@ -888,17 +888,17 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
/* for(;;)
{
- int pid = wait((int*)0);
- if ((pid == -1) && errno == ECHILD) break;
+ int pid = wait((int*)0);
+ if ((pid == -1) && errno == ECHILD) break;
} */
#else
/* start threads on NT */
for (i = 0; i < numclients; i++)
{
- if (_beginthread(ClientThread, 0, 0) == -1)
- {
- errexit("_beginthread failed: %d", GetLastError());
- }
+ if (_beginthread(ClientThread, 0, 0) == -1)
+ {
+ errexit("_beginthread failed: %d", GetLastError());
+ }
}
#endif /* WIN32 */
@@ -912,8 +912,8 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
ReleaseSemaphore(hSemaphore, 1, 0);
if (testtime) {
- sleep(testtime);
- alarmhandler(); /* signal end of test to threads */
+ sleep(testtime);
+ alarmhandler(); /* signal end of test to threads */
}
/*
@@ -931,28 +931,28 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
void ClientThread(void *dummy)
{
- THREAD FILE *logfile;
+ THREAD FILE *logfile;
- THREAD stats_t timestat;
+ THREAD stats_t timestat;
- THREAD rqst_timer_t timerarray[MAXNUMOFFILES];
- THREAD SOCKET mastersock = BADSOCKET_VALUE; /* connection to webmaster */
+ THREAD rqst_timer_t timerarray[MAXNUMOFFILES];
+ THREAD SOCKET mastersock = BADSOCKET_VALUE; /* connection to webmaster */
THREAD page_stats_t *page_stats; /* actually a dynamic array */
- int loopcnt = 0;
- int filecnt;
- int loop;
- int ran_number;
- int page_index;
- int page_number;
- int file_count = 0;
- char file_name[50];
- struct timeval runningtime;
- time_t junk;
- int i;
- int returnval;
+ int loopcnt = 0;
+ int filecnt;
+ int loop;
+ int ran_number;
+ int page_index;
+ int page_number;
+ int file_count = 0;
+ char file_name[50];
+ struct timeval runningtime;
+ time_t junk;
+ int i;
+ int returnval;
/*
* INITIALIZE DATA
@@ -967,25 +967,25 @@ void ClientThread(void *dummy)
if (debug)
{
- /*
- * OPEN A DEBUG FILE
- */
- fflush(stderr);
- sprintf(file_name, "%s.%d", DEBUG_FILE, (int)getpid());
- debugfile = fopen(file_name, "w+");
- if (debugfile == 0)
- errexit("Can't open debug file\n");
- D_PRINTF( "Running in debug mode, %d\n",amclient );
+ /*
+ * OPEN A DEBUG FILE
+ */
+ fflush(stderr);
+ sprintf(file_name, "%s.%d", DEBUG_FILE, (int)getpid());
+ debugfile = fopen(file_name, "w+");
+ if (debugfile == 0)
+ errexit("Can't open debug file\n");
+ D_PRINTF( "Running in debug mode, %d\n",amclient );
}
if (record_all_transactions)
{
- /*
- * OPEN A LOG FILE.
- */
- sprintf(file_name, "%s%d", LOG_FILE, (int)getpid());
- returnerr("Log file is %s\n", file_name);
- logfile = fopen(file_name, "w+");
+ /*
+ * OPEN A LOG FILE.
+ */
+ sprintf(file_name, "%s%d", LOG_FILE, (int)getpid());
+ returnerr("Log file is %s\n", file_name);
+ logfile = fopen(file_name, "w+");
}
/* Initialize random number generator */
@@ -995,7 +995,7 @@ void ClientThread(void *dummy)
for (i=0; i < MAXNUMOFFILES; i++)
{
- rqtimer_init(&(timerarray[i]));
+ rqtimer_init(&(timerarray[i]));
}
stats_init(&timestat);
@@ -1010,14 +1010,14 @@ void ClientThread(void *dummy)
* THE MASTER WWWSTONE PROCESS. WE NEED TO CONNECT TO THE
* MASTER WHO WILL SYNCHRONIZE ALL THE CLIENTS.
*/
- D_PRINTF( "Trying to connect with %s\n",connectstr );
+ D_PRINTF( "Trying to connect with %s\n",connectstr );
- mastersock = connecttomaster(connectstr);
+ mastersock = connecttomaster(connectstr);
- D_PRINTF( "connecttomaster returns %d, %s\n",
- mastersock, neterrstr() );
+ D_PRINTF( "connecttomaster returns %d, %s\n",
+ mastersock, neterrstr() );
- if(BADSOCKET(mastersock))
+ if(BADSOCKET(mastersock))
{
/*
* ERROR CONNECTING TO THE MASTER. ABORT.
@@ -1038,7 +1038,7 @@ void ClientThread(void *dummy)
{
/*
* IF RUNNING A TIMED TEST, WE WILL LOOP
- * UNTIL THE ALARM GOES OFF.
+ * UNTIL THE ALARM GOES OFF.
* WE'LL ALSO NEED TO SET THE SIGNAL HANDLER
*/
#ifndef WIN32
@@ -1055,80 +1055,80 @@ void ClientThread(void *dummy)
*/
if (testtime)
- numloops = INFINITY;
+ numloops = INFINITY;
GETTIMEOFDAY(&(timestat.starttime), &(timestat.starttimezone));
/* LOOP UNTIL WE HIT numloops, OR WE RUN OUT OF TIME */
for(loopcnt = 0; (loopcnt < numloops) && !timeexpired; loopcnt++)
{
- /*
- * THIS IS WHERE LOAD TESTING IS DONE.
- * GET A RANDOM NUMBER, THEN INDEX INTO THE
- * PAGE, AND THEN REQUEST THAT SET OF FILES.
- */
- if (uil_filelist_f) /* HAVE FILELIST */
- {
- D_PRINTF( "Have filelist\n" );
- /* if (testtime != 0) /* RUNNING IN TIMED MODE */
+ /*
+ * THIS IS WHERE LOAD TESTING IS DONE.
+ * GET A RANDOM NUMBER, THEN INDEX INTO THE
+ * PAGE, AND THEN REQUEST THAT SET OF FILES.
+ */
+ if (uil_filelist_f) /* HAVE FILELIST */
+ {
+ D_PRINTF( "Have filelist\n" );
+ /* if (testtime != 0) /* RUNNING IN TIMED MODE */
if (1)
- {
- D_PRINTF( "Running in timed mode\n" );
- /* random number between 0 and totalweight-1 */
+ {
+ D_PRINTF( "Running in timed mode\n" );
+ /* random number between 0 and totalweight-1 */
junk = getpid ();
- ran_number = (rand_r(&junk) % total_weight);
- D_PRINTF( "random %ld\n", ran_number );
-
- /* loop through pages, find correct one
- * while ran_number is positive, decrement it
- * by the load_num of the current page
- * example: ran_number is 5, pages have weights of 10 and 10
- * first iteration page_index = 0, ran_number = -5
- * iteration halted, page_index = 0
- */
- page_index = -1;
- while (ran_number >= 0)
- {
- page_index++;
- D_PRINTF( "Current page index %d: %ld - %d\n",
- page_index, ran_number,
- load_file_list[page_index].load_num
- );
- ran_number -= load_file_list[page_index].load_num;
- }
-
- if (page_index >= number_of_pages) { page_index--; }
-
- D_PRINTF( "Final page index %d\n", page_index );
- filecnt = makeload(load_file_list[page_index].num_of_files,
- page_index, timerarray, &timestat, mastersock, page_stats);
+ ran_number = (rand_r(&junk) % total_weight);
+ D_PRINTF( "random %ld\n", ran_number );
+
+ /* loop through pages, find correct one
+ * while ran_number is positive, decrement it
+ * by the load_num of the current page
+ * example: ran_number is 5, pages have weights of 10 and 10
+ * first iteration page_index = 0, ran_number = -5
+ * iteration halted, page_index = 0
+ */
+ page_index = -1;
+ while (ran_number >= 0)
+ {
+ page_index++;
+ D_PRINTF( "Current page index %d: %ld - %d\n",
+ page_index, ran_number,
+ load_file_list[page_index].load_num
+ );
+ ran_number -= load_file_list[page_index].load_num;
+ }
+
+ if (page_index >= number_of_pages) { page_index--; }
+
+ D_PRINTF( "Final page index %d\n", page_index );
+ filecnt = makeload(load_file_list[page_index].num_of_files,
+ page_index, timerarray, &timestat, mastersock, page_stats);
testtime = 1;
- }
- else /* NOT RUNNING IN TIMED MODE */
- {
- for (page_number = 0;
- page_number < number_of_pages;
- page_number++)
- {
- filecnt = makeload(load_file_list[page_number].num_of_files,
- page_number, timerarray, &timestat, mastersock, page_stats);
-
- } /* END for page_number */
- } /* END if/else TIMED MODE */
- }
- else /* NO FILELIST */
- {
- D_PRINTF( "No filelist\n" );
- /*
- * LOOP THROUGH UNTIL numfiles TIMES OR UNTIL TIMER EXPIRES
- * AND ALARM SETS filecnt TO INFINITY.
- */
-
- /* does this still work?? */
- /* filecnt = makeload(numfiles, -1, timerarray); */
- } /* END if HAVE FILELIST */
-
- if (filecnt > 0)
- file_count += filecnt;
+ }
+ else /* NOT RUNNING IN TIMED MODE */
+ {
+ for (page_number = 0;
+ page_number < number_of_pages;
+ page_number++)
+ {
+ filecnt = makeload(load_file_list[page_number].num_of_files,
+ page_number, timerarray, &timestat, mastersock, page_stats);
+
+ } /* END for page_number */
+ } /* END if/else TIMED MODE */
+ }
+ else /* NO FILELIST */
+ {
+ D_PRINTF( "No filelist\n" );
+ /*
+ * LOOP THROUGH UNTIL numfiles TIMES OR UNTIL TIMER EXPIRES
+ * AND ALARM SETS filecnt TO INFINITY.
+ */
+
+ /* does this still work?? */
+ /* filecnt = makeload(numfiles, -1, timerarray); */
+ } /* END if HAVE FILELIST */
+
+ if (filecnt > 0)
+ file_count += filecnt;
} /* END while loopcnt */
@@ -1138,157 +1138,157 @@ void ClientThread(void *dummy)
if (testtime == 0)
{
- numfiles = loopcnt;
+ numfiles = loopcnt;
- if (uil_filelist_f)
- {
- numfiles = file_count;
- }
+ if (uil_filelist_f)
+ {
+ numfiles = file_count;
+ }
}
/* This option ( "-R" ) looks broken (e.g. l > 50) -- JEF 2/15/96 */
if (record_all_transactions)
{
- /*
- * DUMP THE LOG FILE INFORMATION.
- */
- for (loop=0; loop < (loopcnt * file_count); loop++)
- {
- fprintf(logfile, " entertime \t%d.%d\n"
- " beforeconnect \t%d.%d\n"
- " afterconnect \t%d.%d\n"
- " beforeheader \t%d.%d\n"
- " afterheader \t%d.%d\n"
- " afterbody \t%d.%d\n"
- " exittime \t%d.%d\n"
- " total bytes \t%d\n"
- " body bytes\t%d\n",
- timerarray[loop].entertime.tv_sec,
- timerarray[loop].entertime.tv_usec,
- timerarray[loop].beforeconnect.tv_sec,
- timerarray[loop].beforeconnect.tv_usec,
- timerarray[loop].afterconnect.tv_sec,
- timerarray[loop].afterconnect.tv_usec,
- timerarray[loop].beforeheader.tv_sec,
- timerarray[loop].beforeheader.tv_usec,
- timerarray[loop].afterheader.tv_sec,
- timerarray[loop].afterheader.tv_usec,
- timerarray[loop].afterbody.tv_sec,
- timerarray[loop].afterbody.tv_usec,
- timerarray[loop].exittime.tv_sec,
- timerarray[loop].exittime.tv_usec,
- timerarray[loop].totalbytes,
- timerarray[loop].bodybytes);
- } /* end for loop */
+ /*
+ * DUMP THE LOG FILE INFORMATION.
+ */
+ for (loop=0; loop < (loopcnt * file_count); loop++)
+ {
+ fprintf(logfile, " entertime \t%d.%d\n"
+ " beforeconnect \t%d.%d\n"
+ " afterconnect \t%d.%d\n"
+ " beforeheader \t%d.%d\n"
+ " afterheader \t%d.%d\n"
+ " afterbody \t%d.%d\n"
+ " exittime \t%d.%d\n"
+ " total bytes \t%d\n"
+ " body bytes\t%d\n",
+ timerarray[loop].entertime.tv_sec,
+ timerarray[loop].entertime.tv_usec,
+ timerarray[loop].beforeconnect.tv_sec,
+ timerarray[loop].beforeconnect.tv_usec,
+ timerarray[loop].afterconnect.tv_sec,
+ timerarray[loop].afterconnect.tv_usec,
+ timerarray[loop].beforeheader.tv_sec,
+ timerarray[loop].beforeheader.tv_usec,
+ timerarray[loop].afterheader.tv_sec,
+ timerarray[loop].afterheader.tv_usec,
+ timerarray[loop].afterbody.tv_sec,
+ timerarray[loop].afterbody.tv_usec,
+ timerarray[loop].exittime.tv_sec,
+ timerarray[loop].exittime.tv_usec,
+ timerarray[loop].totalbytes,
+ timerarray[loop].bodybytes);
+ } /* end for loop */
} /* end if recording all transactions */
D_PRINTF( "total errors: %d\n",timestat.rs.totalerrs );
/* gethostname(timestat.hostname,MAXHOSTNAMELEN); */
/* D_PRINTF( "Test for host: %s\n",timestat.hostname ); */
D_PRINTF( "Server is: %s running at port number: %d\n",
- webserver,portnum );
+ webserver,portnum );
/* sprintf(timestat.hostname,"%s:%d",timestat.hostname,getpid()); */
if (amclient) /* CLIENT TO A WEBMASTER */
{
- char *stats_as_text;
+ char *stats_as_text;
/*
* SEND THE TIMING DATA TO THE MASTER
*/
- stats_as_text = stats_to_text(&timestat);
- D_PRINTF( "stats_to_text returned %s\n", stats_as_text );
-
- returnval = senddata(mastersock, stats_as_text,
- SIZEOF_STATSTEXTBASE + number_of_pages*SIZEOF_DOUBLETEXT);
- D_PRINTF( "Wrote time stats to master %d\n", returnval );
-
- if (returnval < 1)
- {
- D_PRINTF( "Error while writing time stats: %s\n",
- neterrstr() );
- errexit("Error while writing time stats: %s\n",
- neterrstr());
- }
-
- if (uil_filelist_f)
- /* write pagestats */
- {
- char *page_stats_as_text;
- for (i = 0; i < number_of_pages; i++)
- {
- D_PRINTF( "On page_stats[%d]\n", i );
- page_stats_as_text = page_stats_to_text(&page_stats[i]);
- returnval = strlen(page_stats_as_text);
- D_PRINTF( "page_stats_to_text[%d] returned %d\n",
- i, returnval );
- returnval = senddata(mastersock, page_stats_as_text,
- SIZEOF_PAGESTATSTEXT);
- if (returnval < 1)
- {
- D_PRINTF( "Error while writing page_stats[%d]: %s\n",
- i, neterrstr() );
- errexit("Error while writing page_stats[%d]: %s\n",
- i, neterrstr());
- } /* end if */
- D_PRINTF( "Wrote %d bytes of page_stats[%d] to master\n",
- returnval, i );
- } /* end for */
- } /* end if filelist */
-
- D_PRINTF( "About to close socket\n" );
+ stats_as_text = stats_to_text(&timestat);
+ D_PRINTF( "stats_to_text returned %s\n", stats_as_text );
+
+ returnval = senddata(mastersock, stats_as_text,
+ SIZEOF_STATSTEXTBASE + number_of_pages*SIZEOF_DOUBLETEXT);
+ D_PRINTF( "Wrote time stats to master %d\n", returnval );
+
+ if (returnval < 1)
+ {
+ D_PRINTF( "Error while writing time stats: %s\n",
+ neterrstr() );
+ errexit("Error while writing time stats: %s\n",
+ neterrstr());
+ }
+
+ if (uil_filelist_f)
+ /* write pagestats */
+ {
+ char *page_stats_as_text;
+ for (i = 0; i < number_of_pages; i++)
+ {
+ D_PRINTF( "On page_stats[%d]\n", i );
+ page_stats_as_text = page_stats_to_text(&page_stats[i]);
+ returnval = strlen(page_stats_as_text);
+ D_PRINTF( "page_stats_to_text[%d] returned %d\n",
+ i, returnval );
+ returnval = senddata(mastersock, page_stats_as_text,
+ SIZEOF_PAGESTATSTEXT);
+ if (returnval < 1)
+ {
+ D_PRINTF( "Error while writing page_stats[%d]: %s\n",
+ i, neterrstr() );
+ errexit("Error while writing page_stats[%d]: %s\n",
+ i, neterrstr());
+ } /* end if */
+ D_PRINTF( "Wrote %d bytes of page_stats[%d] to master\n",
+ returnval, i );
+ } /* end for */
+ } /* end if filelist */
+
+ D_PRINTF( "About to close socket\n" );
if (NETCLOSE(mastersock))
- D_PRINTF( "Close socket error: %s\n", neterrstr() );
+ D_PRINTF( "Close socket error: %s\n", neterrstr() );
}
else /* NOT A CLIENT TO A WEBMASTER */
{
- if (testtime)
- {
- printf("Test ran for: %d minutes\n",(testtime/60));
- }
- else
- {
- printf("Test ran for: %d iterations.\n",numloops);
- }
- compdifftime(&(timestat.endtime), &(timestat.starttime),
- &(runningtime));
- printf("Total time of test (sec) %d.%d\n", runningtime.tv_sec,
- runningtime.tv_usec);
- printf("Files retrieved per iteration: %d\n",numfiles); /* 'per iteration' */
- printf("----------------------------------\n");
- printf("Totals:\n\n");
- rqstat_print(&(timestat.rs));
-
- if (timestat.rs.totalconnects == 0)
- goto end;
- printf("Thruput = %5.2lf Kbytes/sec\n",
- thruputpersec(timestat.rs.totalbytes, &runningtime) / 1000);
-
- if (uil_filelist_f && numloops && verbose)
- {
- for (loop = 0; loop < number_of_pages; loop++)
- {
- if (timestat.page_numbers[loop] != 0)
- {
- printf ("===============================================================================\n");
- printf ("Page # %d\n\n", loop);
- printf ("Total number of times page was hit %d\n",
- page_stats[loop].totalpages);
- rqstat_print(&(page_stats[loop].rs));
- printf ("Page size %d \n", page_stats[loop].page_size);
- printf ("===============================================================================\n\n");
- } /* END if timestat */
- } /* END for loop */
- } /* END if filelist */
+ if (testtime)
+ {
+ printf("Test ran for: %d minutes\n",(testtime/60));
+ }
+ else
+ {
+ printf("Test ran for: %d iterations.\n",numloops);
+ }
+ compdifftime(&(timestat.endtime), &(timestat.starttime),
+ &(runningtime));
+ printf("Total time of test (sec) %d.%d\n", runningtime.tv_sec,
+ runningtime.tv_usec);
+ printf("Files retrieved per iteration: %d\n",numfiles); /* 'per iteration' */
+ printf("----------------------------------\n");
+ printf("Totals:\n\n");
+ rqstat_print(&(timestat.rs));
+
+ if (timestat.rs.totalconnects == 0)
+ goto end;
+ printf("Thruput = %5.2lf Kbytes/sec\n",
+ thruputpersec(timestat.rs.totalbytes, &runningtime) / 1000);
+
+ if (uil_filelist_f && numloops && verbose)
+ {
+ for (loop = 0; loop < number_of_pages; loop++)
+ {
+ if (timestat.page_numbers[loop] != 0)
+ {
+ printf ("===============================================================================\n");
+ printf ("Page # %d\n\n", loop);
+ printf ("Total number of times page was hit %d\n",
+ page_stats[loop].totalpages);
+ rqstat_print(&(page_stats[loop].rs));
+ printf ("Page size %d \n", page_stats[loop].page_size);
+ printf ("===============================================================================\n\n");
+ } /* END if timestat */
+ } /* END for loop */
+ } /* END if filelist */
} /* END if client */
end:
if(record_all_transactions)
- fclose(logfile);
+ fclose(logfile);
if(debug)
{
- D_PRINTF( "Client exiting.\n" );
- fclose(debugfile);
+ D_PRINTF( "Client exiting.\n" );
+ fclose(debugfile);
}
#ifdef WIN32
diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/webmaster.c b/ACE/apps/JAWS/clients/WebSTONE/src/webmaster.c
index 1bfbcc06b9d..3acc9e28b16 100644
--- a/ACE/apps/JAWS/clients/WebSTONE/src/webmaster.c
+++ b/ACE/apps/JAWS/clients/WebSTONE/src/webmaster.c
@@ -1,13 +1,13 @@
/* $Id$ */
/**************************************************************************
- * *
- * Copyright (C) 1995 Silicon Graphics, Inc. *
- * *
- * These coded instructions, statements, and computer programs were *
+ * *
+ * Copyright (C) 1995 Silicon Graphics, Inc. *
+ * *
+ * These coded instructions, statements, and computer programs were *
* developed by SGI for public use. If any changes are made to this code*
* please try to get the changes back to the author. Feel free to make *
- * modifications and changes to the code and release it. *
- * *
+ * modifications and changes to the code and release it. *
+ * *
**************************************************************************/
/* FUZZ: disable check_for_math_include */
@@ -35,8 +35,8 @@
#include <netinet/in.h>
#include <netdb.h>
#else
-#define FD_SETSIZE 1024 /* max size for select() - keep before <winsock.h>
- * and same size as MAXCLIENTS */
+#define FD_SETSIZE 1024 /* max size for select() - keep before <winsock.h>
+ * and same size as MAXCLIENTS */
#include <windows.h>
#include <winsock.h>
#include <io.h>
@@ -47,38 +47,38 @@
#include "bench.h"
/* command line options/data */
-int savefile = 0;
-int debug = 0;
-int norexec = 0;
-int haveproxyserver = 0;
-char proxyserver[MAXHOSTNAMELEN];
-char network_mask_str[30] = "255.255.255.0";
+int savefile = 0;
+int debug = 0;
+int norexec = 0;
+int haveproxyserver = 0;
+char proxyserver[MAXHOSTNAMELEN];
+char network_mask_str[30] = "255.255.255.0";
unsigned network_mask = 0;
-int servaddrin_config = 0;
-int dumpall = 0;
-int testtime = 0;
-int havewebserver = 0;
-int numloops = 0;
-NETPORT portnum = 0;
-int redirect = 0;
-int record_all_transactions = 0;
-int uil_filelist_f = 0;
-int verbose = 0;
-char webserver[MAXHOSTNAMELEN];
-char configfile[MAXPATHLEN];
-char uil_filelist[NCCARGS];
-
-char filelist[256][MAXPATHLEN];
-fd_set zerofdset;
+int servaddrin_config = 0;
+int dumpall = 0;
+int testtime = 0;
+int havewebserver = 0;
+int numloops = 0;
+NETPORT portnum = 0;
+int redirect = 0;
+int record_all_transactions = 0;
+int uil_filelist_f = 0;
+int verbose = 0;
+char webserver[MAXHOSTNAMELEN];
+char configfile[MAXPATHLEN];
+char uil_filelist[NCCARGS];
+
+char filelist[256][MAXPATHLEN];
+fd_set zerofdset;
/* other key data */
long int number_of_pages = 0;
-int totalnumclients = 0;
-int num_rexecs = 0;
-SOCKET socknum[MAXCLIENTS];
-SOCKET sockIO[MAXTOTALPROCS];
-SOCKET sockErr[MAXTOTALPROCS];
-THREAD FILE *debugfile = stderr;
+int totalnumclients = 0;
+int num_rexecs = 0;
+SOCKET socknum[MAXCLIENTS];
+SOCKET sockIO[MAXTOTALPROCS];
+SOCKET sockErr[MAXTOTALPROCS];
+THREAD FILE *debugfile = stderr;
struct hostent *master_phe; /* IP addresses for webmaster */
struct timeval sumedh_start, sumedh_end;
@@ -88,10 +88,10 @@ static void
usage(const char *progname)
{
- fprintf(stderr, "Usage: %s [-a] [-d] -f config_file [-l numloops]\n",
- progname);
- fprintf(stderr, " [-p port_num] [-r] [-s] [-t run_time] \n");
- fprintf(stderr, "\n");
+ fprintf(stderr, "Usage: %s [-a] [-d] -f config_file [-l numloops]\n",
+ progname);
+ fprintf(stderr, " [-p port_num] [-r] [-s] [-t run_time] \n");
+ fprintf(stderr, "\n");
fprintf(stderr, "-w webserver URL [URL ...]\n\n");
fprintf(stderr, "-a print timing information for all clients\n");
fprintf(stderr, "-d turn on debug statements\n");
@@ -102,12 +102,12 @@ usage(const char *progname)
fprintf(stderr, "-s save client gets to /tmp/webstone.data.*\n");
fprintf(stderr, "-t run_time\tduration of test in minutes\n");
fprintf(stderr, "-w webserver\tname of webserver host to contact\n");
- fprintf(stderr, "-u URL file\tfilelist of URLs\n");
- fprintf(stderr, "-v verbose mode\n");
- fprintf(stderr, "-P servername\tuse proxy server for transactions\n");
- fprintf(stderr, "-W webserver addresses are in the config file\n");
- fprintf(stderr, "-R record all transactions\n");
- errexit("\n");
+ fprintf(stderr, "-u URL file\tfilelist of URLs\n");
+ fprintf(stderr, "-v verbose mode\n");
+ fprintf(stderr, "-P servername\tuse proxy server for transactions\n");
+ fprintf(stderr, "-W webserver addresses are in the config file\n");
+ fprintf(stderr, "-R record all transactions\n");
+ errexit("\n");
}
static SOCKET
@@ -143,12 +143,12 @@ passivesock(const NETPORT portnum, const char *protocol, const int qlen)
if (strcmp(protocol, "udp") == 0)
{
type = SOCK_DGRAM;
- D_PRINTF( "Choosing SOCK_DGRAM\n" );
+ D_PRINTF( "Choosing SOCK_DGRAM\n" );
}
else
{
type = SOCK_STREAM;
- D_PRINTF( "Choosing SOCK_STREAM, errno %d\n",errno );
+ D_PRINTF( "Choosing SOCK_STREAM, errno %d\n",errno );
}
/* allocate a socket */
@@ -156,10 +156,10 @@ passivesock(const NETPORT portnum, const char *protocol, const int qlen)
if (BADSOCKET(s))
{
D_PRINTF( "Socket PF_INET %d %d returned %d with %s\n",
- type, ppe->p_proto, s, neterrstr() );
+ type, ppe->p_proto, s, neterrstr() );
errexit("Can't create socket: %s\n", neterrstr());
}
- D_PRINTF( "Socket %d created with errno %d\n",s,errno );
+ D_PRINTF( "Socket %d created with errno %d\n",s,errno );
/* Bind the socket */
if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0)
@@ -216,48 +216,48 @@ void echo_client(void *stream)
timeout.tv_usec = (long)0;
if (which_stream) {
- sockarr = sockIO;
- outfile = stdout;
+ sockarr = sockIO;
+ outfile = stdout;
} else {
- sockarr = sockErr;
- outfile = stderr;
+ sockarr = sockErr;
+ outfile = stderr;
}
D_PRINTF( "echo_client running\n" );
signal( SIGINT, SIG_DFL); /* restore default behavior
- for SIGINT */
+ for SIGINT */
while (1) {
- FD_ZERO(&readfds);
- for (i = 0; i < num_rexecs; i++)
- if (sockarr[i] != BADSOCKET_VALUE)
- FD_SET(sockarr[i], &readfds);
- rv = select(num_rexecs, &readfds, 0, 0, &timeout);
- if ( rv == 0)
- continue;
- if (rv < 0 && WSAGetLastError() == WSANOTINITIALISED)
- return;
- if (rv < 0)
- errexit("Error in echo_client(): select() returns %d: %s\n", rv, neterrstr());
-
- /* loop over the sockets that are ready with data */
- for (i = 0; i < num_rexecs; i++) {
- if (sockarr[i] != BADSOCKET_VALUE && FD_ISSET(sockarr[i], &readfds)) {
- len = NETREAD(sockarr[i], buf, sizeof(buf));
- if (len <= 0) {
- /* mark connection closed */
- sockarr[i] = BADSOCKET_VALUE;
- if (len < 0 && WSAGetLastError() == WSANOTINITIALISED)
- return;
- if (len < 0)
- fprintf(stderr, "Error in echo_client() after NETREAD(): %s\n", neterrstr());
- continue;
- }
+ FD_ZERO(&readfds);
+ for (i = 0; i < num_rexecs; i++)
+ if (sockarr[i] != BADSOCKET_VALUE)
+ FD_SET(sockarr[i], &readfds);
+ rv = select(num_rexecs, &readfds, 0, 0, &timeout);
+ if ( rv == 0)
+ continue;
+ if (rv < 0 && WSAGetLastError() == WSANOTINITIALISED)
+ return;
+ if (rv < 0)
+ errexit("Error in echo_client(): select() returns %d: %s\n", rv, neterrstr());
- /* copy to stdout or stderr */
- fwrite(buf, sizeof(char), len, outfile);
- }
- }
+ /* loop over the sockets that are ready with data */
+ for (i = 0; i < num_rexecs; i++) {
+ if (sockarr[i] != BADSOCKET_VALUE && FD_ISSET(sockarr[i], &readfds)) {
+ len = NETREAD(sockarr[i], buf, sizeof(buf));
+ if (len <= 0) {
+ /* mark connection closed */
+ sockarr[i] = BADSOCKET_VALUE;
+ if (len < 0 && WSAGetLastError() == WSANOTINITIALISED)
+ return;
+ if (len < 0)
+ fprintf(stderr, "Error in echo_client() after NETREAD(): %s\n", neterrstr());
+ continue;
+ }
+
+ /* copy to stdout or stderr */
+ fwrite(buf, sizeof(char), len, outfile);
+ }
+ }
}
D_PRINTF( "Exiting echo_client\n" );
}
@@ -278,7 +278,7 @@ echo_client(char *hostname, const int fd)
cc = NETREAD(fd, buf, sizeof(buf));
if (cc > 0)
{
- write(STDOUT_FILENO, buf, cc);
+ write(STDOUT_FILENO, buf, cc);
}
}
D_PRINTF( "Exiting echo_client\n" );
@@ -292,31 +292,31 @@ echo_client(char *hostname, const int fd)
* return value is a string with the IP address or hostname (or NULL)
*/
char *pick_webmaster_IP_address(char *client_hostname, struct hostent *master_phe,
- unsigned netmask) {
+ unsigned netmask) {
static char buf[20];
unsigned char addr[4];
int client_addr;
int i;
if (client_hostname[0] >= '0' && client_hostname[0] <= '9') {
- /* we have an IP address */
- client_addr = inet_addr(client_hostname);
- if (client_addr == INADDR_NONE)
- return 0;
+ /* we have an IP address */
+ client_addr = inet_addr(client_hostname);
+ if (client_addr == INADDR_NONE)
+ return 0;
} else {
- /* we have a hostname, use the webserver hostname */
- return master_phe->h_name;
+ /* we have a hostname, use the webserver hostname */
+ return master_phe->h_name;
}
for (i = 0; master_phe->h_addr_list[i] != 0; i++) {
- if ((*(int *)(master_phe->h_addr_list[i]) & netmask) ==
- (client_addr & netmask))
- goto gotit;
+ if ((*(int *)(master_phe->h_addr_list[i]) & netmask) ==
+ (client_addr & netmask))
+ goto gotit;
}
i = 0; /* give up */
gotit:
- memcpy((char *)addr, master_phe->h_addr_list[i], sizeof(addr)); /* Internet specific */
+ memcpy((char *)addr, master_phe->h_addr_list[i], sizeof(addr)); /* Internet specific */
sprintf(buf, "%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]);
return buf;
}
@@ -327,10 +327,10 @@ gotit:
void ParseCmdLine(int argc, char **argv )
{
-char getoptch;
-int currarg;
-extern char *optarg;
-extern int optind;
+char getoptch;
+int currarg;
+extern char *optarg;
+extern int optind;
/*
* PARSE THE COMMAND LINE OPTIONS
@@ -338,89 +338,89 @@ extern int optind;
while((getoptch = getopt(argc,argv,"P:f:t:l:p:u:R:w:n:M:adrsvWX")) != (const char)EOF)
{
switch(getoptch)
- {
- case 'M':
- strcpy(network_mask_str, optarg);
- break;
- case 'P':
- haveproxyserver = 1;
- strcpy(proxyserver, optarg);
- break;
- case 'R':
- record_all_transactions = 1;
- break;
- case 'X':
- norexec = 1;
- break;
- case 'W':
- servaddrin_config = 1;
- break;
- case 'a':
- dumpall = 1;
- break;
- case 'd':
- debug = 1;
- break;
- case 'f':
- strcpy(configfile, optarg);
- break;
- case 'l':
- numloops = atoi(optarg);
- break;
- case 'p':
- portnum = atoi(optarg);
- break;
- case 'r':
- redirect = 1;
- break;
- case 's':
- savefile = 1;
- break;
- case 't':
- testtime = atoi(optarg);
- break;
- case 'u':
- uil_filelist_f = 1;
- strcpy(uil_filelist, optarg);
- break;
- case 'v':
- verbose = 1;
- break;
- case 'w':
- havewebserver = 1;
- strcpy(webserver, optarg);
- break;
- default:
- usage(argv[0]);
- } /* end switch */
+ {
+ case 'M':
+ strcpy(network_mask_str, optarg);
+ break;
+ case 'P':
+ haveproxyserver = 1;
+ strcpy(proxyserver, optarg);
+ break;
+ case 'R':
+ record_all_transactions = 1;
+ break;
+ case 'X':
+ norexec = 1;
+ break;
+ case 'W':
+ servaddrin_config = 1;
+ break;
+ case 'a':
+ dumpall = 1;
+ break;
+ case 'd':
+ debug = 1;
+ break;
+ case 'f':
+ strcpy(configfile, optarg);
+ break;
+ case 'l':
+ numloops = atoi(optarg);
+ break;
+ case 'p':
+ portnum = atoi(optarg);
+ break;
+ case 'r':
+ redirect = 1;
+ break;
+ case 's':
+ savefile = 1;
+ break;
+ case 't':
+ testtime = atoi(optarg);
+ break;
+ case 'u':
+ uil_filelist_f = 1;
+ strcpy(uil_filelist, optarg);
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ case 'w':
+ havewebserver = 1;
+ strcpy(webserver, optarg);
+ break;
+ default:
+ usage(argv[0]);
+ } /* end switch */
} /* end while */
if (numloops && testtime)
- errexit("Can't have both -l and -t\n");
+ errexit("Can't have both -l and -t\n");
if(!havewebserver && !servaddrin_config)
{
/*
* THE SERVERS NAME MUST BE SPECIFIED
*/
-
+
fprintf(stderr,"No WWW Server specified\n");
usage(argv[0]);
}
if (havewebserver && servaddrin_config)
{
- /*
- * CAN'T HAVE BOTH -w and -W
- */
- fprintf(stderr, "Can't have both -w and -W options\n");
- usage(argv[0]);
+ /*
+ * CAN'T HAVE BOTH -w and -W
+ */
+ fprintf(stderr, "Can't have both -w and -W options\n");
+ usage(argv[0]);
}
network_mask = inet_addr(network_mask_str);
if (network_mask == INADDR_NONE) {
- fprintf(stderr, "Invalid network mask (-M %s)\n", network_mask_str);
- usage(argv[0]);
+ fprintf(stderr, "Invalid network mask (-M %s)\n", network_mask_str);
+ usage(argv[0]);
}
if(strlen(configfile) == 0)
@@ -436,32 +436,32 @@ extern int optind;
*/
if (uil_filelist_f == 0)
{
- currarg = optind;
- number_of_pages = 0;
- while(currarg != argc)
- {
- /*
- * GET THE UILS TO RETRIEVE.
- */
-
- sscanf(argv[currarg],"%s",filelist[number_of_pages]);
- number_of_pages++;
- currarg++;
- }
+ currarg = optind;
+ number_of_pages = 0;
+ while(currarg != argc)
+ {
+ /*
+ * GET THE UILS TO RETRIEVE.
+ */
+
+ sscanf(argv[currarg],"%s",filelist[number_of_pages]);
+ number_of_pages++;
+ currarg++;
+ }
}
else
{
- /* have filelist; take a stab at the number of valid URLs */
- D_PRINTF( "About to parse filelist %s\n", uil_filelist );
- number_of_pages = count_file_list(uil_filelist);
+ /* have filelist; take a stab at the number of valid URLs */
+ D_PRINTF( "About to parse filelist %s\n", uil_filelist );
+ number_of_pages = count_file_list(uil_filelist);
}
if (number_of_pages == 0)
{
/*
- * AT LEAST ONE FILE MUST BE SPECIFIED
- */
- fprintf(stderr,"No URL resources specified\n");
- usage(argv[0]);
+ * AT LEAST ONE FILE MUST BE SPECIFIED
+ */
+ fprintf(stderr,"No URL resources specified\n");
+ usage(argv[0]);
}
}
@@ -487,14 +487,14 @@ struct sockaddr_in *serveraddr;
{
errexit("Couldn't open socket %d: %s\n", sock, neterrstr());
}
- D_PRINTF( "The passivesock call succeeded\n" );
+ D_PRINTF( "The passivesock call succeeded\n" );
D_PRINTF( "calling getsockname\n" );
len = sizeof(struct sockaddr);
if(getsockname(sock, (struct sockaddr *)serveraddr, &len) < 0)
{
- errexit("Could not get socket informaton\n");
+ errexit("Could not get socket informaton\n");
}
return( sock );
@@ -520,26 +520,26 @@ char *commandline;
if(gethostname(hostname,MAXHOSTNAMELEN) != 0)
{
- errexit("Could not retrieve local host name");
+ errexit("Could not retrieve local host name");
} else {
- /* convert hostname to address (to avoid DNS problems for webclients) */
- /* The following lines are add to copy the system
- buffer (output of gethostbyname()) into user area.
+ /* convert hostname to address (to avoid DNS problems for webclients) */
+ /* The following lines are add to copy the system
+ buffer (output of gethostbyname()) into user area.
This is because, there are very good chances that later
- on system buffer might be overwritten by some calls and
- still if your pointer is pointing to same addr. nothing
- but only trouble and trouble! Infact this is what
+ on system buffer might be overwritten by some calls and
+ still if your pointer is pointing to same addr. nothing
+ but only trouble and trouble! Infact this is what
happening when I tried to run webstone benchmark for more
then one clients. It used to over write the webmaster name
- with the first client name and so remaining on client(s)
- the webclient process(es) were invoked with wrong webmaster
- name! This behaviour is observed Solaris 2.4 this bug
- can be hit in any OS. - Rajesh Shah 5/18/96 */
-
- /* master_phe = gethostbyname(hostname); */
- master_phe_tmp = gethostbyname(hostname);
- master_phe = (struct hostent *)malloc(sizeof(struct hostent));
- HostEntCpy(master_phe, master_phe_tmp);
+ with the first client name and so remaining on client(s)
+ the webclient process(es) were invoked with wrong webmaster
+ name! This behaviour is observed Solaris 2.4 this bug
+ can be hit in any OS. - Rajesh Shah 5/18/96 */
+
+ /* master_phe = gethostbyname(hostname); */
+ master_phe_tmp = gethostbyname(hostname);
+ master_phe = (struct hostent *)malloc(sizeof(struct hostent));
+ HostEntCpy(master_phe, master_phe_tmp);
}
/* set up executable pathname */
@@ -548,7 +548,7 @@ char *commandline;
if ( temp && *temp ) {
webclient_path = (char *)mymalloc( strlen(temp) + strlen("/webclient")
- + 1);
+ + 1);
strcpy(webclient_path, temp);
strcat(webclient_path, "/webclient");
@@ -593,11 +593,11 @@ char *commandline;
if (uil_filelist_f)
{
strcat(commandline," -u ");
- strcat(commandline,uil_filelist);
+ strcat(commandline,uil_filelist);
}
if (record_all_transactions)
{
- strcat(commandline," -R");
+ strcat(commandline," -R");
}
if (testtime != 0)
{
@@ -613,16 +613,16 @@ char *commandline;
if (uil_filelist_f == 0)
{
- cnt = 0;
- while(cnt < number_of_pages)
- {
- /*
- * PUT THE FILES AT THE END OF THE LIST.
- */
- strcat(commandline," ");
- strcat(commandline,filelist[cnt]);
- cnt++;
- }
+ cnt = 0;
+ while(cnt < number_of_pages)
+ {
+ /*
+ * PUT THE FILES AT THE END OF THE LIST.
+ */
+ strcat(commandline," ");
+ strcat(commandline,filelist[cnt]);
+ cnt++;
+ }
}
puts(commandline);
}
@@ -632,21 +632,21 @@ char *commandline;
*/
int RexecClients( commandline, clienthostname, serveraddr)
char *commandline;
-char clienthostname[MAXCLIENTS][MAXHOSTNAMELEN];
-struct sockaddr_in *serveraddr;
+char clienthostname[MAXCLIENTS][MAXHOSTNAMELEN];
+struct sockaddr_in *serveraddr;
{
- int tmpfd;
- int numclients = 0;
- char tmpcommandline[NCCARGS];
+ int tmpfd;
+ int numclients = 0;
+ char tmpcommandline[NCCARGS];
struct servent *inetport;
- int cnt;
- char buffer[NCCARGS];
- char login[MAXUSERNAME];
- char password[MAXPASSWD];
- FILE *fp;
- int returnval;
- char *tmphostname;
+ int cnt;
+ char buffer[NCCARGS];
+ char login[MAXUSERNAME];
+ char password[MAXPASSWD];
+ FILE *fp;
+ int returnval;
+ char *tmphostname;
memset(buffer, 0, sizeof(buffer));
@@ -671,84 +671,84 @@ struct sockaddr_in *serveraddr;
D_PRINTF( "rexec loop\n" );
while(1)
{
- char webserver2[MAXHOSTNAMELEN];
- char linebuf[150];
- int num;
- char *primename;
-
- if (0 == fgets(linebuf, sizeof(linebuf), fp))
- break;
- num = sscanf(linebuf,"%s %s %s %d %s",clienthostname[cnt],login,password,
- &numclients, webserver2);
- if (num < 4)
- break;
- if (servaddrin_config) {
- if (num == 4) {
- errexit("No webserver specified in config file for %s\n", clienthostname[cnt]);
- }
- strcpy(webserver, webserver2);
- }
-
- if (numclients <= 0)
- errexit("Number of clients must be >= 0\n");
- if (numclients > MAXPROCSPERNODE)
- {
- errexit("Number of clients per node can't exceed %d\n", MAXPROCSPERNODE);
- }
+ char webserver2[MAXHOSTNAMELEN];
+ char linebuf[150];
+ int num;
+ char *primename;
+
+ if (0 == fgets(linebuf, sizeof(linebuf), fp))
+ break;
+ num = sscanf(linebuf,"%s %s %s %d %s",clienthostname[cnt],login,password,
+ &numclients, webserver2);
+ if (num < 4)
+ break;
+ if (servaddrin_config) {
+ if (num == 4) {
+ errexit("No webserver specified in config file for %s\n", clienthostname[cnt]);
+ }
+ strcpy(webserver, webserver2);
+ }
+
+ if (numclients <= 0)
+ errexit("Number of clients must be >= 0\n");
+ if (numclients > MAXPROCSPERNODE)
+ {
+ errexit("Number of clients per node can't exceed %d\n", MAXPROCSPERNODE);
+ }
totalnumclients += numclients;
- primename = pick_webmaster_IP_address(clienthostname[cnt], master_phe, network_mask);
- if (primename == 0) {
- errexit("Bad client address %s for Client %d\n", clienthostname[cnt], cnt);
- }
+ primename = pick_webmaster_IP_address(clienthostname[cnt], master_phe, network_mask);
+ if (primename == 0) {
+ errexit("Bad client address %s for Client %d\n", clienthostname[cnt], cnt);
+ }
fprintf(stdout,"Client %d: %s \t# Processes: %d\n Webserver: %s\tWebmaster: %s:%d\n",
- cnt, clienthostname[cnt], numclients, webserver, primename,
- ntohs(serveraddr->sin_port));
- fflush(stdout);
+ cnt, clienthostname[cnt], numclients, webserver, primename,
+ ntohs(serveraddr->sin_port));
+ fflush(stdout);
sprintf(tmpcommandline, commandline, numclients, webserver, primename,
- ntohs(serveraddr->sin_port));
+ ntohs(serveraddr->sin_port));
fprintf(stderr, "tmpcommandline: %s\n", tmpcommandline);
- D_PRINTF( "%s rexec %s\n",&clienthostname[cnt],tmpcommandline );
- if (norexec) {
- sleep(30); /* gives some time to start clients for debugging */
- } else {
-
- tmphostname = &(clienthostname[cnt][0]);
- tmpfd = rexec(&tmphostname, inetport->s_port, login, password,
- tmpcommandline, &sockErr[cnt]);
- if((sockIO[cnt] = tmpfd) < 0)
- {
- errexit("Could not rexec: rexec to client %s, cmdline %s failed\n",
- clienthostname[cnt],tmpcommandline);
- }
- }
-
-
- returnval = NETREAD(tmpfd, buffer, OKSTRLEN);
- D_PRINTF( "read returns %d, %s\n", returnval, buffer );
-
- if (returnval <= 0 || memcmp(buffer, OKSTR, OKSTRLEN) != 0)
- {
+ D_PRINTF( "%s rexec %s\n",&clienthostname[cnt],tmpcommandline );
+ if (norexec) {
+ sleep(30); /* gives some time to start clients for debugging */
+ } else {
+
+ tmphostname = &(clienthostname[cnt][0]);
+ tmpfd = rexec(&tmphostname, inetport->s_port, login, password,
+ tmpcommandline, &sockErr[cnt]);
+ if((sockIO[cnt] = tmpfd) < 0)
+ {
+ errexit("Could not rexec: rexec to client %s, cmdline %s failed\n",
+ clienthostname[cnt],tmpcommandline);
+ }
+ }
+
+
+ returnval = NETREAD(tmpfd, buffer, OKSTRLEN);
+ D_PRINTF( "read returns %d, %s\n", returnval, buffer );
+
+ if (returnval <= 0 || memcmp(buffer, OKSTR, OKSTRLEN) != 0)
+ {
errexit("rexec to client %s, cmdline %s received error %s\n",
- clienthostname[cnt],tmpcommandline, buffer);
- }
+ clienthostname[cnt],tmpcommandline, buffer);
+ }
- cnt++;
- if (cnt > MAXCLIENTS || cnt > FD_SETSIZE)
- {
- errexit("Number of Clients can't exceed %d\n", MAXCLIENTS);
- }
+ cnt++;
+ if (cnt > MAXCLIENTS || cnt > FD_SETSIZE)
+ {
+ errexit("Number of Clients can't exceed %d\n", MAXCLIENTS);
+ }
}
num_rexecs = cnt;
if (totalnumclients > MAXTOTALPROCS)
{
errexit("Total number of processes can't exceed %d\n",
- MAXTOTALPROCS);
+ MAXTOTALPROCS);
}
#ifndef WIN32
@@ -758,14 +758,14 @@ struct sockaddr_in *serveraddr;
*/
D_PRINTF( "Forking webclient stderr/stdout processes\n" );
switch (fork())
- {
- case -1: /* ERROR */
- errexit("fork: %s\n", strerror(errno));
- case 0: /* CHILD */
- exit(echo_client(clienthostname[cnt], tmpfd));
- default: /* PARENT */
- break;
- }
+ {
+ case -1: /* ERROR */
+ errexit("fork: %s\n", strerror(errno));
+ case 0: /* CHILD */
+ exit(echo_client(clienthostname[cnt], tmpfd));
+ default: /* PARENT */
+ break;
+ }
#else
/* start threads to echo stdout/stderr from clients */
_beginthread(echo_client, 0, (void *)0);
@@ -786,7 +786,7 @@ int sock;
{
int cnt,len;
fd_set tmpfdset, leftfdset;
- char buffer[NCCARGS];
+ char buffer[NCCARGS];
/*
* NOW WE NEED TO ACCEPT ALL THE CONNECTIONS FROM THE CLIENTS,
@@ -796,28 +796,28 @@ int sock;
D_PRINTF( "Beginning accept loop\n" );
for (cnt = 0; cnt < totalnumclients; cnt++)
{
- D_PRINTF( "Client %d:\t", cnt );
-
- {
- fd_set readfds;
- struct timeval timeout;
- int rv;
-
- timeout.tv_sec = MAX_ACCEPT_SECS;
- timeout.tv_usec = 0;
- FD_ZERO(&readfds);
- FD_SET(sock, &readfds);
-
- /* if we're hung, quit */
- D_PRINTF("Before select() on listen() socket\n");
- if (!(rv = select(FD_SETSIZE, &readfds, 0, 0, &timeout))) {
- fprintf(stdout,
- "Listen timeout after %d seconds (%d clients so far)\n",
- MAX_ACCEPT_SECS, cnt);
- D_PRINTF("select() timed out after %d seconds\n", MAX_ACCEPT_SECS);
- errexit("Webmaster terminating\n");
- }
- }
+ D_PRINTF( "Client %d:\t", cnt );
+
+ {
+ fd_set readfds;
+ struct timeval timeout;
+ int rv;
+
+ timeout.tv_sec = MAX_ACCEPT_SECS;
+ timeout.tv_usec = 0;
+ FD_ZERO(&readfds);
+ FD_SET(sock, &readfds);
+
+ /* if we're hung, quit */
+ D_PRINTF("Before select() on listen() socket\n");
+ if (!(rv = select(FD_SETSIZE, &readfds, 0, 0, &timeout))) {
+ fprintf(stdout,
+ "Listen timeout after %d seconds (%d clients so far)\n",
+ MAX_ACCEPT_SECS, cnt);
+ D_PRINTF("select() timed out after %d seconds\n", MAX_ACCEPT_SECS);
+ errexit("Webmaster terminating\n");
+ }
+ }
if(BADSOCKET(socknum[cnt] = accept(sock, 0, 0)))
{
@@ -834,7 +834,7 @@ int sock;
*/
FD_SET(socknum[cnt],fdset);
}
- D_PRINTF( "on socket %d\n",socknum[cnt] );
+ D_PRINTF( "on socket %d\n",socknum[cnt] );
}
D_PRINTF( "\n" );
@@ -857,7 +857,7 @@ int sock;
*/
abort_clients();
errexit("Error accepting from one of the clients: %s\n",
- neterrstr());
+ neterrstr());
break;
}
#else
@@ -880,17 +880,17 @@ int sock;
* GET THE READY FROM THIS GUY.
* DON'T FORGET TO CLEAR HIS BIT IN THE tmpfdset
*/
- len = NETREAD(socknum[cnt],buffer,READYSTRLEN);
+ len = NETREAD(socknum[cnt],buffer,READYSTRLEN);
if(len != READYSTRLEN)
{
abort_clients();
errexit("Error reading from client #%d\n", cnt);
}
if(memcmp(buffer, READYSTR, READYSTRLEN))
- {
+ {
abort_clients();
fprintf(stdout,"Received bad READY string: len %d, value %s\n",
- len,buffer);
+ len,buffer);
}
FD_CLR(socknum[cnt],&leftfdset);
}
@@ -917,13 +917,13 @@ int *socknum;
{
if(socknum[cnt] > 0)
{
- /*
- * SEND A GO
- */
- if(NETWRITE(socknum[cnt], GOSTR, GOSTRLEN) != GOSTRLEN)
+ /*
+ * SEND A GO
+ */
+ if(NETWRITE(socknum[cnt], GOSTR, GOSTRLEN) != GOSTRLEN)
{
- abort_clients();
- errexit("Error sending GO to client %d: %s\n", cnt, neterrstr());
+ abort_clients();
+ errexit("Error sending GO to client %d: %s\n", cnt, neterrstr());
}
}
}
@@ -934,7 +934,7 @@ int *socknum;
*/
void GetResults(fdset, page_stats, endtime, timestr, totalnumclients,
- statarray)
+ statarray)
fd_set *fdset;
page_stats_t **page_stats;
time_t *endtime;
@@ -972,17 +972,17 @@ stats_t statarray[MAXCLIENTS];
#ifndef WIN32
while(memcmp(&leftfdset,&zerofdset,sizeof(fd_set)))
{
- tmpfdset = leftfdset;
- sleep(1);
- returnval = select(FD_SETSIZE,&tmpfdset,NULL,NULL,NULL);
- D_PRINTF( "Call to select returned %d, errno %d\n",
- returnval, errno );
+ tmpfdset = leftfdset;
+ sleep(1);
+ returnval = select(FD_SETSIZE,&tmpfdset,NULL,NULL,NULL);
+ D_PRINTF( "Call to select returned %d, errno %d\n",
+ returnval, errno );
if(returnval < 0)
{
/*
* ERROR SELECTING. ABORT ALL.
*/
- D_PRINTF( "select() error %s\n", neterrstr() );
+ D_PRINTF( "select() error %s\n", neterrstr() );
abort_clients();
errexit("Error selecting from one of the clients\n");
}
@@ -991,84 +991,84 @@ stats_t statarray[MAXCLIENTS];
tmpfdset = leftfdset;
{
#endif /* WIN32 */
- for(cnt = 0; cnt < totalnumclients; cnt++)
- {
- /*
- * SEE WHICH SOCKETS HAVE A INPUT ON THEM PENDING AND
- * RECEIVE IT.
- */
-
- /* IS THIS A VALID SOCKET? IS IT READY TO READ? */
- if(!BADSOCKET(socknum[cnt]) && (FD_ISSET(socknum[cnt],&tmpfdset)))
- {
- int len;
-
- /*
- * GET THE TIMING DATA FROM THIS GUY
- * THEN REMOVE HIM FROM THE tmpfdset
- */
- /*
- * READ TIME STATS
- * DOES READ() RETURN THE CORRECT LENGTH?
- */
- D_PRINTF( "About to read timestats, count %d, errno %d\n",
- cnt, errno );
- len = SIZEOF_STATSTEXTBASE + number_of_pages*SIZEOF_DOUBLETEXT;
- returnval = recvdata(socknum[cnt], stats_as_text,
- len);
- D_PRINTF( "Read time stats %d\n", returnval );
- if (returnval != len) /* <= 0) */
- {
- D_PRINTF( "Error reading timing stats: %s\n",
- neterrstr() );
- fprintf(stderr, "Error reading timing stats: %s\nSocket number %d\n",
- neterrstr(),socknum[cnt]);
- abort_clients();
- errexit("");
- } /* end if */
-
- /* convert text to stats */
- stats_as_text[returnval] = 0; /* add an end marker */
- statarray[cnt] = *text_to_stats(stats_as_text);
-
- fputc('.', stdout); /* PROGRESS MARKER */
- fflush(stdout);
-
- if(uil_filelist_f) /* READ PAGE STATS */
- {
- for (i = 0; i < number_of_pages; i++)
- {
- D_PRINTF( "On page_stats[%d][%d]\n", cnt, i );
- returnval = recvdata(socknum[cnt], page_stats_as_text,
- SIZEOF_PAGESTATSTEXT);
- D_PRINTF( "Read page stats %d\n", returnval );
-
- if (returnval != SIZEOF_PAGESTATSTEXT) /* <= 0) */
- {
- D_PRINTF( "Error reading page_stats[%d][%d]: %s\n",
- cnt, i, neterrstr() );
- fprintf(stderr, "Error reading page_stats[%d][%d]: %s\n",
- cnt, i, neterrstr());
- abort_clients();
- errexit("");
- }
- D_PRINTF( "Page stats: read %d bytes\n",
- returnval );
-
- page_stats_as_text[returnval] = 0; /* add an end marker */
- D_PRINTF("strlen(page_stats_as_text) = %d\n",
- strlen(page_stats_as_text));
- page_stats[cnt][i] =
- *text_to_page_stats(page_stats_as_text);
-
- } /* end for */
- } /* end if filelist */
-
- FD_CLR(socknum[cnt],&leftfdset);
- NETCLOSE(socknum[cnt]);
- socknum[cnt] = BADSOCKET_VALUE;
- } /* end if socknum */
- } /* end for cnt */
+ for(cnt = 0; cnt < totalnumclients; cnt++)
+ {
+ /*
+ * SEE WHICH SOCKETS HAVE A INPUT ON THEM PENDING AND
+ * RECEIVE IT.
+ */
+
+ /* IS THIS A VALID SOCKET? IS IT READY TO READ? */
+ if(!BADSOCKET(socknum[cnt]) && (FD_ISSET(socknum[cnt],&tmpfdset)))
+ {
+ int len;
+
+ /*
+ * GET THE TIMING DATA FROM THIS GUY
+ * THEN REMOVE HIM FROM THE tmpfdset
+ */
+ /*
+ * READ TIME STATS
+ * DOES READ() RETURN THE CORRECT LENGTH?
+ */
+ D_PRINTF( "About to read timestats, count %d, errno %d\n",
+ cnt, errno );
+ len = SIZEOF_STATSTEXTBASE + number_of_pages*SIZEOF_DOUBLETEXT;
+ returnval = recvdata(socknum[cnt], stats_as_text,
+ len);
+ D_PRINTF( "Read time stats %d\n", returnval );
+ if (returnval != len) /* <= 0) */
+ {
+ D_PRINTF( "Error reading timing stats: %s\n",
+ neterrstr() );
+ fprintf(stderr, "Error reading timing stats: %s\nSocket number %d\n",
+ neterrstr(),socknum[cnt]);
+ abort_clients();
+ errexit("");
+ } /* end if */
+
+ /* convert text to stats */
+ stats_as_text[returnval] = 0; /* add an end marker */
+ statarray[cnt] = *text_to_stats(stats_as_text);
+
+ fputc('.', stdout); /* PROGRESS MARKER */
+ fflush(stdout);
+
+ if(uil_filelist_f) /* READ PAGE STATS */
+ {
+ for (i = 0; i < number_of_pages; i++)
+ {
+ D_PRINTF( "On page_stats[%d][%d]\n", cnt, i );
+ returnval = recvdata(socknum[cnt], page_stats_as_text,
+ SIZEOF_PAGESTATSTEXT);
+ D_PRINTF( "Read page stats %d\n", returnval );
+
+ if (returnval != SIZEOF_PAGESTATSTEXT) /* <= 0) */
+ {
+ D_PRINTF( "Error reading page_stats[%d][%d]: %s\n",
+ cnt, i, neterrstr() );
+ fprintf(stderr, "Error reading page_stats[%d][%d]: %s\n",
+ cnt, i, neterrstr());
+ abort_clients();
+ errexit("");
+ }
+ D_PRINTF( "Page stats: read %d bytes\n",
+ returnval );
+
+ page_stats_as_text[returnval] = 0; /* add an end marker */
+ D_PRINTF("strlen(page_stats_as_text) = %d\n",
+ strlen(page_stats_as_text));
+ page_stats[cnt][i] =
+ *text_to_page_stats(page_stats_as_text);
+
+ } /* end for */
+ } /* end if filelist */
+
+ FD_CLR(socknum[cnt],&leftfdset);
+ NETCLOSE(socknum[cnt]);
+ socknum[cnt] = BADSOCKET_VALUE;
+ } /* end if socknum */
+ } /* end for cnt */
} /* end while memcmp fd */
/*
@@ -1090,7 +1090,7 @@ stats_t statarray[MAXCLIENTS];
Prints out all the results
*/
void PrintResults( page_stats, endtime, timestr, totalnumclients, statarray,
- page_stats_total)
+ page_stats_total)
page_stats_t **page_stats;
time_t endtime;
char *timestr;
@@ -1098,10 +1098,10 @@ int totalnumclients;
stats_t statarray[MAXCLIENTS];
page_stats_t *page_stats_total;
{
- stats_t masterstat;
+ stats_t masterstat;
int cnt,i,j;
- double thruput;
- struct timeval dtime;
+ double thruput;
+ struct timeval dtime;
/*
* PRINT EVERYTHING OUT
@@ -1114,77 +1114,77 @@ page_stats_t *page_stats_total;
fprintf(stdout,"----------------------------------\n");
/* fprintf(stdout,"Test for host: %s\n",statarray[cnt].hostname); */
fprintf(stdout,"Total number of pages retrieved from server: %u\n",
- statarray[cnt].totalpages);
-
- rqstat_fprint(stdout, &(statarray[cnt].rs));
-
- thruput = thruputpersec((double)(statarray[cnt].rs.totalbytes),
- &(statarray[cnt].rs.totalresponsetime));
-
- fprintf(stdout, "Thruput average per connection: %.0f bytes/sec\n",
- thruput);
+ statarray[cnt].totalpages);
+
+ rqstat_fprint(stdout, &(statarray[cnt].rs));
+
+ thruput = thruputpersec((double)(statarray[cnt].rs.totalbytes),
+ &(statarray[cnt].rs.totalresponsetime));
+
+ fprintf(stdout, "Thruput average per connection: %.0f bytes/sec\n",
+ thruput);
}
if(statarray[cnt].rs.totalconnects > 0)
{
- D_PRINTF( "Summing stats for %d, with %ld total connections\n",
- cnt, statarray[cnt].rs.totalconnects );
+ D_PRINTF( "Summing stats for %d, with %ld total connections\n",
+ cnt, statarray[cnt].rs.totalconnects );
rqstat_sum(&masterstat.rs, &(statarray[cnt].rs));
}
- else
- {
- masterstat.rs.totalerrs += statarray[cnt].rs.totalerrs;
- }
+ else
+ {
+ masterstat.rs.totalerrs += statarray[cnt].rs.totalerrs;
+ }
}
for (i=0; i < totalnumclients; i++)
{
- for (j=0; j < number_of_pages; j++)
- {
- D_PRINTF( "Summing page stats for %d, page %d, with %d connects\n",
- i, j, statarray[i].page_numbers[j] );
+ for (j=0; j < number_of_pages; j++)
+ {
+ D_PRINTF( "Summing page stats for %d, page %d, with %d connects\n",
+ i, j, statarray[i].page_numbers[j] );
- if (statarray[i].page_numbers[j] != 0)
- {
- rqst_stats_t *pst_rs;
- rqst_stats_t *ps_rs;
+ if (statarray[i].page_numbers[j] != 0)
+ {
+ rqst_stats_t *pst_rs;
+ rqst_stats_t *ps_rs;
- pst_rs = &(page_stats_total[j].rs);
- ps_rs = &(page_stats[i][j].rs);
+ pst_rs = &(page_stats_total[j].rs);
+ ps_rs = &(page_stats[i][j].rs);
- rqstat_sum(pst_rs, ps_rs);
+ rqstat_sum(pst_rs, ps_rs);
- page_stats_total[j].totalpages += page_stats[i][j].totalpages;
- masterstat.totalpages += page_stats[i][j].totalpages;
+ page_stats_total[j].totalpages += page_stats[i][j].totalpages;
+ masterstat.totalpages += page_stats[i][j].totalpages;
- /* yes, this is assignment, not sum */
- page_stats_total[j].page_size = page_stats[i][j].page_size;
+ /* yes, this is assignment, not sum */
+ page_stats_total[j].page_size = page_stats[i][j].page_size;
- page_stats_total[j].page_valid = 1;
- }
- }
+ page_stats_total[j].page_valid = 1;
+ }
+ }
}
/* print page statistics */
if (verbose) {
- for (i = 0; i < number_of_pages; i++)
- {
- if (page_stats_total[i].page_valid == 1)
- {
- page_stats_t *pst;
+ for (i = 0; i < number_of_pages; i++)
+ {
+ if (page_stats_total[i].page_valid == 1)
+ {
+ page_stats_t *pst;
- pst = &(page_stats_total[i]);
+ pst = &(page_stats_total[i]);
- printf ("===============================================================================\n");
- printf ("Page # %d\n\n", i);
- printf ("Total number of times page was hit %u\n",
- pst->totalpages);
+ printf ("===============================================================================\n");
+ printf ("Page # %d\n\n", i);
+ printf ("Total number of times page was hit %u\n",
+ pst->totalpages);
- rqstat_print(&(pst->rs));
+ rqstat_print(&(pst->rs));
- printf ("Page size %u \n", pst->page_size);
- printf ("===============================================================================\n\n");
- }
- }
+ printf ("Page size %u \n", pst->page_size);
+ printf ("===============================================================================\n\n");
+ }
+ }
}
fprintf(stdout,"===============================================================================\n");
@@ -1196,14 +1196,14 @@ page_stats_t *page_stats_total;
for (i=1; i < totalnumclients; i++)
{
if ((statarray[i].rs.totalconnects > 0) &&
- (statarray[i].total_num_of_files != masterstat.total_num_of_files))
- {
- fprintf(stdout,"**********************************************************************\n");
- fprintf(stdout,"**** ERROR: number of files in each test configuration is not the same\n");
- fprintf(stdout,"**** ERROR: Check configuration file %s on each client\n", configfile);
- fprintf(stdout,"**********************************************************************\n");
- break;
- }
+ (statarray[i].total_num_of_files != masterstat.total_num_of_files))
+ {
+ fprintf(stdout,"**********************************************************************\n");
+ fprintf(stdout,"**** ERROR: number of files in each test configuration is not the same\n");
+ fprintf(stdout,"**** ERROR: Check configuration file %s on each client\n", configfile);
+ fprintf(stdout,"**********************************************************************\n");
+ break;
+ }
}
@@ -1229,28 +1229,28 @@ page_stats_t *page_stats_total;
(double)(masterstat.rs.totalresponsetime.tv_sec)
/(testtime));
avgtime(&masterstat.rs.totalresponsetime,
- masterstat.rs.totalconnects, &dtime);
+ masterstat.rs.totalconnects, &dtime);
fprintf(stdout, "Average response time: \t\t%4.4f millisec\n",
- (double)1000*(dtime.tv_sec + (double)dtime.tv_usec / 1000000));
+ (double)1000*(dtime.tv_sec + (double)dtime.tv_usec / 1000000));
fprintf(stdout, "Error Level:\t\t\t%4.4f %%\n",
- (double)(100 * masterstat.rs.totalerrs)/(masterstat.rs.totalconnects));
+ (double)(100 * masterstat.rs.totalerrs)/(masterstat.rs.totalconnects));
/* so much for the key metrics */
thruput = 8 * thruputpersec((double)(masterstat.rs.totalbytes),
- &(masterstat.rs.totalresponsetime));
-
+ &(masterstat.rs.totalresponsetime));
+
fprintf(stdout, "Average client thruput: \t%4.4f Mbit/sec\n",
- thruput/(1024*1024));
+ thruput/(1024*1024));
fprintf(stdout,"Sum of client response times:\t%u.%u sec\n",
- masterstat.rs.totalresponsetime.tv_sec,
- masterstat.rs.totalresponsetime.tv_usec);
+ masterstat.rs.totalresponsetime.tv_sec,
+ masterstat.rs.totalresponsetime.tv_usec);
fprintf(stdout,"Total number of pages read:\t%u\n\n",
- masterstat.totalpages);
+ masterstat.totalpages);
/* Remaining stats are the same as usual */
@@ -1271,29 +1271,29 @@ void
main(const int argc, char *argv[])
{
- int sync_sock;
- int i;
- int j;
- char buffer[NCCARGS];
- char commandline[NCCARGS];
- char *timestr;
- time_t starttime;
- time_t endtime;
- fd_set fdset;
+ int sync_sock;
+ int i;
+ int j;
+ char buffer[NCCARGS];
+ char commandline[NCCARGS];
+ char *timestr;
+ time_t starttime;
+ time_t endtime;
+ fd_set fdset;
/* make the big arrays static to avoid stack overflow */
- static char clienthostname[MAXCLIENTS][MAXHOSTNAMELEN];
- static stats_t statarray[MAXCLIENTS];
+ static char clienthostname[MAXCLIENTS][MAXHOSTNAMELEN];
+ static stats_t statarray[MAXCLIENTS];
page_stats_t **page_stats;
page_stats_t *page_stats_total;
- struct sockaddr_in serveraddr;
+ struct sockaddr_in serveraddr;
#ifdef WIN32
- WSADATA WSAData;
- COORD dwSize;
+ WSADATA WSAData;
+ COORD dwSize;
if ((WSAStartup(MAKEWORD(1,1), &WSAData)) != 0) {
- errexit("Error in WSAStartup()\n");
+ errexit("Error in WSAStartup()\n");
}
atexit(sock_cleanup);
@@ -1334,8 +1334,8 @@ main(const int argc, char *argv[])
mymalloc(totalnumclients*sizeof(page_stats_t *));
for (i=0; i < totalnumclients; i++)
{
- page_stats[i] = (page_stats_t *)
- mymalloc(number_of_pages*sizeof(page_stats_t));
+ page_stats[i] = (page_stats_t *)
+ mymalloc(number_of_pages*sizeof(page_stats_t));
}
page_stats_total =
(page_stats_t *)mymalloc(number_of_pages*sizeof(page_stats_t));
@@ -1346,7 +1346,7 @@ main(const int argc, char *argv[])
for (i=0; i < totalnumclients; i++) {
for (j=0; j < number_of_pages; j++) {
page_stats_init(&(page_stats[i][j]));
- }
+ }
}
for (i=0; i < number_of_pages; i++) {
page_stats_init(&(page_stats_total[i]));
@@ -1387,16 +1387,16 @@ main(const int argc, char *argv[])
}
GetResults( &fdset, page_stats, &endtime, timestr, totalnumclients,
- statarray);
+ statarray);
gettimeofday (&sumedh_end, 0);
PrintResults( page_stats, endtime, timestr, totalnumclients, statarray,
- page_stats_total);
+ page_stats_total);
/* free memory */
for (i = 0; i < totalnumclients; i++)
{
- free(page_stats[i]);
+ free(page_stats[i]);
}
free(page_stats);
free(page_stats_total);
@@ -1408,13 +1408,12 @@ main(const int argc, char *argv[])
void
HostEntCpy(struct hostent *dest, struct hostent *src)
{
-
- dest->h_name = (char *)malloc(strlen(src->h_name)+1);
- strcpy(dest->h_name, src->h_name);
- printf("WebMaster name = %s\n", dest->h_name);
- dest->h_aliases = src->h_aliases;
- dest->h_addrtype = src->h_addrtype;
- dest->h_length = src->h_length;
- dest->h_addr_list = src->h_addr_list;
+
+ dest->h_name = (char *)malloc(strlen(src->h_name)+1);
+ strcpy(dest->h_name, src->h_name);
+ printf("WebMaster name = %s\n", dest->h_name);
+ dest->h_aliases = src->h_aliases;
+ dest->h_addrtype = src->h_addrtype;
+ dest->h_length = src->h_length;
+ dest->h_addr_list = src->h_addr_list;
}
-