diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2020-06-22 08:38:56 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2020-06-22 08:38:56 (GMT) |
commit | 3c9eaf294fb1862af75837f0150990112c735530 (patch) | |
tree | 4e528337878a2ddf67a1ff92c1190e1174bfa838 /src | |
parent | 4cb14e5ccad42352d5957104f28fe3c0e05b7bd5 (diff) | |
download | hdf5-3c9eaf294fb1862af75837f0150990112c735530.zip hdf5-3c9eaf294fb1862af75837f0150990112c735530.tar.gz hdf5-3c9eaf294fb1862af75837f0150990112c735530.tar.bz2 |
Reduce overhead for H5open, which is involved in the public symbols like H5T_NATIVE_INT, etc.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5.c | 8 | ||||
-rw-r--r-- | src/H5private.h | 29 |
2 files changed, 32 insertions, 5 deletions
@@ -846,11 +846,13 @@ H5open(void) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API_NOCLEAR(FAIL) - H5TRACE0("e",""); + FUNC_ENTER_API_NOPUSH(FAIL) + /*NO TRACE*/ + /* all work is done by FUNC_ENTER() */ + done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOPUSH(ret_value) } /* end H5open() */ diff --git a/src/H5private.h b/src/H5private.h index 4cca41d..c628fcf 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2115,8 +2115,9 @@ H5_DLL herr_t H5CX_pop(void); } /* end if */ \ \ /* Initialize the package, if appropriate */ \ - H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) \ - \ + H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) + +#define FUNC_ENTER_API_PUSH(err) \ /* Push the name of this function on the function stack */ \ H5_PUSH_FUNC \ \ @@ -2130,6 +2131,7 @@ H5_DLL herr_t H5CX_pop(void); #define FUNC_ENTER_API(err) {{ \ FUNC_ENTER_API_COMMON \ FUNC_ENTER_API_INIT(err); \ + FUNC_ENTER_API_PUSH(err); \ /* Clear thread error stack entering public functions */ \ H5E_clear_stack(NULL); \ { @@ -2141,6 +2143,7 @@ H5_DLL herr_t H5CX_pop(void); #define FUNC_ENTER_API_NOCLEAR(err) {{ \ FUNC_ENTER_API_COMMON \ FUNC_ENTER_API_INIT(err); \ + FUNC_ENTER_API_PUSH(err); \ { /* @@ -2169,6 +2172,18 @@ H5_DLL herr_t H5CX_pop(void); BEGIN_MPE_LOG \ { +/* + * Use this macro for API functions that should only perform initialization + * of the library or an interface, but not push any state (API context, + * function name, start MPE logging, etc) examples are: H5open. + * + */ +#define FUNC_ENTER_API_NOPUSH(err) {{{{{ \ + FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \ + FUNC_ENTER_API_THREADSAFE; \ + FUNC_ENTER_API_INIT(err); \ + { + /* Note: this macro only works when there's _no_ interface initialization routine for the module */ #define FUNC_ENTER_NOAPI_INIT(err) \ /* Initialize the package, if appropriate */ \ @@ -2358,6 +2373,16 @@ H5_DLL herr_t H5CX_pop(void); return(ret_value); \ }}}} /*end scope from beginning of FUNC_ENTER*/ +/* Use this macro to match the FUNC_ENTER_API_NOPUSH macro */ +#define FUNC_LEAVE_API_NOPUSH(ret_value) \ + ; \ + } /*end scope from end of FUNC_ENTER*/ \ + if(err_occurred) \ + (void)H5E_dump_api_stack(TRUE); \ + FUNC_LEAVE_API_THREADSAFE \ + return(ret_value); \ +}}}}} /*end scope from beginning of FUNC_ENTER*/ + #define FUNC_LEAVE_NOAPI(ret_value) \ ; \ } /*end scope from end of FUNC_ENTER*/ \ |