00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #include <biosphere_module.h>
00036 #include "general.h"
00037 #include "time_functions.h"
00038 #include "stat_functions.h"
00039 #include <str.h>
00040
00041 #include <stdio.h>
00042 #include <string.h>
00043
00053 bs_module bsmod_symtable;
00054
00058 apr_pool_t *pool;
00059
00060 bs_list *timers;
00061
00062
00066 static bs_status bsmod_stat_init(void)
00067 {
00068 apr_status_t rv;
00069 bs_status rv2;
00070
00071 printf("stat module initializing!\n");
00072 rv = apr_pool_create(&pool, NULL);
00073 if (rv != APR_SUCCESS) return BS_NO_MEMORY;
00074 timers = new_list(pool);
00075 rv2 = init_bsmod_stat_mux();
00076 return rv2;
00077 }
00078
00079
00083 static bs_status bsmod_stat_cleanup(void)
00084 {
00085 printf("shutting bsmod_stat down!\n");
00086 delete_list(timers);
00087 apr_pool_destroy(pool);
00088 return BS_OK;
00089 }
00090
00091
00096 static bs_status bsmod_stat_handle_service(
00097 const bs_service_request *request,
00098 bs_service_response **response, void *extra)
00099 {
00100 if (!streq(request->service, "BSModStatServices"))
00101 return BS_ERROR;
00102
00103 if (streq(request->port, "StatFunctions"))
00104 return bsmod_stat_handle_stat_functions(request, response);
00105 else if (streq(request->port, "TimeFunctions"))
00106 return bsmod_stat_handle_time_functions(request, response);
00107
00108 return BS_NO_SERVICE;
00109 }
00110
00111
00112
00113
00114
00115 bs_module bsmod_symtable = {
00116
00117 0,
00118 0,
00119
00120
00121 0,
00122 1,
00123
00124
00125 "statistics module",
00126 "M.A.Hartman",
00127 "apr 30, 2007",
00128 "(c) 2007, M.A.Hartman. See distributed LICENSE file for more information.",
00129 "A module which offers various timing and statistics functions. "
00130 "This is particularly useful to measure performance of the Bio-SPHERE "
00131 "platform and its various modules.",
00132
00133
00134 bsmod_stat_init,
00135 bsmod_stat_cleanup,
00136
00137
00138 bsmod_stat_handle_service,
00139 NULL,
00140 "bsmod_stat.wsdl"
00141 };
00142