From: Ian W. <del...@us...> - 2006-08-28 01:35:27
|
Update of /cvsroot/ipbench/ipbench2/src/pymod In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv18172/src/pymod Modified Files: ipbench.c ipbench.i.in Log Message: fix up a bunch of warnings Index: ipbench.c =================================================================== RCS file: /cvsroot/ipbench/ipbench2/src/pymod/ipbench.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ipbench.c 9 May 2005 00:54:10 -0000 1.14 --- ipbench.c 28 Aug 2006 01:35:23 -0000 1.15 *************** *** 20,24 **** struct ipbench_plugin *ipbench_plugin; ! static struct client_data *client_data, target_data; /* number of clients */ --- 20,30 ---- struct ipbench_plugin *ipbench_plugin; ! #ifdef IPBENCH_TEST_CLIENT ! static struct client_data *client_data; ! #elif defined(IPBENCH_TEST_TARGET) ! static struct client_data target_data; ! #else ! # error "IPBNECH_TEST_CLIENT or IPBENCH_TEST_TARGET must be #defined" ! #endif /* number of clients */ *************** *** 71,76 **** int load_plugin(const char *plugin_name) { - int sts = 0; - int n; struct dirent **namelist; --- 77,80 ---- *************** *** 79,83 **** struct ipbench_plugin *p; char *path = IPBENCH_PLUGIN_DIR; /* defined on the command line */ ! dbprintf("Finding plugins in %s\n", path); /* recurse through looking for plugins */ --- 83,87 ---- struct ipbench_plugin *p; char *path = IPBENCH_PLUGIN_DIR; /* defined on the command line */ ! dbprintf("Finding plugins in %s\n", path); /* recurse through looking for plugins */ *************** *** 141,144 **** --- 145,173 ---- } + int start(void) + { + int sts = 0; + + sts = ipbench_plugin->start(&timer_start); + if (sts) + return ipbench_error(ipbench_RuntimeError, "start failed"); + + return 0; + } + + int stop(void) + { + int sts; + struct timeval timer_stop, timer_diff; + + sts = ipbench_plugin->stop(&timer_stop); + if (sts) + return ipbench_error(ipbench_RuntimeError, "stop failed"); + + timersub(&timer_stop, &timer_start, &timer_diff); + run_secs = timer_diff.tv_sec + timer_diff.tv_usec * 1e-6; + + return 0; + } #ifdef IPBENCH_TEST_CLIENT *************** *** 171,175 **** { int ret; ! dbprintf("[setup] : %s\n", clientargs); --- 200,204 ---- { int ret; ! dbprintf("[setup] : %s\n", clientargs); *************** *** 177,181 **** ret = ipbench_plugin->setup(clientargs); ! if (ret == -1) return ipbench_error(ipbench_RuntimeError, "Setup failed"); --- 206,210 ---- ret = ipbench_plugin->setup(clientargs); ! if (ret == -1) return ipbench_error(ipbench_RuntimeError, "Setup failed"); *************** *** 185,214 **** #endif - int start(void) - { - int sts; - - sts = ipbench_plugin->start(&timer_start); - if (sts) - return ipbench_error(ipbench_RuntimeError, "start failed"); - - } - - int stop(void) - { - int sts; - struct timeval timer_stop, timer_diff; - - sts = ipbench_plugin->stop(&timer_stop); - if (sts) - return ipbench_error(ipbench_RuntimeError, "stop failed"); - - timersub(&timer_stop, &timer_start, &timer_diff); - run_secs = timer_diff.tv_sec + timer_diff.tv_usec * 1e-6; - - return 0; - } - - /* This returns its data in marshalled_data, the size in marshall_data_size. * This is accessed from python as a vector (return value, data) --- 214,217 ---- Index: ipbench.i.in =================================================================== RCS file: /cvsroot/ipbench/ipbench2/src/pymod/ipbench.i.in,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ipbench.i.in 5 May 2005 02:47:04 -0000 1.9 --- ipbench.i.in 28 Aug 2006 01:35:23 -0000 1.10 *************** *** 3,13 **** %module ipbench_[type] %{ #include "except.h" #include "plugin.h" extern struct ipbench_plugin *ipbench_plugin; - %} #define IPBENCH_TEST_[type] %include "exception.i" %include "typemaps.i" --- 3,47 ---- %module ipbench_[type] %{ + #include "except.h" #include "plugin.h" extern struct ipbench_plugin *ipbench_plugin; #define IPBENCH_TEST_[type] + extern int enable_debug(void); + + extern int get_default_port(void); + + #ifdef IPBENCH_TEST_client + extern int setup_controller(int, char*); + #elif defined IPBENCH_TEST_target + extern int setup_controller(char*); + #endif + + extern int load_plugin(const char *); + + #ifdef IPBENCH_TEST_client + extern int setup(char *, int, char *); + #elif defined IPBENCH_TEST_target + extern int setup(char *); + #endif + + extern int start(void); + + extern int stop(void); + + extern int marshall(void **marshalled_data, int *marshalled_data_size); + + #ifdef IPBENCH_TEST_client + extern int unmarshall(int, char *data, int len, int); + #elif defined IPBENCH_TEST_target + extern int unmarshall(char *data, int len, int); + #endif + + extern int output(void); + + %} + %include "exception.i" %include "typemaps.i" *************** *** 20,25 **** --- 54,63 ---- } + #define IPBENCH_TEST_[type] + extern int enable_debug(void); + extern int get_default_port(void); + #ifdef IPBENCH_TEST_client extern int setup_controller(int, char*); *************** *** 27,31 **** --- 65,71 ---- extern int setup_controller(char*); #endif + extern int load_plugin(const char *); + #ifdef IPBENCH_TEST_client extern int setup(char *, int, char *); *************** *** 33,40 **** --- 73,84 ---- extern int setup(char *); #endif + extern int start(void); + extern int stop(void); + %cstring_output_allocate_size(void **marshalled_data, int *marshalled_data_size, ipbench_plugin->marshall_cleanup($1)); extern int marshall(void **marshalled_data, int *marshalled_data_size); + %apply (char *STRING, int LENGTH) { (char *data, int len) }; #ifdef IPBENCH_TEST_client *************** *** 43,45 **** --- 87,90 ---- extern int unmarshall(char *data, int len, int); #endif + extern int output(void); \ No newline at end of file |