summaryrefslogtreecommitdiffstats
path: root/src/H5private.h
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-05-02 19:54:19 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-05-02 19:54:19 (GMT)
commitf6fd474fe418db0c27c474a002c414004770f098 (patch)
treede816a542ac6f2558eefa5aa76ab4c3a7d590849 /src/H5private.h
parentcc44e6af631d3a178872f7478a0e0f891e18a4a9 (diff)
downloadhdf5-f6fd474fe418db0c27c474a002c414004770f098.zip
hdf5-f6fd474fe418db0c27c474a002c414004770f098.tar.gz
hdf5-f6fd474fe418db0c27c474a002c414004770f098.tar.bz2
[svn-r10716] Purpose:
Code cleanup Description: Migrate MPE macros to H5private.h, in preparation for using the H5MPprivate.h file for "memory pool" API. Platforms tested: FreeBSD 4.11 (sleipnir) w/parallel Too minor to require h5committest
Diffstat (limited to 'src/H5private.h')
-rw-r--r--src/H5private.h61
1 files changed, 57 insertions, 4 deletions
diff --git a/src/H5private.h b/src/H5private.h
index cc31395..ba4ddc7 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -160,12 +160,65 @@
/*
* MPE Instrumentation support
- * Do not #if the following header file because it contains
- * the needed null definitions for the H5-MPE macros when MPE
- * support is not configured.
+ */
+#ifdef H5_HAVE_MPE
+/*------------------------------------------------------------------------
+ * Purpose: Begin to collect MPE log information for a function. It should
+ * be ahead of the actual function's process.
+ *
+ * Programmer: Long Wang
+ *
+ *------------------------------------------------------------------------
+ */
+#include "mpe.h"
+/*
+ * #define eventa(func_name) h5_mpe_ ## func_name ## _a
+ * #define eventb(func_name) h5_mpe_ ## func_name ## _b
+ */
+#define eventa(func_name) h5_mpe_eventa
+#define eventb(func_name) h5_mpe_eventb
+#define MPE_LOG_VARS(func_name) \
+ static int eventa(func_name) = -1; \
+ static int eventb(func_name) = -1; \
+ const char* p_end_funcname = #func_name; \
+ const char* p_event_start = "start" #func_name;
+
+/* Hardwire the color to "red", since that's what all the routines are using
+ * now. In the future, if we want to change that color for a given routine,
+ * we should define a "FUNC_ENTER_API_COLOR" macro which takes an extra 'color'
+ * parameter and then make additional FUNC_ENTER_<foo>_COLOR macros to get that
+ * color information down to the BEGIN_MPE_LOG macro (which should have a new
+ * BEGIN_MPE_LOG_COLOR variant). -QAK
+ */
+#define BEGIN_MPE_LOG(func_name) \
+ if (H5_MPEinit_g){ \
+ if (eventa(func_name) == -1 && eventb(func_name) == -1) { \
+ const char* p_color = "red"; \
+ eventa(func_name)=MPE_Log_get_event_number(); \
+ eventb(func_name)=MPE_Log_get_event_number(); \
+ MPE_Describe_state(eventa(func_name), eventb(func_name), (char *)p_end_funcname, (char *)p_color); \
+ } \
+ MPE_Log_event(eventa(func_name), 0, (char *)p_event_start); \
+ }
+
+
+/*------------------------------------------------------------------------
+ * Purpose: Finish the collection of MPE log information for a function.
+ * It should be after the actual function's process.
*
+ * Programmer: Long Wang
*/
-#include "H5MPprivate.h"
+#define FINISH_MPE_LOG \
+ if (H5_MPEinit_g) { \
+ MPE_Log_event(eventb(func_name), 0, (char *)p_end_funcname); \
+ }
+
+#else /* H5_HAVE_MPE */
+#define MPE_LOG_VARS(func_name) /* void */
+#define BEGIN_MPE_LOG(func_name) /* void */
+#define FINISH_MPE_LOG /* void */
+
+#endif /* H5_HAVE_MPE */
/*
* dmalloc (debugging malloc) support