summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorsumedh <sumedh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-03-08 01:29:21 +0000
committersumedh <sumedh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-03-08 01:29:21 +0000
commit78ca6a986f617e3e1e4f66e02a30332c20ec220c (patch)
tree50992ba41db42c98d3bf04a123f1fb22a82db3b1 /apps
parentaf349c63187a0a340385b39aa159703574e585c4 (diff)
downloadATCD-78ca6a986f617e3e1e4f66e02a30332c20ec220c.tar.gz
Changed logging stuff
Diffstat (limited to 'apps')
-rw-r--r--apps/JAWS/clients/benchd.cpp24
-rw-r--r--apps/JAWS/clients/config10
-rw-r--r--apps/JAWS/clients/global.h3
-rw-r--r--apps/JAWS/clients/http_tester.cpp20
4 files changed, 30 insertions, 27 deletions
diff --git a/apps/JAWS/clients/benchd.cpp b/apps/JAWS/clients/benchd.cpp
index f1055eac671..306d8f06317 100644
--- a/apps/JAWS/clients/benchd.cpp
+++ b/apps/JAWS/clients/benchd.cpp
@@ -1,6 +1,7 @@
// benchd: Adapted from the "ntalker" example.
// Sumedh Mungee
+#include "ace/Process.h"
#include "ace/INET_Addr.h"
#include "ace/SOCK_Dgram_Mcast.h"
#include "ace/Reactor.h"
@@ -21,6 +22,8 @@ static int QUIET = 0;
static const char *INTERFACE = "le0";
static const char *MCAST_ADDR = ACE_DEFAULT_MULTICAST_ADDR;
static const u_short UDP_PORT = ACE_DEFAULT_MULTICAST_PORT;
+static const char *OUTPUT_FILE_NAME = "benchd.log";
+static ACE_HANDLE OUTPUT_FILE;
// Handle both multicast and stdin events.
@@ -78,17 +81,7 @@ Handle_Events::handle_input (ACE_HANDLE h)
<< " on port " << remote_addr.get_port_number ()
<< " bytes = " << retcode << endl;
*/
- switch(ACE_OS::fork()) {
- case -1:
- ACE_OS::perror ("fork");
- return -1;
- case 0:
- ACE_OS::exit(serve(buf));
- default:
- /* ACE_OS::write (ACE_STDOUT, buf, retcode);
- cout << endl; */
- break;
- }
+ serve(buf);
return 0;
}
@@ -158,7 +151,8 @@ int
Handle_Events::serve(char *buf) {
ACE_ARGV arguments(buf);
if(ACE_OS::strcmp(arguments[0],TESTER) == 0) {
- return ACE_OS::execvp(TESTER, arguments.argv());
+ ACE_Process p(arguments.argv(), ACE_INVALID_HANDLE, OUTPUT_FILE, OUTPUT_FILE);
+ return 0;
}
}
@@ -199,9 +193,14 @@ int
main (int argc, char *argv[])
{
ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);
+ ACE_OS::signal(SIGCLD, SIG_IGN);
ACE_UNUSED_ARG (sa);
parse_args (argc, argv);
+
+ OUTPUT_FILE = ACE_OS::open(OUTPUT_FILE_NAME, O_CREAT | O_WRONLY, 0644);
+ if(OUTPUT_FILE == 0)
+ return 1;
ACE_Reactor reactor;
Handle_Events handle_events (UDP_PORT, MCAST_ADDR, INTERFACE, reactor);
@@ -211,6 +210,7 @@ main (int argc, char *argv[])
while (!done)
reactor.handle_events ();
+ ACE_OS::close(OUTPUT_FILE);
cout << "\nbenchd done.\n";
return 0;
}
diff --git a/apps/JAWS/clients/config b/apps/JAWS/clients/config
index 2f695ca7c37..29c39c66610 100644
--- a/apps/JAWS/clients/config
+++ b/apps/JAWS/clients/config
@@ -1,6 +1,6 @@
-1.0 50 10 http://mambo:5432/~sumedh/testdata/smallfile.txt 1 a 0 b 0 1 65536
-2.0 50 20 http://mambo:5432/~sumedh/testdata/smallfile.txt 1 a 0 b 0 1 65536
-3.0 50 30 http://mambo:5432/~sumedh/testdata/smallfile.txt 1 a 0 b 0 1 65536
-4.0 50 40 http://mambo:5432/~sumedh/testdata/smallfile.txt 1 a 0 b 0 1 65536
-5.0 50 50 http://mambo:5432/~sumedh/testdata/smallfile.txt 1 a 0 b 0 1 65536
+1.0 50 10 http://mambo:2222/~sumedh/testdata/smallfile.txt 1 a 0 b 0 1 65536
+2.0 50 20 http://mambo:2222/~sumedh/testdata/smallfile.txt 1 a 0 b 0 1 65536
+3.0 50 30 http://mambo:2222/~sumedh/testdata/smallfile.txt 1 a 0 b 0 1 65536
+4.0 50 40 http://mambo:2222/~sumedh/testdata/smallfile.txt 1 a 0 b 0 1 65536
+5.0 50 50 http://mambo:2222/~sumedh/testdata/smallfile.txt 1 a 0 b 0 1 65536
diff --git a/apps/JAWS/clients/global.h b/apps/JAWS/clients/global.h
index bdf430537d1..ad70dcca23b 100644
--- a/apps/JAWS/clients/global.h
+++ b/apps/JAWS/clients/global.h
@@ -4,6 +4,7 @@
#include <signal.h>
#include <string.h>
#include <iostream.h>
+#include <fstream.h>
#include <stdlib.h>
#include <fcntl.h>
#include <signal.h>
@@ -19,9 +20,11 @@
#include <ace/Thread.h>
#include <ace/Thread_Manager.h>
#include <ace/Service_Config.h>
+#include <ace/Log_Msg.h>
#include <math.h>
+#define ERRLOG "http_tester.errors"
#ifndef extern_c_symbols
#define extern_c_symbols
diff --git a/apps/JAWS/clients/http_tester.cpp b/apps/JAWS/clients/http_tester.cpp
index c29538633ae..f3f86a9a42b 100644
--- a/apps/JAWS/clients/http_tester.cpp
+++ b/apps/JAWS/clients/http_tester.cpp
@@ -15,7 +15,7 @@ static void *client_thread(void *data) {
// Check for presence of protocol, hostname and filename.
if(!(u->get_protocol() && u->get_hostname() && u->get_filename())) {
- cerr << "Invalid URL" << endl;
+ ACE_DEBUG((LM_DEBUG, "Invalid URL"));
return NULL;
}
@@ -78,7 +78,7 @@ int driver(char *id, int total_num, float requests_sec, char *url1, float p1, ch
for(int i = 0; i < total_num; i++) { // i is used as a id for threads
ACE_Profile_Timer timer;
if(sleep_time < delta) {
- cerr << "Requested rate is too high, sorry! " << endl;
+ ACE_DEBUG((LM_ERROR,"Requested rate is too high, sorry! "));
return 2;
}
ACE_Time_Value tv(0, sleep_time - delta);
@@ -119,13 +119,13 @@ main(int argc, char **argv)
ACE_High_Res_Timer::get_env_global_scale_factor ();
if(argc < 3) {
- cerr << "Usage: " << argv[0] << " infile outfile " << endl;
- cerr << "The input file contains lines, with the following fields: " << endl;
- cerr << "experiment_id total_number_of_requests request_rate url1 p1 url2 p2 url3 p3 TCP_NODELAY SOCKET_RECV_BUFSIZ " << endl;
-
+ // cerr << "Usage: " << argv[0] << " infile outfile " << endl;
+ // cerr << "The input file contains lines, with the following fields: " << endl;
+ // cerr << "experiment_id total_number_of_requests request_rate url1 p1 url2 p2 url3 p3 TCP_NODELAY SOCKET_RECV_BUFSIZ " << endl;
return 1;
}
-
+
+
FILE *fp = fopen(argv[1],"r");
if(fp == NULL) {
perror("fopen");
@@ -148,9 +148,9 @@ main(int argc, char **argv)
while(!feof(fp)) {
- fscanf(fp,"%s %d %f %s %f %s %f %s %f %d %d\n", id, &total_num, &rate, url1, &p1, url2, &p2, url3, &p3, &tcp, &sock);
- fprintf(stderr,"----\n");
- fprintf(stderr,"\tNow performing experiment:%s\n\tSending %d requests at %f requests/second\n", id, total_num, rate);
+ fscanf(fp,"%s %d %f %s %f %s %f %s %f %d %d\n", id, &total_num, &rate, url1, &p1, url2, &p2, url3, &p3, &tcp, &sock);
+ //fprintf(stderr,"----\n");
+ //fprintf(stderr,"\tNow performing experiment:%s\n\tSending %d requests at %f requests/second\n", id, total_num, rate);
driver(id, total_num, rate, url1, p1, url2, p2, url3, p3, tcp, sock);
}
fclose(fp);