XrdProofdTrace.h

Go to the documentation of this file.
00001 // @(#)root/proofd:$Id: XrdProofdTrace.h 27269 2009-01-28 07:27:58Z ganis $
00002 // Author: G. Ganis  June 2005
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_XrdProofdTrace
00013 #define ROOT_XrdProofdTrace
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      //
00017 // XrdProofdTrace                                                       //
00018 //                                                                      //
00019 // Authors: G. Ganis, CERN, 2005                                        //
00020 //                                                                      //
00021 // Trace utils for xproofd.                                             //
00022 //                                                                      //
00023 //////////////////////////////////////////////////////////////////////////
00024 
00025 //
00026 // Trace flags
00027 //
00028 // Global mask
00029 #define TRACE_ALL       0xff7f
00030 
00031 // Levels
00032 #define TRACE_XERR      0x0001
00033 #define TRACE_REQ       0x0002
00034 #define TRACE_DBG       0x0004
00035 #define TRACE_LOGIN     0x0008
00036 #define TRACE_FORK      0x0010
00037 #define TRACE_MEM       0x0020
00038 #define TRACE_HDBG      0x0040
00039 // Bit 0x0080 reserved for future usage
00040 
00041 // Domains
00042 #define TRACE_DOMAINS   0xFF00
00043 #define TRACE_RSP       0x0100
00044 #define TRACE_AUX       0x0200
00045 #define TRACE_CMGR      0x0400
00046 #define TRACE_SMGR      0x0800
00047 #define TRACE_NMGR      0x1000
00048 #define TRACE_PMGR      0x2000
00049 #define TRACE_GMGR      0x4000
00050 #define TRACE_SCHED     0x8000
00051 
00052 #ifndef NODEBUG
00053 
00054 #ifndef ROOT_Riosfwd
00055 #include "Riosfwd.h"
00056 #endif
00057 #ifndef ROOT_DllImport
00058 #include "DllImport.h"
00059 #endif
00060 #include "XrdOuc/XrdOucTrace.hh"
00061 
00062 R__EXTERN XrdOucTrace *XrdProofdTrace;
00063 
00064 //
00065 // Auxilliary macros
00066 //
00067 #define XPDDOM(d) unsigned int xpdtracingdomain = (unsigned int)(TRACE_ ## d & TRACE_ALL);
00068 #define XPDLOC(d,x) unsigned int xpdtracingdomain = (unsigned int)(TRACE_ ## d & TRACE_ALL); \
00069                     const char *xpdloc = x;
00070 
00071 #define TRACINGALL(x) (TRACE_ALL == TRACE_ ## x)
00072 #define TRACINGERR(x) (TRACE_XERR == TRACE_ ## x)
00073 #define TRACINGACT(x) (XrdProofdTrace && (XrdProofdTrace->What & TRACE_ ## x))
00074 #define TRACINGDOM    (XrdProofdTrace && (XrdProofdTrace->What & xpdtracingdomain))
00075 #define TRACING(x) (TRACINGALL(x) || TRACINGERR(x) || (TRACINGACT(x) && TRACINGDOM))
00076 
00077 #define TRACESET(act,on) \
00078         if (on) { \
00079            XrdProofdTrace->What |= TRACE_ ## act; \
00080         } else { \
00081            XrdProofdTrace->What &= ~(TRACE_ ## act & TRACE_ALL); \
00082         }
00083 
00084 #define XPDPRT(x) \
00085    {XrdProofdTrace->Beg("-I");   cerr << xpdloc <<": "<< x; XrdProofdTrace->End();}
00086 
00087 #define XPDERR(x) \
00088    {XrdProofdTrace->Beg("-E");   cerr << xpdloc <<": "<< x; XrdProofdTrace->End();}
00089 
00090 #define TRACE(act, x) \
00091    if (TRACING(act)) { \
00092       if (TRACINGERR(act)) { \
00093          XPDERR(x); \
00094       } else { \
00095          XPDPRT(x); \
00096       } \
00097    }
00098 
00099 #define TRACEP(p, act, x) \
00100    if (TRACING(act)) { \
00101       if (TRACINGERR(act)) { \
00102          if (p) {\
00103             XrdProofdTrace->Beg("-E", 0, p->TraceID()); cerr << xpdloc <<": "<< x; XrdProofdTrace->End(); \
00104          } else {XPDERR(x);}\
00105       } else { \
00106          if (p) {\
00107             XrdProofdTrace->Beg("-I", 0, p->TraceID()); cerr << xpdloc <<": "<< x; XrdProofdTrace->End(); \
00108          } else {XPDPRT(x);}\
00109       } \
00110    }
00111 
00112 #define TRACEI(id, act, x) \
00113    if (TRACING(act)) { \
00114       if (TRACINGERR(act)) { \
00115          if (id) {\
00116             XrdProofdTrace->Beg("-E", 0, id); cerr << xpdloc <<": "<< x; XrdProofdTrace->End(); \
00117          } else { XPDERR(x); }\
00118       } else { \
00119          if (id) {\
00120             XrdProofdTrace->Beg("-I", 0, id); cerr << xpdloc <<": "<< x; XrdProofdTrace->End(); \
00121          } else { XPDPRT(x); }\
00122       } \
00123    }
00124 
00125 #define TRACER(r, act, x) \
00126    if (TRACING(act)) { \
00127       if (TRACINGERR(act)) { \
00128          if (r) {\
00129             XrdProofdTrace->Beg("-E", 0, r->TraceID()); cerr << xpdloc <<": "<< x; XrdProofdTrace->End(); \
00130          } else { XPDERR(x); }\
00131       } else { \
00132          if (r) {\
00133             XrdProofdTrace->Beg("-I", 0, r->TraceID()); cerr << xpdloc <<": "<< x; XrdProofdTrace->End(); \
00134          } else { XPDPRT(x); }\
00135       } \
00136    }
00137 
00138 #else
00139 
00140 // Dummy versions
00141 
00142 #define TRACING(x) 0
00143 #define TRACINGERR(x) (0)
00144 #define TRACESET(act,on)
00145 #define XPDLOC(x)
00146 #define XPDPRT(x)
00147 #define XPDERR(x)
00148 #define TRACE(act, x)
00149 #define TRACEP(p, act, x)
00150 #define TRACEI(id, act, x)
00151 #define TRACER(r, act, x)
00152 
00153 #endif
00154 
00155 #endif

Generated on Tue Jul 5 14:51:50 2011 for ROOT_528-00b_version by  doxygen 1.5.1