00001 /***************************************************************************** 00002 * 00003 * PROFILER.H - Event Profiler For Icinga 00004 * 00005 * Copyright: (c) 2009 Intellectual Reserve Inc. 00006 * Author: Steven D. Morrey (nagios-devel@lists.sourceforge.net) 00007 * 00008 * Description: 00009 * 00010 * Nagios is a network monitoring tool that will check hosts and services 00011 * that you specify. This utility adds the ability to profile the events 00012 * occuring within the application itself 00013 * 00014 * License: 00015 * 00016 * This program is free software; you can redistribute it and/or modify 00017 * it under the terms of the GNU General Public License version 2 as 00018 * published by the Free Software Foundation. 00019 * 00020 * This program is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * You should have received a copy of the GNU General Public License 00026 * along with this program; if not, write to the Free Software 00027 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00028 * 00029 *****************************************************************************/ 00030 #ifndef __PROFILER__HEADER__INCLUDED__ 00031 #define __PROFILER__HEADER__INCLUDED__ 00032 00033 /* make sure gcc3 won't hit here */ 00034 #ifndef GCCTOOOLD 00035 00036 00037 #define EVENT_LOOP_EMPTY_LIST 100 00038 #define EVENT_LOOP_EVENT_LIST_HIGH_EXECUTED 101 00039 #define EVENT_LOOP_FAIL_NO_SERVICE_CHECKS 102 00040 #define EVENT_LOOP_FAIL_MAX_CHECKS 103 00041 #define EVENT_LOOP_FAIL_PARALLEL 104 00042 #define EVENT_LOOP_FAIL_NO_HOST_CHECKS 105 00043 #define EVENT_LOOP_EXECUTED_EVENT 106 00044 #define EVENT_LOOP_NO_EXECUTION 107 00045 #define EVENT_LOOP_IDLED 108 00046 #define EVENT_LOOP_COMPLETION 109 00047 00048 00049 typedef struct profiler_item{ 00050 int state; 00051 int counter; 00052 double elapsed; 00053 char * name; 00054 }profiler_item; 00055 00056 extern profiler_item * profiler; 00057 00058 void profiler_init(); 00059 void profiler_enable_core(); 00060 void profiler_enable_all(); 00061 void profiler_full_reset(profiler_item *p[]); 00062 void profiler_item_reset(profiler_item *p); 00063 void profiler_add(int event, char *name); 00064 void profiler_setstate(int event,int state); 00065 void profiler_rename(int p, char * name); 00066 void profiler_update(int event, struct timeval start); 00067 void profiler_output(FILE* fp); 00068 00069 #endif 00070 00071 #endif