[netperf-dev] netperf4 commit notice r15 - trunk/src
raj at netperf.org
raj at netperf.org
Fri Nov 11 11:12:58 PST 2005
Author: raj
Date: 2005-11-11 11:12:56 -0800 (Fri, 11 Nov 2005)
New Revision: 15
Modified:
trunk/src/netmsg.c
trunk/src/netperf.c
trunk/src/netperf.h
trunk/src/netserver.c
Log:
Added a NETPERF_DEBUG_EXIT macro - should probably go varargs one day...
Made more complete use of __func__ to set err_fn.
Netserver is iterating in "full forground" (forground >= 2) mode but this
has uncovered a little hole/bug - when the control connection is closed,
the netserver really should go and kill all the tests associated with that
control connection. Presently they are still there, and it is only by chance
that the next netperf invocation "works" - the second set of tests have the
same names as the first set of test, but the second set are found thanks
to the way they are put into the hash. Otherwise, I suspect it would go
dead stop.
Modified: trunk/src/netmsg.c
===================================================================
--- trunk/src/netmsg.c 2005-11-11 01:21:51 UTC (rev 14)
+++ trunk/src/netmsg.c 2005-11-11 19:12:56 UTC (rev 15)
@@ -827,7 +827,7 @@
if (rc != NPE_SUCCESS) {
new_test->state = TEST_ERROR;
new_test->err_rc = rc;
- new_test->err_fn = "test_message";
+ new_test->err_fn = "__func__";
rc = NPE_TEST_INIT_FAILED;
break;
}
@@ -879,7 +879,7 @@
if (stats == NULL) {
test->state = TEST_ERROR;
test->err_rc = NPE_SYS_STATS_DROPPED;
- test->err_fn = "sys_stats_message";
+ test->err_fn = "__func__";
}
}
return(rc);
@@ -911,7 +911,7 @@
if (stats == NULL) {
test->state = TEST_ERROR;
test->err_rc = NPE_TEST_STATS_DROPPED;
- test->err_fn = "test_stats_message";
+ test->err_fn = "__func__";
}
}
return(rc);
Modified: trunk/src/netperf.c
===================================================================
--- trunk/src/netperf.c 2005-11-11 01:21:51 UTC (rev 14)
+++ trunk/src/netperf.c 2005-11-11 19:12:56 UTC (rev 15)
@@ -688,7 +688,7 @@
} else {
pthread_mutex_lock(server->lock);
server->state = NSRV_ERROR;
- server->err_fn = "wait_for_version_response";
+ server->err_fn = "__func__";
if (rc == 0) {
server->err_rc = NPE_REMOTE_CLOSE;
} else {
@@ -709,7 +709,7 @@
server->state_req = NSRV_WORK;
} else {
server->state = NSRV_ERROR;
- server->err_fn = "wait_for_version_response";
+ server->err_fn = "__func__";
server->err_rc = rc;
}
}
@@ -718,10 +718,9 @@
report_server_error(server);
}
pthread_mutex_unlock(server->lock);
- if (debug) {
- fprintf(where,"exiting wait_for_version_response\n");
- fflush(where);
- }
+
+ NETPERF_DEBUG_EXIT(debug,where);
+
return rc;
}
@@ -765,7 +764,7 @@
if (rc != NPE_SUCCESS) {
test->state = TEST_ERROR;
test->err_rc = rc;
- test->err_fn = "resolve_dependency";
+ test->err_fn = "__func__";
rc = NPE_DEPENDENCY_NOT_PRESENT;
break;
}
@@ -881,13 +880,12 @@
if (rc != NPE_SUCCESS) {
test->state = TEST_ERROR;
test->err_rc = rc;
- test->err_fn = "initialize_test";
+ test->err_fn = "__func__";
}
- if (debug) {
- fprintf(where,"exiting initialize_test\n");
- fflush(where);
- }
+
+ NETPERF_DEBUG_EXIT(debug,where);
+
}
@@ -921,7 +919,7 @@
if (rc != NPE_SUCCESS) {
test->state = TEST_ERROR;
test->err_rc = rc;
- test->err_fn = "initialize_tests";
+ test->err_fn = "__func__";
};
}
/* should we restart the chain just incase an entry was inserted
@@ -936,14 +934,13 @@
pthread_mutex_unlock(&h->hash_lock);
}
- if (debug) {
- fprintf(where,"exiting initialize_tests\n");
- fflush(where);
- }
+ NETPERF_DEBUG_EXIT(debug,where);
+
}
-static void *netperf_worker(void *data)
+static void *
+netperf_worker(void *data)
{
int rc;
server_t *server = data;
@@ -986,7 +983,7 @@
if (rc != NPE_SUCCESS) {
server->state = NSRV_ERROR;
server->err_rc = rc;
- server->err_fn = "netperf_worker";
+ server->err_fn = "__func__";
}
}
@@ -1034,17 +1031,16 @@
if (rc != NPE_SUCCESS) {
server->state = NSRV_ERROR;
server->err_rc = rc;
- server->err_fn = "launch_worker_threads";
+ server->err_fn = "__func__";
}
}
server = server->next;
}
pthread_mutex_unlock(&h->hash_lock);
}
- if (debug) {
- fprintf(where,"exiting launch_worker_treads\n");
- fflush(where);
- }
+
+ NETPERF_DEBUG_EXIT(debug,where);
+
}
@@ -1107,6 +1103,8 @@
fprintf(where,"exiting wait_for_tests_to_initialize rc = %d\n",rc);
fflush(where);
}
+
+ return(rc);
}
@@ -1195,7 +1193,7 @@
if (rc != NPE_SUCCESS) {
test->state = TEST_ERROR;
test->err_rc = rc;
- test->err_fn = "reqeust_state_change";
+ test->err_fn = "__func__";
}
}
set_elt = set_elt->next;
@@ -1218,14 +1216,13 @@
if (rc != NPE_SUCCESS) {
test->state = TEST_ERROR;
test->err_rc = rc;
- test->err_fn = "reqeust_state_change";
+ test->err_fn = "__func__";
}
}
}
- if (debug) {
- fprintf(where,"request_state_change: exiting\n");
- fflush(where);
- }
+
+ NETPERF_DEBUG_EXIT(debug,where);
+
return(rc);
}
@@ -1363,10 +1360,7 @@
rc = NPE_TEST_SET_NOT_FOUND;
}
- if (debug) {
- fprintf(where,"report_stats_command: exiting\n");
- fflush(where);
- }
+ NETPERF_DEBUG_EXIT(debug,where);
return(rc);
}
@@ -1534,10 +1528,8 @@
free(test_set);
}
- if (debug) {
- fprintf(where,"delete_test_set: exiting\n");
- fflush(where);
- }
+ NETPERF_DEBUG_EXIT(debug,where);
+
return(rc);
}
@@ -1630,7 +1622,7 @@
if (rc != NPE_SUCCESS) {
test->state = TEST_ERROR;
test->err_rc = rc;
- test->err_fn = "stats_command";
+ test->err_fn = "__func__";
}
}
set_elt = set_elt->next;
@@ -1652,14 +1644,12 @@
if (rc != NPE_SUCCESS) {
test->state = TEST_ERROR;
test->err_rc = rc;
- test->err_fn = "stats_command";
+ test->err_fn = "__func__";
}
}
}
- if (debug) {
- fprintf(where,"stats_command: exiting\n");
- fflush(where);
- }
+
+ NETPERF_DEBUG_EXIT(debug,where);
return(rc);
}
@@ -1831,10 +1821,9 @@
cmd = cmd->next;
}
xmlFreeDoc(doc);
- if (debug) {
- fprintf(where,"process_commands_and_events: exiting\n");
- fflush(where);
- }
+
+ NETPERF_DEBUG_EXIT(debug,where);
+
return(rc);
}
Modified: trunk/src/netperf.h
===================================================================
--- trunk/src/netperf.h 2005-11-11 01:21:51 UTC (rev 14)
+++ trunk/src/netperf.h 2005-11-11 19:12:56 UTC (rev 15)
@@ -23,6 +23,15 @@
fflush(w); \
}
+#define NETPERF_DEBUG_EXIT(d,w) \
+ if (d) { \
+ fprintf(w,\
+ "DEBUG exiting function %s file %s \n",\
+ __func__, \
+ __FILE__); \
+ fflush(w); \
+ }
+
#ifndef WIN32
#define NETPERF_PATH_SEP "/"
#else
Modified: trunk/src/netserver.c
===================================================================
--- trunk/src/netserver.c 2005-11-11 01:21:51 UTC (rev 14)
+++ trunk/src/netserver.c 2005-11-11 19:12:56 UTC (rev 15)
@@ -537,7 +537,7 @@
}
} else {
netperf->state = NSRV_ERROR;
- netperf->err_fn = "handle_netperf_requests";
+ netperf->err_fn = "__func__";
if (rc == 0) {
netperf->err_rc = NPE_REMOTE_CLOSE;
} else {
@@ -558,7 +558,7 @@
if (rc != NPE_SUCCESS) {
netperf->state = NSRV_ERROR;
netperf->err_rc = rc;
- netperf->err_fn = "handle_netperf_requests";
+ netperf->err_fn = "__func__";
}
}
@@ -615,7 +615,7 @@
/* loopdeloop */
for (;;) {
- printf("about to accept\n");
+ printf("about to accept on socket %d\n",listenfd);
if ((sock = accept(listenfd,peeraddr,&peerlen)) == -1) {
fprintf(where,
"setup_listen_endpoint: accept failed errno %d %s\n",
@@ -632,8 +632,8 @@
}
/* OK, do we fork or not? */
-
- if (forground < 2) {
+ printf("at the fork in the road, forground was %d\n",forground);
+ if (forground >= 2) {
/* no fork please, eat with our fingers */
printf("forground instantiation\n");
rc = instantiate_netperf(sock);
More information about the netperf-dev
mailing list