OpenMPI  0.1.1
trace.h
1 /*
2  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3  * University Research and Technology
4  * Corporation. All rights reserved.
5  * Copyright (c) 2004-2006 The University of Tennessee and The University
6  * of Tennessee Research Foundation. All rights
7  * reserved.
8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9  * University of Stuttgart. All rights reserved.
10  * Copyright (c) 2004-2005 The Regents of the University of California.
11  * All rights reserved.
12  * $COPYRIGHT$
13  *
14  * Additional copyrights may follow
15  *
16  * $HEADER$
17  */
18 
19 #ifndef OPAL_TRACE_H_
20 #define OPAL_TRACE_H_
21 
22 #include "opal_config.h"
23 
24 #ifndef OPAL_ENABLE_TRACE
25 #define OPAL_ENABLE_TRACE 0
26 #endif
27 
28 #if OPAL_ENABLE_TRACE
29 
30 #include "opal/util/output.h"
31 
32 #define OPAL_TRACE(verbose) \
33  do { \
34  opal_output_verbose(verbose, opal_trace_handle, "TRACE: %s @ %s:%d", \
35  __func__, __FILE__, __LINE__); \
36  } while (0)
37 
38 #define OPAL_TRACE_ARG1(verbose, foo) \
39  do { \
40  opal_output_verbose(verbose, opal_trace_handle, "TRACE: %s @ %s:%d arg: %lu", \
41  __func__, __FILE__, __LINE__, (unsigned long)foo); \
42  } while (0)
43 
44 #define OPAL_TRACE_ARG2(verbose, foo, foo2) \
45  do { \
46  opal_output_verbose(verbose, opal_trace_handle, "TRACE: %s @ %s:%d arg: %lu\n\t0x%x", \
47  __func__, __FILE__, __LINE__, (unsigned long)foo, (unsigned long)foo2); \
48  } while (0)
49 
50 #else
51 
52 #define OPAL_TRACE(verbose)
53 #define OPAL_TRACE_ARG1(verbose, foo)
54 #define OPAL_TRACE_ARG2(verbose, foo, foo2)
55 
56 #endif /* ENABLE_TRACE */
57 
58 BEGIN_C_DECLS
59 
60 OPAL_DECLSPEC extern int opal_trace_handle;
61 OPAL_DECLSPEC void opal_trace_init(void);
62 OPAL_DECLSPEC void opal_trace_finalize(void);
63 
64 END_C_DECLS
65 
66 #endif /* OPAL_TRACE_H */
OPAL output stream facility.