xrootd
XrdOfsTrace.hh
Go to the documentation of this file.
1 #ifndef ___OFS_TRACE_H___
2 #define ___OFS_TRACE_H___
3 /******************************************************************************/
4 /* */
5 /* X r d O f s T r a c e . h h */
6 /* */
7 /* (C) 2003 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC03-76-SFO0515 with the Deprtment of Energy */
11 /******************************************************************************/
12 
13 // $Id$
14 
15 #ifndef NODEBUG
16 
17 #include "XrdSys/XrdSysHeaders.hh"
18 #include "XrdOfs/XrdOfs.hh"
19 
20 #define GTRACE(act) OfsTrace.What & TRACE_ ## act
21 
22 #define TRACES(x) \
23  {OfsTrace.Beg(epname,tident); cerr <<x; OfsTrace.End();}
24 
25 #define FTRACE(act, x) \
26  if (GTRACE(act)) \
27  TRACES(x <<" fn=" << (oh->Name()))
28 
29 #define XTRACE(act, target, x) \
30  if (GTRACE(act)) TRACES(x <<" fn=" <<target)
31 
32 #define ZTRACE(act, x) if (GTRACE(act)) TRACES(x)
33 
34 #define DEBUG(x) if (GTRACE(debug)) TRACES(x)
35 
36 #define EPNAME(x) static const char *epname = x;
37 
38 #else
39 
40 #define FTRACE(x, y)
41 #define GTRACE(x) 0
42 #define TRACES(x)
43 #define XTRACE(x, y, a1)
44 #define YTRACE(x, y, a1, a2, a3, a4, a5)
45 #define ZTRACE(x, y)
46 #define DEBUG(x)
47 #define EPNAME(x)
48 
49 #endif
50 
51 // Trace flags
52 //
53 #define TRACE_MOST 0x3fcd
54 #define TRACE_ALL 0xffff
55 #define TRACE_opendir 0x0001
56 #define TRACE_readdir 0x0002
57 #define TRACE_closedir TRACE_opendir
58 #define TRACE_delay 0x0400
59 #define TRACE_dir TRACE_opendir | TRACE_readdir | TRACE_closedir
60 #define TRACE_open 0x0004
61 #define TRACE_qscan 0x0008
62 #define TRACE_close TRACE_open
63 #define TRACE_read 0x0010
64 #define TRACE_redirect 0x0800
65 #define TRACE_write 0x0020
66 #define TRACE_IO TRACE_read | TRACE_write | TRACE_aio
67 #define TRACE_exists 0x0040
68 #define TRACE_chmod TRACE_exists
69 #define TRACE_getmode TRACE_exists
70 #define TRACE_getsize TRACE_exists
71 #define TRACE_remove 0x0080
72 #define TRACE_rename TRACE_remove
73 #define TRACE_sync 0x0100
74 #define TRACE_truncate 0x0200
75 #define TRACE_fsctl 0x0400
76 #define TRACE_getstats 0x0800
77 #define TRACE_mkdir 0x1000
78 #define TRACE_stat 0x2000
79 #define TRACE_aio 0x4000
80 #define TRACE_debug 0x8000
81 
82 #endif