summaryrefslogtreecommitdiffstats
path: root/test/cache_common.c
diff options
context:
space:
mode:
authorMike McGreevy <mamcgree@hdfgroup.org>2009-01-09 19:53:30 (GMT)
committerMike McGreevy <mamcgree@hdfgroup.org>2009-01-09 19:53:30 (GMT)
commit041e7dbfed0e6787d09cd1ad9f4dfa09b936ec31 (patch)
treeebc775e7844b267f6217410046a90dd0556162f8 /test/cache_common.c
parent307f67d52582c2ca9d59acd5b0f53511f0493ad2 (diff)
downloadhdf5-041e7dbfed0e6787d09cd1ad9f4dfa09b936ec31.zip
hdf5-041e7dbfed0e6787d09cd1ad9f4dfa09b936ec31.tar.gz
hdf5-041e7dbfed0e6787d09cd1ad9f4dfa09b936ec31.tar.bz2
[svn-r16290] Purpose:
Adding code to maintain a min_clean_fraction in the cache in serial mode. Description: The metadata cache now has the ability to maintain a min_clean_fraction when in serial mode. The default initial cache size has been changed from 1MB to 2MB, and the default min_clean_fraction has been set at 30%. This check-in includes modifications to H5C.c to support maintaining a min_clean_size, including the addition of clean_index_size and dirty_index_size trackers, modifications to the H5C_make_space_in_cache algorithm, as well as associated test code and additional statistics tracking variables. Maintaining the min_clean_fraction addresses the possibility of experiencing a "metadata blizzard" when the cache gets completely full with dirty entries. Upon having to make space, the cache would previously need to flush every single entry in the cache before coming across a clean entry which could be evicted. This resulted in unnecessary flushing of oftentimes hot entries in the cache. Maintaining the min_clean_fraction ensures that, when space is needed, clean entries are more readily available to evict. Tested: jam, smirom, linew (h5committest)
Diffstat (limited to 'test/cache_common.c')
-rw-r--r--test/cache_common.c63
1 files changed, 60 insertions, 3 deletions
diff --git a/test/cache_common.c b/test/cache_common.c
index c2ce274..b76e9f9 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -1133,7 +1133,7 @@ variable_size(H5F_t * f, void * thing, size_t * size_ptr)
/*-------------------------------------------------------------------------
* Function: add_flush_op
*
- * Purpose: Do noting if pass is FALSE on entry.
+ * Purpose: Do nothing if pass is FALSE on entry.
*
* Otherwise, add the specified flush operation to the
* target instance of test_entry_t.
@@ -1199,7 +1199,7 @@ add_flush_op(int target_type,
/*-------------------------------------------------------------------------
* Function: create_pinned_entry_dependency
*
- * Purpose: Do noting if pass is FALSE on entry.
+ * Purpose: Do nothing if pass is FALSE on entry.
*
* Otherwise, set up a pinned entry dependency so we can
* test the pinned entry modifications to the flush routine.
@@ -2339,7 +2339,9 @@ flush_cache(H5C_t * cache_ptr,
hbool_t dump_stats,
hbool_t dump_detailed_stats)
{
+ const char * fcn_name = "flush_cache()";
herr_t result = 0;
+ hbool_t verbose = TRUE;
HDassert(cache_ptr);
@@ -2369,6 +2371,26 @@ flush_cache(H5C_t * cache_ptr,
pass = FALSE;
failure_mssg = "error in H5C_flush_cache().";
}
+ else if ( ( destroy_entries ) &&
+ ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ||
+ ( cache_ptr->clean_index_size != 0 ) ||
+ ( cache_ptr->dirty_index_size != 0 ) ) ) {
+
+ if ( verbose ) {
+ HDfprintf(stdout,
+ "%s: unexpected il/is/cis/dis = %lld/%lld/%lld/%lld.\n",
+ fcn_name,
+ (long long)(cache_ptr->index_len),
+ (long long)(cache_ptr->index_size),
+ (long long)(cache_ptr->clean_index_size),
+ (long long)(cache_ptr->dirty_index_size));
+ }
+ pass = FALSE;
+ failure_mssg =
+ "non zero index len/sizes after H5C_flush_cache() with invalidate.";
+ }
+
return;
@@ -3229,12 +3251,13 @@ unprotect_entry_with_size_change(H5C_t * cache_ptr,
unsigned int flags,
size_t new_size)
{
- /* const char * fcn_name = "unprotect_entry_with_size_change()"; */
+ const char * fcn_name = "unprotect_entry_with_size_change()";
herr_t result;
hbool_t dirty_flag_set;
hbool_t pin_flag_set;
hbool_t unpin_flag_set;
hbool_t size_changed_flag_set;
+ hbool_t verbose = FALSE;
test_entry_t * base_addr;
test_entry_t * entry_ptr;
@@ -3285,6 +3308,40 @@ unprotect_entry_with_size_change(H5C_t * cache_ptr,
( entry_ptr->size != entry_ptr->header.size ) ||
( entry_ptr->addr != entry_ptr->header.addr ) ) {
+ if ( verbose ) {
+
+ if ( result < 0 ) {
+ HDfprintf(stdout, "%s: H5C_unprotect() failed.\n", fcn_name);
+ H5Eprint(H5E_DEFAULT, stdout);
+ }
+
+ if ( entry_ptr->header.is_protected ) {
+ HDfprintf(stdout, "%s: entry still protected?!?.\n",
+ fcn_name);
+ }
+
+ if ( entry_ptr->header.type != &(types[type]) ) {
+ HDfprintf(stdout,
+ "%s: entry has bad type after unprotect.\n",
+ fcn_name);
+ }
+
+ if ( entry_ptr->size != entry_ptr->header.size ) {
+ HDfprintf(stdout,
+ "%s: bad entry size after unprotect. e/a = %d/%d\n",
+ fcn_name,
+ (int)(entry_ptr->size),
+ (int)(entry_ptr->header.size));
+ }
+
+ if ( entry_ptr->addr != entry_ptr->header.addr ) {
+ HDfprintf(stdout,
+ "%s: bad entry addr after unprotect. e/a = 0x%llx/0x%llx\n",
+ fcn_name,
+ (long long)(entry_ptr->addr),
+ (long long)(entry_ptr->header.addr));
+ }
+ }
pass = FALSE;
failure_mssg = "error in H5C_unprotect().";