summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5CS.c223
-rw-r--r--src/H5CSprivate.h40
-rw-r--r--src/H5FS.c223
-rw-r--r--src/H5FSprivate.h40
-rw-r--r--src/H5TS.c73
-rw-r--r--src/H5TSprivate.h1
-rw-r--r--src/H5config.h.in9
-rw-r--r--src/H5private.h53
-rw-r--r--src/Makefile.in17
9 files changed, 625 insertions, 54 deletions
diff --git a/src/H5CS.c b/src/H5CS.c
new file mode 100644
index 0000000..b523251
--- /dev/null
+++ b/src/H5CS.c
@@ -0,0 +1,223 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Provides internal function tracing in the form of a stack.
+ * The FUNC_ENTER() macro adds the function name to the function
+ * stack whenever a function is entered.
+ * As the functions return with FUNC_LEAVE,
+ * entries are removed from the stack.
+ *
+ * A function stack has a fixed maximum size. If this size is
+ * exceeded then the stack will be truncated and only the
+ * first called functions will have entries on the stack. This is
+ * expected to be a rare condition.
+ *
+ * Each thread has its own function stack, but since
+ * multi-threading has not been added to the library yet, this
+ * package maintains a single function stack. The function stack
+ * is statically allocated to reduce the complexity of handling
+ * errors within the H5FS package.
+ *
+ */
+#include "H5private.h" /* Generic Functions */
+#include "H5FSprivate.h" /* Private function stack routines */
+#include "H5MMprivate.h" /* Memory management functions */
+
+#ifdef H5_HAVE_FUNCSTACK
+
+#define PABLO_MASK H5FS_mask
+
+/* Interface initialization? */
+#define INTERFACE_INIT NULL
+
+#ifdef H5_HAVE_THREADSAFE
+/*
+ * The per-thread function stack. pthread_once() initializes a special
+ * key that will be used by all threads to create a stack specific to
+ * each thread individually. The association of stacks to threads will
+ * be handled by the pthread library.
+ *
+ * In order for this macro to work, H5FS_get_my_stack() must be preceeded
+ * by "H5FS_t *fstack =".
+ */
+static H5FS_t *H5FS_get_stack(void);
+#define H5FS_get_my_stack() H5FS_get_stack()
+#else /* H5_HAVE_THREADSAFE */
+/*
+ * The function stack. Eventually we'll have some sort of global table so each
+ * thread has it's own stack. The stacks will be created on demand when the
+ * thread first calls H5FS_push(). */
+H5FS_t H5FS_stack_g[1];
+#define H5FS_get_my_stack() (H5FS_stack_g+0)
+#endif /* H5_HAVE_THREADSAFE */
+
+
+#ifdef H5_HAVE_THREADSAFE
+/*-------------------------------------------------------------------------
+ * Function: H5FS_get_stack
+ *
+ * Purpose: Support function for H5FS_get_my_stack() to initialize and
+ * acquire per-thread function stack.
+ *
+ * Return: Success: function stack (H5FS_t *)
+ *
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * February 6, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5FS_t *
+H5FS_get_stack(void)
+{
+ H5FS_t *fstack;
+
+ FUNC_ENTER_NOAPI_NOFS(H5FS_get_stack);
+
+ fstack = pthread_getspecific(H5TS_funcstk_key_g);
+ if (!fstack) {
+ /* no associated value with current thread - create one */
+ fstack = (H5FS_t *)H5MM_malloc(sizeof(H5FS_t));
+ pthread_setspecific(H5TS_funcstk_key_g, (void *)fstack);
+ }
+
+ FUNC_LEAVE_NOAPI_NOFS(fstack);
+} /* end H5FS_get_stack() */
+#endif /* H5_HAVE_THREADSAFE */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FS_print
+ *
+ * Purpose: Prints the function stack in some default way.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * THursday, February 6, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FS_print(FILE *stream)
+{
+ H5FS_t *fstack = H5FS_get_my_stack (); /* Get the correct function stack */
+ const int indent = 2; /* Indention level */
+ int i; /* Local index ariable */
+
+ /* Don't push this function on the function stack... :-) */
+ FUNC_ENTER_NOAPI_NOFS(H5FS_print);
+
+ /* Sanity check */
+ assert(fstack);
+
+ /* Default to outputting information to stderr */
+ if (!stream)
+ stream = stderr;
+
+ HDfprintf (stream, "HDF5-DIAG: Function stack from %s ", H5_lib_vers_info_g);
+ /* try show the process or thread id in multiple processes cases*/
+#ifdef H5_HAVE_THREADSAFE
+ HDfprintf (stream, "thread %d.", (int)pthread_self());
+#else /* H5_HAVE_THREADSAFE */
+ HDfprintf (stream, "thread 0.");
+#endif /* H5_HAVE_THREADSAFE */
+ if (fstack && fstack->nused>0)
+ HDfprintf (stream, " Back trace follows.");
+ HDfputc ('\n', stream);
+
+ for (i=fstack->nused-1; i>=0; --i)
+ HDfprintf(stream, "%*s#%03d: Routine: %s\n", indent, "", i, fstack->slot[i]);
+
+ FUNC_LEAVE_NOAPI_NOFS(SUCCEED);
+} /* end H5FS_print() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FS_push
+ *
+ * Purpose: Pushes a new record onto function stack for the current
+ * thread.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, February 6, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FS_push(const char *func_name)
+{
+ H5FS_t *fstack = H5FS_get_my_stack ();
+
+ /* Don't push this function on the function stack... :-) */
+ FUNC_ENTER_NOAPI_NOFS(H5FS_push);
+
+ /* Sanity check */
+ assert (fstack);
+ assert (func_name);
+
+ /*
+ * Push the function if there's room. Otherwise just increment count
+ */
+ if (fstack->nused<H5FS_NSLOTS)
+ fstack->slot[fstack->nused] = func_name;
+ fstack->nused++;
+
+ FUNC_LEAVE_NOAPI_NOFS(SUCCEED);
+} /* end H5FS_push() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FS_pop
+ *
+ * Purpose: Pops a record off function stack for the current thread.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, February 6, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FS_pop(void)
+{
+ H5FS_t *fstack = H5FS_get_my_stack ();
+
+ /* Don't push this function on the function stack... :-) */
+ FUNC_ENTER_NOAPI_NOFS(H5FS_pop);
+
+ /* Sanity check */
+ assert (fstack);
+ assert (fstack->nused>0);
+
+ /* Pop the function. */
+ fstack->nused--;
+
+ FUNC_LEAVE_NOAPI_NOFS(SUCCEED);
+} /* end H5FS_pop() */
+
+#endif /* H5_HAVE_FUNCSTACK */
diff --git a/src/H5CSprivate.h b/src/H5CSprivate.h
new file mode 100644
index 0000000..6dba575
--- /dev/null
+++ b/src/H5CSprivate.h
@@ -0,0 +1,40 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Header file for function stacks, etc.
+ */
+#ifndef _H5FSprivate_H
+#define _H5FSprivate_H
+
+#ifdef NOT_YET
+#include "H5FSpublic.h"
+#endif /* NOT_YET */
+
+/* Private headers needed by this file */
+#include "H5private.h"
+
+#define H5FS_NSLOTS 32 /*number of slots in an function stack */
+
+/* A function stack */
+typedef struct H5FS_t {
+ int nused; /*num slots currently used in stack */
+ const char *slot[H5FS_NSLOTS]; /*array of function records */
+} H5FS_t;
+
+H5_DLL herr_t H5FS_push (const char *func_name);
+H5_DLL herr_t H5FS_pop (void);
+H5_DLL herr_t H5FS_print (FILE *stream);
+
+#endif /* _H5FSprivate_H */
diff --git a/src/H5FS.c b/src/H5FS.c
new file mode 100644
index 0000000..b523251
--- /dev/null
+++ b/src/H5FS.c
@@ -0,0 +1,223 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Provides internal function tracing in the form of a stack.
+ * The FUNC_ENTER() macro adds the function name to the function
+ * stack whenever a function is entered.
+ * As the functions return with FUNC_LEAVE,
+ * entries are removed from the stack.
+ *
+ * A function stack has a fixed maximum size. If this size is
+ * exceeded then the stack will be truncated and only the
+ * first called functions will have entries on the stack. This is
+ * expected to be a rare condition.
+ *
+ * Each thread has its own function stack, but since
+ * multi-threading has not been added to the library yet, this
+ * package maintains a single function stack. The function stack
+ * is statically allocated to reduce the complexity of handling
+ * errors within the H5FS package.
+ *
+ */
+#include "H5private.h" /* Generic Functions */
+#include "H5FSprivate.h" /* Private function stack routines */
+#include "H5MMprivate.h" /* Memory management functions */
+
+#ifdef H5_HAVE_FUNCSTACK
+
+#define PABLO_MASK H5FS_mask
+
+/* Interface initialization? */
+#define INTERFACE_INIT NULL
+
+#ifdef H5_HAVE_THREADSAFE
+/*
+ * The per-thread function stack. pthread_once() initializes a special
+ * key that will be used by all threads to create a stack specific to
+ * each thread individually. The association of stacks to threads will
+ * be handled by the pthread library.
+ *
+ * In order for this macro to work, H5FS_get_my_stack() must be preceeded
+ * by "H5FS_t *fstack =".
+ */
+static H5FS_t *H5FS_get_stack(void);
+#define H5FS_get_my_stack() H5FS_get_stack()
+#else /* H5_HAVE_THREADSAFE */
+/*
+ * The function stack. Eventually we'll have some sort of global table so each
+ * thread has it's own stack. The stacks will be created on demand when the
+ * thread first calls H5FS_push(). */
+H5FS_t H5FS_stack_g[1];
+#define H5FS_get_my_stack() (H5FS_stack_g+0)
+#endif /* H5_HAVE_THREADSAFE */
+
+
+#ifdef H5_HAVE_THREADSAFE
+/*-------------------------------------------------------------------------
+ * Function: H5FS_get_stack
+ *
+ * Purpose: Support function for H5FS_get_my_stack() to initialize and
+ * acquire per-thread function stack.
+ *
+ * Return: Success: function stack (H5FS_t *)
+ *
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * February 6, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5FS_t *
+H5FS_get_stack(void)
+{
+ H5FS_t *fstack;
+
+ FUNC_ENTER_NOAPI_NOFS(H5FS_get_stack);
+
+ fstack = pthread_getspecific(H5TS_funcstk_key_g);
+ if (!fstack) {
+ /* no associated value with current thread - create one */
+ fstack = (H5FS_t *)H5MM_malloc(sizeof(H5FS_t));
+ pthread_setspecific(H5TS_funcstk_key_g, (void *)fstack);
+ }
+
+ FUNC_LEAVE_NOAPI_NOFS(fstack);
+} /* end H5FS_get_stack() */
+#endif /* H5_HAVE_THREADSAFE */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FS_print
+ *
+ * Purpose: Prints the function stack in some default way.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * THursday, February 6, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FS_print(FILE *stream)
+{
+ H5FS_t *fstack = H5FS_get_my_stack (); /* Get the correct function stack */
+ const int indent = 2; /* Indention level */
+ int i; /* Local index ariable */
+
+ /* Don't push this function on the function stack... :-) */
+ FUNC_ENTER_NOAPI_NOFS(H5FS_print);
+
+ /* Sanity check */
+ assert(fstack);
+
+ /* Default to outputting information to stderr */
+ if (!stream)
+ stream = stderr;
+
+ HDfprintf (stream, "HDF5-DIAG: Function stack from %s ", H5_lib_vers_info_g);
+ /* try show the process or thread id in multiple processes cases*/
+#ifdef H5_HAVE_THREADSAFE
+ HDfprintf (stream, "thread %d.", (int)pthread_self());
+#else /* H5_HAVE_THREADSAFE */
+ HDfprintf (stream, "thread 0.");
+#endif /* H5_HAVE_THREADSAFE */
+ if (fstack && fstack->nused>0)
+ HDfprintf (stream, " Back trace follows.");
+ HDfputc ('\n', stream);
+
+ for (i=fstack->nused-1; i>=0; --i)
+ HDfprintf(stream, "%*s#%03d: Routine: %s\n", indent, "", i, fstack->slot[i]);
+
+ FUNC_LEAVE_NOAPI_NOFS(SUCCEED);
+} /* end H5FS_print() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FS_push
+ *
+ * Purpose: Pushes a new record onto function stack for the current
+ * thread.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, February 6, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FS_push(const char *func_name)
+{
+ H5FS_t *fstack = H5FS_get_my_stack ();
+
+ /* Don't push this function on the function stack... :-) */
+ FUNC_ENTER_NOAPI_NOFS(H5FS_push);
+
+ /* Sanity check */
+ assert (fstack);
+ assert (func_name);
+
+ /*
+ * Push the function if there's room. Otherwise just increment count
+ */
+ if (fstack->nused<H5FS_NSLOTS)
+ fstack->slot[fstack->nused] = func_name;
+ fstack->nused++;
+
+ FUNC_LEAVE_NOAPI_NOFS(SUCCEED);
+} /* end H5FS_push() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FS_pop
+ *
+ * Purpose: Pops a record off function stack for the current thread.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, February 6, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FS_pop(void)
+{
+ H5FS_t *fstack = H5FS_get_my_stack ();
+
+ /* Don't push this function on the function stack... :-) */
+ FUNC_ENTER_NOAPI_NOFS(H5FS_pop);
+
+ /* Sanity check */
+ assert (fstack);
+ assert (fstack->nused>0);
+
+ /* Pop the function. */
+ fstack->nused--;
+
+ FUNC_LEAVE_NOAPI_NOFS(SUCCEED);
+} /* end H5FS_pop() */
+
+#endif /* H5_HAVE_FUNCSTACK */
diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h
new file mode 100644
index 0000000..6dba575
--- /dev/null
+++ b/src/H5FSprivate.h
@@ -0,0 +1,40 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Header file for function stacks, etc.
+ */
+#ifndef _H5FSprivate_H
+#define _H5FSprivate_H
+
+#ifdef NOT_YET
+#include "H5FSpublic.h"
+#endif /* NOT_YET */
+
+/* Private headers needed by this file */
+#include "H5private.h"
+
+#define H5FS_NSLOTS 32 /*number of slots in an function stack */
+
+/* A function stack */
+typedef struct H5FS_t {
+ int nused; /*num slots currently used in stack */
+ const char *slot[H5FS_NSLOTS]; /*array of function records */
+} H5FS_t;
+
+H5_DLL herr_t H5FS_push (const char *func_name);
+H5_DLL herr_t H5FS_pop (void);
+H5_DLL herr_t H5FS_print (FILE *stream);
+
+#endif /* _H5FSprivate_H */
diff --git a/src/H5TS.c b/src/H5TS.c
index ce3d5ef..c577ebc 100644
--- a/src/H5TS.c
+++ b/src/H5TS.c
@@ -30,6 +30,7 @@ typedef struct H5TS_cancel_struct {
/* Global variable definitions */
pthread_once_t H5TS_first_init_g = PTHREAD_ONCE_INIT;
pthread_key_t H5TS_errstk_key_g;
+pthread_key_t H5TS_funcstk_key_g;
pthread_key_t H5TS_cancel_key_g;
hbool_t H5TS_allow_concurrent_g = FALSE; /* concurrent APIs override this */
@@ -38,6 +39,36 @@ hbool_t H5TS_allow_concurrent_g = FALSE; /* concurrent APIs override this */
static void H5TS_mutex_init(H5TS_mutex_t *mutex);
#endif /* NOT_USED */
+
+/*--------------------------------------------------------------------------
+ * NAME
+ * H5TS_key_destructor
+ *
+ * USAGE
+ * H5TS_key_destructor()
+ *
+ * RETURNS
+ *
+ * DESCRIPTION
+ * Frees the memory for a key. Called by each thread as it exits.
+ * Currently all the thread-specific information for all keys are simple
+ * structures allocated with malloc, so we can free them all uniformly.
+ *
+ * PROGRAMMER: Quincey Koziol
+ * February 7, 2003
+ *
+ * MODIFICATIONS:
+ *
+ *--------------------------------------------------------------------------
+ */
+static void
+H5TS_key_destructor(void *key_val)
+{
+ /* Use HDfree here instead of H5MM_xfree(), to avoid calling the H5FS routines */
+ if(key_val!=NULL)
+ HDfree(key_val);
+}
+
/*--------------------------------------------------------------------------
* NAME
* H5TS_first_thread_init
@@ -73,46 +104,14 @@ H5TS_first_thread_init(void)
H5_g.init_lock.lock_count = 0;
/* initialize key for thread-specific error stacks */
- pthread_key_create(&H5TS_errstk_key_g, NULL);
+ pthread_key_create(&H5TS_errstk_key_g, H5TS_key_destructor);
- /* initialize key for thread cancellability mechanism */
- pthread_key_create(&H5TS_cancel_key_g, NULL);
-}
+ /* initialize key for thread-specific function stacks */
+ pthread_key_create(&H5TS_funcstk_key_g, H5TS_key_destructor);
-#ifdef NOT_USED
-/*--------------------------------------------------------------------------
- * NAME
- * H5TS_mutex_init
- *
- * USAGE
- * H5TS_mutex_init(&mutex_var)
- *
- * RETURNS
- *
- * DESCRIPTION
- * Recursive lock semantics for HDF5 (lock initialization) -
- * Multiple acquisition of a lock by a thread is permitted with a
- * corresponding unlock operation required.
- *
- * PROGRAMMER: Chee Wai LEE
- * May 2, 2000
- *
- * MODIFICATIONS:
- *
- * 19 May 2000, Bill Wendling
- * Changed (*foo). form of accessing structure members to the -> form.
- *
- *--------------------------------------------------------------------------
- */
-static void
-H5TS_mutex_init(H5TS_mutex_t *mutex)
-{
- H5_g.init_lock.owner_thread = NULL;
- pthread_mutex_init(&mutex->atomic_lock, NULL);
- pthread_cond_init(&mutex->cond_var, NULL);
- mutex->lock_count = 0;
+ /* initialize key for thread cancellability mechanism */
+ pthread_key_create(&H5TS_cancel_key_g, H5TS_key_destructor);
}
-#endif /* NOT_USED */
/*--------------------------------------------------------------------------
* NAME
diff --git a/src/H5TSprivate.h b/src/H5TSprivate.h
index c9a8c20..4ece8d6 100644
--- a/src/H5TSprivate.h
+++ b/src/H5TSprivate.h
@@ -34,6 +34,7 @@ typedef struct H5TS_mutex_struct {
/* Extern global variables */
extern pthread_once_t H5TS_first_init_g;
extern pthread_key_t H5TS_errstk_key_g;
+extern pthread_key_t H5TS_funcstk_key_g;
#if defined c_plusplus || defined __cplusplus
extern "C"
diff --git a/src/H5config.h.in b/src/H5config.h.in
index 1b7f58c..06928ff 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -21,15 +21,15 @@
/* Define to 1 if you have the <features.h> header file. */
#undef HAVE_FEATURES_H
+/* Define if support for Adler32 checksum is enabled */
+#undef HAVE_FILTER_ADLER32
+
/* Define if support for deflate filter is enabled */
#undef HAVE_FILTER_DEFLATE
/* Define if support for shuffle filter is enabled */
#undef HAVE_FILTER_SHUFFLE
-/* Define if support for Adler32 checksum filter is enabled */
-#undef HAVE_FILTER_ADLER32
-
/* Define to 1 if you have the `fork' function. */
#undef HAVE_FORK
@@ -39,6 +39,9 @@
/* Define to 1 if you have the `fseek64' function. */
#undef HAVE_FSEEK64
+/* Define if the function stack tracing code is to be compiled in */
+#undef HAVE_FUNCSTACK
+
/* Define if the compiler understand the __FUNCTION__ keyword */
#undef HAVE_FUNCTION
diff --git a/src/H5private.h b/src/H5private.h
index baff347..09e0f02 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -1091,6 +1091,18 @@ extern hbool_t H5_libinit_g; /* Has the library been initialized? */
#endif /* H5_HAVE_THREADSAFE */
+#ifdef H5_HAVE_FUNCSTACK
+
+/* Include required function stack header */
+#include "H5FSprivate.h"
+
+#define H5_PUSH_FUNC H5FS_push(FUNC)
+#define H5_POP_FUNC H5FS_pop()
+#else /* H5_HAVE_FUNCSTACK */
+#define H5_PUSH_FUNC /* void */
+#define H5_POP_FUNC /* void */
+#endif /* H5_HAVE_FUNCSTACK */
+
#ifdef H5_HAVE_MPE
extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */
#endif
@@ -1149,6 +1161,7 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */
FUNC_ENTER_API_VARS \
FUNC_ENTER_COMMON(func_name,H5_IS_API(FUNC)); \
FUNC_ENTER_API_THREADSAFE; \
+ H5_PUSH_FUNC; \
BEGIN_MPE_LOG(func_name); \
{
@@ -1159,7 +1172,7 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */
{
/*
- * Use this macro for non-API functions which fall into two categories:
+ * Use this macro for non-API functions which fall into these categories:
* - static functions, since they must be called from a function in the
* interface, the library and interface must already be
* initialized.
@@ -1168,16 +1181,25 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */
*/
#define FUNC_ENTER_NOINIT(func_name) { \
FUNC_ENTER_COMMON(func_name,!H5_IS_API(FUNC)); \
+ H5_PUSH_FUNC; \
+ {
+
+/*
+ * Use this macro for non-API functions which fall into these categories:
+ * - functions which shouldn't push their name on the function stack
+ * (so far, just the H5FS routines themselves)
+ */
+#define FUNC_ENTER_NOAPI_NOFS(func_name) { \
+ FUNC_ENTER_COMMON(func_name,!H5_IS_API(FUNC)); \
{
#define FUNC_ENTER_API_COMMON(func_name,interface_init_func,err) \
/* Initialize the library */ \
if (!(H5_INIT_GLOBAL)) { \
H5_INIT_GLOBAL = TRUE; \
- if (H5_init_library()<0) { \
+ if (H5_init_library()<0) \
HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \
"library initialization failed"); \
- } \
} \
\
/* Initialize this interface or bust */ \
@@ -1190,7 +1212,11 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */
"interface initialization failed"); \
} \
} \
- BEGIN_MPE_LOG(func_name)
+ \
+ /* Push the name of this function on the function stack */ \
+ H5_PUSH_FUNC; \
+ \
+ BEGIN_MPE_LOG(func_name)
#define FUNC_ENTER_NOAPI_INIT(func_name,interface_init_func,err) \
/* Initialize this interface or bust */ \
@@ -1202,7 +1228,10 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */
HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \
"interface initialization failed"); \
} \
- }
+ } \
+ \
+ /* Push the name of this function on the function stack */ \
+ H5_PUSH_FUNC;
/*-------------------------------------------------------------------------
* Purpose: Register function exit for code profiling. This should be
@@ -1223,6 +1252,7 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */
FINISH_MPE_LOG; \
PABLO_TRACE_OFF (PABLO_MASK, pablo_func_id); \
H5TRACE_RETURN(ret_value); \
+ H5_POP_FUNC; \
H5_API_UNLOCK \
H5_API_SET_CANCEL \
return (ret_value); \
@@ -1231,17 +1261,30 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */
#define FUNC_LEAVE_NOAPI(ret_value) \
PABLO_TRACE_OFF (PABLO_MASK, pablo_func_id); \
+ H5_POP_FUNC; \
return (ret_value); \
} /*end scope from end of FUNC_ENTER*/ \
} /*end scope from beginning of FUNC_ENTER*/
#define FUNC_LEAVE_NOAPI_VOID \
PABLO_TRACE_OFF (PABLO_MASK, pablo_func_id); \
+ H5_POP_FUNC; \
return; \
} /*end scope from end of FUNC_ENTER*/ \
} /*end scope from beginning of FUNC_ENTER*/
/*
+ * Use this macro for non-API functions which fall into these categories:
+ * - functions which didn't push their name on the function stack
+ * (so far, just the H5FS routines themselves)
+ */
+#define FUNC_LEAVE_NOAPI_NOFS(ret_value) \
+ PABLO_TRACE_OFF (PABLO_MASK, pablo_func_id); \
+ return (ret_value); \
+ } /*end scope from end of FUNC_ENTER*/ \
+} /*end scope from beginning of FUNC_ENTER*/
+
+/*
* The FUNC_ENTER() and FUNC_LEAVE() macros make calls to Pablo functions
* through one of these two sets of macros.
*/
diff --git a/src/Makefile.in b/src/Makefile.in
index a783909..db8c717 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -32,8 +32,8 @@ LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5D.c H5E.c H5F.c H5Farray.c H5Fcontig.c \
H5Fcompact.c H5Fistore.c H5Fseq.c H5FD.c H5FDcore.c H5FDfamily.c \
H5FDfphdf5.c H5FDgass.c H5FDlog.c H5FDmpio.c H5FDmpiposix.c \
H5FDmulti.c H5FDsec2.c H5FDsrb.c H5FDstdio.c H5FDstream.c H5FL.c \
- H5FO.c H5FP.c H5FPclient.c H5FPserver.c H5G.c H5Gent.c H5Gnode.c \
- H5Gstab.c H5HG.c H5HL.c H5I.c H5MF.c H5MM.c H5O.c H5Oattr.c \
+ H5FO.c H5FP.c H5FPclient.c H5FPserver.c H5FS.c H5G.c H5Gent.c \
+ H5Gnode.c H5Gstab.c H5HG.c H5HL.c H5I.c H5MF.c H5MM.c H5O.c H5Oattr.c \
H5Obogus.c H5Ocont.c H5Odtype.c H5Oefl.c H5Ofill.c H5Ofphdf5.c \
H5Olayout.c H5Omtime.c H5Oname.c H5Onull.c H5Opline.c H5Oplist.c \
H5Osdspace.c H5Oshared.c H5Ostab.c H5P.c H5Pdcpl.c H5Pdxpl.c \
@@ -58,13 +58,12 @@ PUB_HDR=H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5Dpublic.h \
## Other header files (not to be installed)...
PRIVATE_HDR=H5private.h H5Aprivate.h H5Apkg.h H5ACprivate.h H5Bprivate.h \
- H5Dprivate.h H5Eprivate.h H5Fprivate.h H5FDprivate.h \
- H5FLprivate.h H5FOprivate.h H5FPprivate.h H5Gprivate.h H5Gpkg.h \
- H5HGprivate.h H5HLprivate.h H5Iprivate.h H5MFprivate.h \
- H5MMprivate.h H5Oprivate.h H5Pprivate.h H5Ppkg.h H5Rprivate.h \
- H5RSprivate.h H5Sprivate.h H5STprivate.h H5Tprivate.h \
- H5TBprivate.h H5Tpkg.h H5TSprivate.h H5Vprivate.h H5Zprivate.h \
- H5config.h
+ H5Dprivate.h H5Eprivate.h H5Fprivate.h H5FDprivate.h H5FLprivate.h \
+ H5FOprivate.h H5FPprivate.h H5FSprivate.h H5Gprivate.h H5Gpkg.h \
+ H5HGprivate.h H5HLprivate.h H5Iprivate.h H5MFprivate.h H5MMprivate.h \
+ H5Oprivate.h H5Pprivate.h H5Ppkg.h H5Rprivate.h H5RSprivate.h \
+ H5Sprivate.h H5STprivate.h H5Tprivate.h H5TBprivate.h H5Tpkg.h \
+ H5TSprivate.h H5Vprivate.h H5Zprivate.h H5config.h
## Number format detection
## The LD_LIBRARY_PATH setting is a klutch.