diff options
author | John Mainzer <mainzer@hdfgroup.org> | 2004-07-02 19:35:04 (GMT) |
---|---|---|
committer | John Mainzer <mainzer@hdfgroup.org> | 2004-07-02 19:35:04 (GMT) |
commit | c49dd7fa363bdb49416b5587654101064fd547f8 (patch) | |
tree | e1dbeee84ca50b94dfab9b1ed630d890405c6f78 /src/H5O.c | |
parent | 072919b9d7fa341c1a886fb92841efa444f0ffae (diff) | |
download | hdf5-c49dd7fa363bdb49416b5587654101064fd547f8.zip hdf5-c49dd7fa363bdb49416b5587654101064fd547f8.tar.gz hdf5-c49dd7fa363bdb49416b5587654101064fd547f8.tar.bz2 |
[svn-r8791] Purpose: Rewrote metadata cache (H5AC.c, etc.) to improve performance.
Description:
Replaced the old metadata cache with a cache with a modified LRU
replacement policy. This should improve the hit rate.
Solution:
Since we want to flush cache entries in increasing address order, I
used the threaded binary B-tree code to store the cache entries.
There is a fair bit of overhead here, so we may want to consider
other options.
While the code is designed to allow the support of other replacement
algorithms, at present, only a modified version of LRU is supported.
The modified LRU algorithm requires that a user selectable portion
of the cache entries be clean. The clean entries are evicted first
when writes are not permitted. If the pool of clean entries is used
up, the cache grows beyond its user specified maximum size. The
cache can also exceed its maximum size if the combined size of the
protected (or locked) entries exceeds the maximum size of the cache.
Platforms tested:
eirene (serial, parallel, fp), h5committested
Misc. update:
Diffstat (limited to 'src/H5O.c')
-rw-r--r-- | src/H5O.c | 56 |
1 files changed, 56 insertions, 0 deletions
@@ -91,6 +91,7 @@ static H5O_t *H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata static herr_t H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh); static herr_t H5O_dest(H5F_t *f, H5O_t *oh); static herr_t H5O_clear(H5F_t *f, H5O_t *oh, hbool_t destroy); +static herr_t H5O_compute_size(H5F_t *f, H5O_t *oh, size_t *size_ptr); /* H5O inherits cache-like properties from H5AC */ static const H5AC_class_t H5AC_OHDR[1] = {{ @@ -99,6 +100,7 @@ static const H5AC_class_t H5AC_OHDR[1] = {{ (H5AC_flush_func_t)H5O_flush, (H5AC_dest_func_t)H5O_dest, (H5AC_clear_func_t)H5O_clear, + (H5AC_size_func_t)H5O_compute_size, }}; /* ID to type mapping */ @@ -893,6 +895,60 @@ done: /*------------------------------------------------------------------------- + * Function: H5O_compute_size + * + * Purpose: Compute the size in bytes of the specified instance of + * H5O_t on disk, and return it in *len_ptr. On failure, + * the value of *len_ptr is undefined. + * + * The value returned will probably be low unless the object + * has just been flushed, as we simply total up the size of + * the header with the sizes of the chunks. Thus any message + * that has been added since the last flush will not be + * reflected in the total. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * 5/13/04 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5O_compute_size(H5F_t *f, H5O_t *oh, size_t *size_ptr) +{ + unsigned u; + size_t size; + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_compute_size, FAIL); + + /* check args */ + HDassert(f); + HDassert(oh); + HDassert(size_ptr); + + size = H5O_SIZEOF_HDR(f); + + for (u = 0; u < oh->nchunks; u++) + { + size += oh->chunk[u].size; + } + + HDassert(size >= H5O_SIZEOF_HDR(f)); + + *size_ptr = size; + +done: + + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5O_compute_size() */ + + +/*------------------------------------------------------------------------- * Function: H5O_reset * * Purpose: Some message data structures have internal fields that |