probe.h

00001 /* 
00002    EyeDB Object Database Management System
00003    Copyright (C) 1994-2008 SYSRA
00004    
00005    EyeDB is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009    
00010    EyeDB is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014    
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with this library; if not, write to the Free Software
00017    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA 
00018 */
00019 
00020 /*
00021    Author: Eric Viara <viara@sysra.com>
00022 */
00023 
00024 #ifndef _EYEDBLIB_PROBE_H
00025 #define _EYEDBLIB_PROBE_H
00026 
00027 #include <stdio.h>
00028 
00029 typedef struct p_ProbeHandle p_ProbeHandle;
00030 
00031 typedef enum {
00032   p_ProbeCHAIN   = 0x1,
00033   p_ProbeAVERAGE = 0x2,
00034   p_ProbeINFO    = 0x4,
00035   p_ProbeLOCS    = 0x8,
00036   p_ProbeMARKS   = 0x10,
00037   p_ProbeWHOLE   = p_ProbeCHAIN | p_ProbeAVERAGE | p_ProbeINFO |
00038     p_ProbeLOCS | p_ProbeMARKS
00039 } p_ProbeProfileType;
00040     
00041 enum {
00042   P_PROBE_FILE  = 64,
00043   P_PROBE_INFO  = 80,
00044   P_PROBE_PNAME = 128
00045 };
00046 
00047 typedef struct {
00048   char _not;
00049   int sm, em;
00050 } p_ProbeProfileMark;
00051 
00052 typedef struct {
00053   char _not;
00054   int line;
00055   const char *file;
00056 } p_ProbeProfileLoc;
00057 
00058 typedef struct {
00059   p_ProbeProfileType type;
00060   int c_marks;
00061   p_ProbeProfileMark *marks;
00062   int c_locs;
00063   p_ProbeProfileLoc *locs;
00064 } p_ProbeProfileDesc;
00065 
00066 extern p_ProbeHandle
00067   *p_probeInit(const char *pname);
00068 
00069 extern void
00070   p_probeBegin(const char *pname),
00071   p_probeEnd(const char *file);
00072 
00073 extern void
00074   p_probeRecord(p_ProbeHandle *ph, const char *file, int line,
00075                 int mark, const char *info),
00076   p_probeProfile(p_ProbeHandle *ph, FILE *fd, p_ProbeProfileDesc *desc),
00077   p_probeSave(p_ProbeHandle *ph, const char *file),
00078   p_probeRestore(p_ProbeHandle **ph, const char *file);
00079 
00080 extern int
00081   p_probeActiveSet(p_ProbeHandle *ph, int act);
00082 
00083 extern p_ProbeHandle
00084   *p_probeGlobalSet(p_ProbeHandle *ph),
00085   *p_probeGlobalGet(void);
00086 
00087 #ifdef P_NO_PROBE
00088 
00089 #define p_probe(ph)
00090 #define p_probeI(ph, i)
00091 #define p_probeM(ph, m)
00092 #define p_probeMI(ph, m, i)
00093 
00094 #define p_probeX
00095 #define p_probeXI(i)
00096 #define p_probeXM(m)
00097 #define p_probeXMI(m, i)
00098 
00099 #else
00100 
00101 #define p_probe(ph)         p_probeRecord(ph, __FILE__, __LINE__, 0, 0)
00102 #define p_probeI(ph, i)     p_probeRecord(ph, __FILE__, __LINE__, 0, i)
00103 #define p_probeM(ph, m)     p_probeRecord(ph, __FILE__, __LINE__, m, 0)
00104 #define p_probeMI(ph, m, i) p_probeRecord(ph, __FILE__, __LINE__, m, i)
00105 
00106 #define p_probeX            p_probeRecord(p_probeGlobalGet(), __FILE__,\
00107                                           __LINE__, 0, 0)
00108 #define p_probeXI(i)        p_probeRecord(p_probeGlobalGet(), __FILE__,\
00109                                           __LINE__, 0, i)
00110 #define p_probeXM(m)        p_probeRecord(p_probeGlobalGet(), __FILE__,\
00111                                           __LINE__, m, 0)
00112 #define p_probeXMI(m, i)    p_probeRecord(p_probeGlobalGet(), __FILE__,\
00113                                           __LINE__, m, i)
00114 #endif
00115 
00116 #endif

Generated on Mon Dec 22 18:16:07 2008 for eyedb by  doxygen 1.5.3