/Users/maurits/Documents/studie/afstuderen/biosphere/modules/stat/bsmod_stat.c

Go to the documentation of this file.
00001 /*
00002  * Author: MA Hartman
00003  * Date: april 10, 2007
00004  * 
00005  * Function:
00006  * A module which offers statistical functions.
00007  * 
00008  * License information:
00009  * 
00010  * Copyright (c) 2006 Maurits Hartman
00011  *
00012  * Permission is hereby granted, free of charge, to any person
00013  * obtaining a copy of this software and associated documentation
00014  * files (the "Software"), to deal in the Software without
00015  * restriction, including without limitation the rights to use,
00016  * copy, modify, merge, publish, distribute, sublicense, and/or sell
00017  * copies of the Software, and to permit persons to whom the
00018  * Software is furnished to do so, subject to the following
00019  * conditions:
00020  * 
00021  * The above copyright notice and this permission notice shall be
00022  * included in all copies or substantial portions of the Software.
00023  * 
00024  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00025  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
00026  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00027  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
00028  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
00029  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00030  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00031  * OTHER DEALINGS IN THE SOFTWARE.
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 /* Here come functions offered by the module: */
00113 
00114 /* Final declaration of the bs_module struct: */
00115 bs_module bsmod_symtable = {
00116         /* The major and minor version of the API used by this module: */
00117         0,
00118         0,
00119         
00120         /* The major and minor version of this module: */
00121         0,
00122         1,
00123         
00124         /* The name, author, date and copyright information: */
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         /* Init and cleanup routines: */
00134         bsmod_stat_init,
00135         bsmod_stat_cleanup,
00136         
00137         /* Service request handling function: */
00138         bsmod_stat_handle_service,
00139         NULL,
00140         "bsmod_stat.wsdl"
00141 };
00142 

Generated on Tue Jul 17 09:50:52 2007 for Bio-SPHERE by  doxygen 1.5.1