diff options
author | John Mainzer <mainzer@hdfgroup.org> | 2004-08-05 18:13:49 (GMT) |
---|---|---|
committer | John Mainzer <mainzer@hdfgroup.org> | 2004-08-05 18:13:49 (GMT) |
commit | 8265779dc0cf1612f0d19b22956c30e9c851826c (patch) | |
tree | db00fea189bb86fc83f4cde792a03f60bbf2ab5d /src/H5Cprivate.h | |
parent | 19ecb5486a742fc622d3ec2591778ab4a6b1b6ab (diff) | |
download | hdf5-8265779dc0cf1612f0d19b22956c30e9c851826c.zip hdf5-8265779dc0cf1612f0d19b22956c30e9c851826c.tar.gz hdf5-8265779dc0cf1612f0d19b22956c30e9c851826c.tar.bz2 |
[svn-r9022] Purpose: Optimization of the cache code in H5C.
Description: Cache was running too slowly.
Solution: Added a hash table for indexing. Retained the tree, but
only for dirty entries. As we need to flush dirty entries
in increasing address order, this is sufficient.
Updated statistics collection code for the above.
Converted a number of local functions into macros to avoid
the function call overhead.
Added code to disable the clean and dirty LRU lists in serial
mode.
Updated test code to account for the above changes.
Platforms tested: h5committested + serial, parallel, and fp on Eirene.
Misc. update:
Diffstat (limited to 'src/H5Cprivate.h')
-rw-r--r-- | src/H5Cprivate.h | 72 |
1 files changed, 59 insertions, 13 deletions
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index aad57f7..4c14c4c 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -43,7 +43,7 @@ * * JRM - 5/17/04 */ -#define H5C_MAX_ENTRY_SIZE ((size_t)(100 * 1024)) +#define H5C_MAX_ENTRY_SIZE ((size_t)(10 * 1024 * 1024)) /* H5C_COLLECT_CACHE_STATS controls overall collection of statistics * on cache activity. In general, this #define should be set to 0. @@ -66,6 +66,25 @@ #endif /* H5C_COLLECT_CACHE_STATS */ + +#ifdef H5_HAVE_PARALLEL + +/* we must maintain the clean and dirty LRU lists when we are compiled + * with parallel support. + */ +#define H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS 1 + +#else /* H5_HAVE_PARALLEL */ + +/* The clean and dirty LRU lists don't buy us anything here -- we may + * want them on for testing on occasion, but in general they should be + * off. + */ +#define H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS 0 + +#endif /* H5_HAVE_PARALLEL */ + + /* * Class methods pertaining to caching. Each type of cached object will * have a constant variable with permanent life-span that describes how @@ -130,28 +149,28 @@ typedef herr_t (*H5C_write_permitted_func_t)(H5F_t *f, * them generally accessable. */ -#define H5C__DEFAULT_MAX_CACHE_SIZE ((size_t)(2 * 1024 * 1024)) -#define H5C__DEFAULT_MIN_CLEAN_SIZE ((size_t)(1 * 1024 * 1024)) +#define H5C__DEFAULT_MAX_CACHE_SIZE ((size_t)(4 * 1024 * 1024)) +#define H5C__DEFAULT_MIN_CLEAN_SIZE ((size_t)(2 * 1024 * 1024)) /**************************************************************************** * * structure H5C_cache_entry_t * - * Instances of the H5C_cache_entry_t structure are used to store meta data - * cache entries in an a threaded binary B-tree. See H5TB.c for the - * particulars of the B-tree. + * Instances of the H5C_cache_entry_t structure are used to store cache + * entries in a hash table and sometimes in a threaded balanced binary tree. + * See H5TB.c for the particulars of the tree. * * In typical application, this structure is the first field in a * structure to be cached. For historical reasons, the external module - * is responsible for managing the dirty field. All other fields are + * is responsible for managing the is_dirty field. All other fields are * managed by the cache. * - * Note that our current implementation of a threaded binary B-tree will - * occasionaly change the node a particular datum is associated with. Thus - * this structure does not have a back pointer to its B-tree node. If we - * ever modify the threaded binary B-tree code to fix this, a back pointer - * would save us a few tree traversals. + * Note that our current implementation of a threaded balanced binary tree + * will occasionaly change the node a particular datum is associated with. + * Thus this structure does not have a back pointer to its tree node. If we + * ever modify the threaded balanced binary tree code to fix this, a back + * pointer would save us a few tree traversals. * * The fields of this structure are discussed individually below: * @@ -195,6 +214,28 @@ typedef herr_t (*H5C_write_permitted_func_t)(H5F_t *f, * Note that protected entries are removed from the LRU lists * and inserted on the protected list. * + * in_tree: Boolean flag indicating whether the entry is in the threaded + * balanced binary tree. As a general rule, entries are placed + * in the tree when they are marked dirty. However they may + * remain in the tree after being flushed. + * + * + * Fields supporting the hash table: + * + * Fields in the cache are indexed by a more or less conventional hash table. + * If there are multiple entries in any hash bin, they are stored in a doubly + * linked list. + * + * ht_next: Next pointer used by the hash table to store multiple + * entries in a single hash bin. This field points to the + * next entry in the doubly linked list of entries in the + * hash bin, or NULL if there is no next entry. + * + * ht_prev: Prev pointer used by the hash table to store multiple + * entries in a single hash bin. This field points to the + * previous entry in the doubly linked list of entries in + * the hash bin, or NULL if there is no previuos entry. + * * * Fields supporting replacement policies: * @@ -281,6 +322,12 @@ typedef struct H5C_cache_entry_t const H5C_class_t * type; hbool_t is_dirty; hbool_t is_protected; + hbool_t in_tree; + + /* fields supporting the hash table: */ + + struct H5C_cache_entry_t * ht_next; + struct H5C_cache_entry_t * ht_prev; /* fields supporting replacement policies: */ @@ -366,7 +413,6 @@ H5_DLL herr_t H5C_stats(H5C_t * cache_ptr, H5_DLL void H5C_stats__reset(H5C_t * cache_ptr); - H5_DLL herr_t H5C_set_skip_flags(H5C_t * cache_ptr, hbool_t skip_file_checks, hbool_t skip_dxpl_id_checks); |