ROOT  6.06/09
Reference Guide
XrdProofdTrace.h
Go to the documentation of this file.
1 // @(#)root/proofd:$Id$
2 // Author: G. Ganis June 2005
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_XrdProofdTrace
13 #define ROOT_XrdProofdTrace
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // XrdProofdTrace //
18 // //
19 // Authors: G. Ganis, CERN, 2005 //
20 // //
21 // Trace utils for xproofd. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 //
26 // Trace flags
27 //
28 // Global mask
29 #define TRACE_ALL 0xff7f
30 
31 // Levels
32 #define TRACE_XERR 0x0001
33 #define TRACE_REQ 0x0002
34 #define TRACE_DBG 0x0004
35 #define TRACE_LOGIN 0x0008
36 #define TRACE_FORK 0x0010
37 #define TRACE_MEM 0x0020
38 #define TRACE_HDBG 0x0040
39 // Bit 0x0080 reserved for future usage
40 
41 // Domains
42 #define TRACE_DOMAINS 0xFF00
43 #define TRACE_RSP 0x0100
44 #define TRACE_AUX 0x0200
45 #define TRACE_CMGR 0x0400
46 #define TRACE_SMGR 0x0800
47 #define TRACE_NMGR 0x1000
48 #define TRACE_PMGR 0x2000
49 #define TRACE_GMGR 0x4000
50 #define TRACE_SCHED 0x8000
51 
52 #ifndef NODEBUG
53 
54 #ifndef ROOT_Riosfwd
55 #include "Riosfwd.h"
56 #endif
57 #ifndef ROOT_DllImport
58 #include "DllImport.h"
59 #endif
60 #include "XrdOuc/XrdOucTrace.hh"
61 
63 
64 //
65 // Auxilliary macros
66 //
67 #define XPDDOM(d) unsigned int xpdtracingdomain = (unsigned int)(TRACE_ ## d & TRACE_ALL);
68 #define XPDLOC(d,x) unsigned int xpdtracingdomain = (unsigned int)(TRACE_ ## d & TRACE_ALL); \
69  const char *xpdloc = x;
70 
71 #define TRACINGALL(x) (TRACE_ALL == TRACE_ ## x)
72 #define TRACINGERR(x) (TRACE_XERR == TRACE_ ## x)
73 #define TRACINGACT(x) (XrdProofdTrace && (XrdProofdTrace->What & TRACE_ ## x))
74 #define TRACINGDOM (XrdProofdTrace && (XrdProofdTrace->What & xpdtracingdomain))
75 #define TRACING(x) (TRACINGALL(x) || TRACINGERR(x) || (TRACINGACT(x) && TRACINGDOM))
76 
77 #define TRACESET(act,on) \
78  if (on) { \
79  XrdProofdTrace->What |= TRACE_ ## act; \
80  } else { \
81  XrdProofdTrace->What &= ~(TRACE_ ## act & TRACE_ALL); \
82  }
83 
84 #define XPDPRT(x) \
85  {XrdProofdTrace->Beg("-I"); std::cerr << xpdloc <<": "<< x; XrdProofdTrace->End();}
86 
87 #define XPDERR(x) \
88  {XrdProofdTrace->Beg("-E"); std::cerr << xpdloc <<": "<< x; XrdProofdTrace->End();}
89 
90 #define TRACE(act, x) \
91  if (TRACING(act)) { \
92  if (TRACINGERR(act)) { \
93  XPDERR(x); \
94  } else { \
95  XPDPRT(x); \
96  } \
97  }
98 
99 #define TRACEP(p, act, x) \
100  if (TRACING(act)) { \
101  if (TRACINGERR(act)) { \
102  if (p) {\
103  XrdProofdTrace->Beg("-E", 0, p->TraceID()); std::cerr << xpdloc <<": "<< x; XrdProofdTrace->End(); \
104  } else {XPDERR(x);}\
105  } else { \
106  if (p) {\
107  XrdProofdTrace->Beg("-I", 0, p->TraceID()); std::cerr << xpdloc <<": "<< x; XrdProofdTrace->End(); \
108  } else {XPDPRT(x);}\
109  } \
110  }
111 
112 #define TRACEI(id, act, x) \
113  if (TRACING(act)) { \
114  if (TRACINGERR(act)) { \
115  if (id) {\
116  XrdProofdTrace->Beg("-E", 0, id); std::cerr << xpdloc <<": "<< x; XrdProofdTrace->End(); \
117  } else { XPDERR(x); }\
118  } else { \
119  if (id) {\
120  XrdProofdTrace->Beg("-I", 0, id); std::cerr << xpdloc <<": "<< x; XrdProofdTrace->End(); \
121  } else { XPDPRT(x); }\
122  } \
123  }
124 
125 #define TRACER(r, act, x) \
126  if (TRACING(act)) { \
127  if (TRACINGERR(act)) { \
128  if (r) {\
129  XrdProofdTrace->Beg("-E", 0, r->TraceID()); std::cerr << xpdloc <<": "<< x; XrdProofdTrace->End(); \
130  } else { XPDERR(x); }\
131  } else { \
132  if (r) {\
133  XrdProofdTrace->Beg("-I", 0, r->TraceID()); std::cerr << xpdloc <<": "<< x; XrdProofdTrace->End(); \
134  } else { XPDPRT(x); }\
135  } \
136  }
137 
138 #else
139 
140 // Dummy versions
141 
142 #define TRACING(x) 0
143 #define TRACINGERR(x) (0)
144 #define TRACESET(act,on)
145 #define XPDLOC(x)
146 #define XPDPRT(x)
147 #define XPDERR(x)
148 #define TRACE(act, x)
149 #define TRACEP(p, act, x)
150 #define TRACEI(id, act, x)
151 #define TRACER(r, act, x)
152 
153 #endif
154 
155 #endif
R__EXTERN XrdOucTrace * XrdProofdTrace
#define R__EXTERN
Definition: DllImport.h:27