diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 1998-09-21 23:43:19 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 1998-09-21 23:43:19 (GMT) |
commit | 1fe48c7f19c2eed94a22179459efc1487ee65217 (patch) | |
tree | 41249aed6d1d5f95f6db00fa33ee7d40f434ca2a /src/H5P.c | |
parent | 7b189913384c500b71cb82d1780d6d07b170583c (diff) | |
download | hdf5-1fe48c7f19c2eed94a22179459efc1487ee65217.zip hdf5-1fe48c7f19c2eed94a22179459efc1487ee65217.tar.gz hdf5-1fe48c7f19c2eed94a22179459efc1487ee65217.tar.bz2 |
[svn-r712] Added temporary buffer support to several places in the library which were
calling malloc too often. Also, added caching of hyperslab blocks, which
improves performance _significantly_ for hyperslab I/O.
Diffstat (limited to 'src/H5P.c')
-rw-r--r-- | src/H5P.c | 84 |
1 files changed, 84 insertions, 0 deletions
@@ -2074,6 +2074,90 @@ H5Pget_buffer(hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/) /*------------------------------------------------------------------------- + * Function: H5Pset_hyper_cache + * + * Purpose: Given a dataset transfer property list, indicate whether to cache + * the hyperslab blocks during the I/O (which speeds things up) and the + * maximum size of the hyperslab block to cache. If a block is smaller + * than to limit, it may still not be cached if no memory is available. + * Setting the limit to 0 indicates no limitation on the size of block + * to attempt to cache. + * + * The default is to cache blocks with no limit on block size for serial + * I/O and to not cache blocks for parallel I/O + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Quincey Koziol + * Monday, September 21, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_hyper_cache(hid_t plist_id, unsigned cache, unsigned limit) +{ + H5D_xfer_t *plist = NULL; + + FUNC_ENTER (H5Pset_hyper_cache, FAIL); + + /* Check arguments */ + if (H5P_DATASET_XFER != H5P_get_class (plist_id) || + NULL == (plist = H5I_object (plist_id))) { + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, + "not a dataset transfer property list"); + } + + /* Update property list */ + plist->cache_hyper = (cache>0) ? 1 : 0; + plist->block_limit = limit; + + FUNC_LEAVE (SUCCEED); +} /* end H5P_set_hyper_cache() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_hyper_cache + * + * Purpose: Reads values previously set with H5Pset_hyper_cache(). + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Quincey Koziol + * Monday, September 21, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_hyper_cache(hid_t plist_id, unsigned *cache/*out*/, unsigned *limit/*out*/) +{ + H5D_xfer_t *plist = NULL; + + FUNC_ENTER (H5Pget_hyper_cache, 0); + + /* Check arguments */ + if (H5P_DATASET_XFER != H5P_get_class (plist_id) || + NULL == (plist = H5I_object (plist_id))) { + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, 0, + "not a dataset transfer property list"); + } + + /* Return values */ + if (cache) *cache = plist->cache_hyper; + if (limit) *limit = plist->block_limit; + + FUNC_LEAVE (SUCCEED); +} /* end H5Pget_hyper_cache() */ + + +/*------------------------------------------------------------------------- * Function: H5Pset_preserve * * Purpose: When reading or writing compound data types and the |