summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-05-27 20:27:13 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-05-27 20:27:13 (GMT)
commit9f90e06bd0b400f5b5d9631eb680c00da3199894 (patch)
treea707a89c16689e8dee5eb927ffacd7ec5a7de91d /test
parent2f5164b1047a705e81fff46f1b8107426cbcc61b (diff)
downloadhdf5-9f90e06bd0b400f5b5d9631eb680c00da3199894.zip
hdf5-9f90e06bd0b400f5b5d9631eb680c00da3199894.tar.gz
hdf5-9f90e06bd0b400f5b5d9631eb680c00da3199894.tar.bz2
[svn-r18917] Description:
Bring r18911 (plus some adaptions to match the code on the trunk) from the metadata journaling "merging" branch to the trunk: More general changes to align trunk with eventual changes from metadata journaling branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode Mac OS X/32 10.6.3 (amazon) in debug mode Mac OS X/32 10.6.3 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'test')
-rw-r--r--test/cache.c246
-rw-r--r--test/cache_api.c520
-rw-r--r--test/cache_common.c576
-rw-r--r--test/cache_common.h148
4 files changed, 704 insertions, 786 deletions
diff --git a/test/cache.c b/test/cache.c
index 4b0c3e4..94e44a1 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -25,6 +25,7 @@
#include "H5ACprivate.h"
#include "cache_common.h"
+
/* private typedef declarations: */
struct flush_cache_test_spec
@@ -101,7 +102,7 @@ struct move_entry_test_spec
hbool_t is_pinned;
};
-
+
/* private function declarations: */
static unsigned smoke_check_1(void);
@@ -275,7 +276,7 @@ smoke_check_1(void)
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
- /* display_detailed_stats */ TRUE,
+ /* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE,
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
@@ -293,7 +294,7 @@ smoke_check_1(void)
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
- /* display_detailed_stats */ TRUE,
+ /* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE,
/* do_moves */ TRUE,
/* move_to_main_addr */ TRUE,
@@ -311,7 +312,7 @@ smoke_check_1(void)
/* verbose */ FALSE,
/* reset_stats */ TRUE,
/* display_stats */ display_stats,
- /* display_detailed_stats */ TRUE,
+ /* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE,
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
@@ -2736,7 +2737,6 @@ check_insert_entry(void)
insert_entry(file_ptr, entry_type, 3, (H5C__SET_FLUSH_MARKER_FLAG | H5C__PIN_ENTRY_FLAG));
}
-
/* Verify that the entries are inserted as desired. */
i = 0;
@@ -2883,7 +2883,6 @@ check_insert_entry(void)
} /* while */
-
/* So much for looking at the individual entries. Now verify
* that the various counts and sized in the cache header are
* as expected.
@@ -2913,7 +2912,6 @@ check_insert_entry(void)
}
}
-
/* Finally, if stats collection is enabled, verify that the expected
* stats are collected.
*/
@@ -2940,7 +2938,6 @@ check_insert_entry(void)
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
/* Unpin the pinned entries so we can take down the cache cleanly. */
if ( pass ) {
@@ -3225,92 +3222,92 @@ check_flush_cache__multi_entry(H5F_t * file_ptr)
struct flush_cache_test_spec spec[8] =
{
{
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
+ /* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
/* expected_loaded = */ TRUE,
/* expected_cleared = */ FALSE,
/* expected_flushed = */ FALSE,
- /* expected_destroyed = */ FALSE
+ /* expected_destroyed = */ FALSE
},
{
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 75,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
+ /* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 75,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
/* expected_loaded = */ TRUE,
/* expected_cleared = */ FALSE,
/* expected_flushed = */ TRUE,
- /* expected_destroyed = */ FALSE
+ /* expected_destroyed = */ FALSE
},
{
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 25,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
+ /* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 25,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
/* expected_loaded = */ FALSE,
/* expected_cleared = */ FALSE,
/* expected_flushed = */ TRUE,
- /* expected_destroyed = */ FALSE
+ /* expected_destroyed = */ FALSE
},
{
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 50,
- /* insert_flag = */ TRUE,
+ /* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 50,
+ /* insert_flag = */ TRUE,
/* flags = */ H5C__DIRTIED_FLAG,
/* expected_loaded = */ FALSE,
/* expected_cleared = */ FALSE,
/* expected_flushed = */ TRUE,
- /* expected_destroyed = */ FALSE
+ /* expected_destroyed = */ FALSE
},
{
- /* entry_num = */ 4,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* entry_num = */ 4,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_loaded = */ TRUE,
/* expected_cleared = */ FALSE,
/* expected_flushed = */ FALSE,
- /* expected_destroyed = */ FALSE
+ /* expected_destroyed = */ FALSE
},
{
- /* entry_num = */ 5,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 20,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
+ /* entry_num = */ 5,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 20,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* expected_loaded = */ TRUE,
/* expected_cleared = */ FALSE,
/* expected_flushed = */ TRUE,
- /* expected_destroyed = */ FALSE
+ /* expected_destroyed = */ FALSE
},
{
- /* entry_num = */ 6,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 30,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* entry_num = */ 6,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 30,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_loaded = */ FALSE,
/* expected_cleared = */ FALSE,
/* expected_flushed = */ TRUE,
- /* expected_destroyed = */ FALSE
+ /* expected_destroyed = */ FALSE
},
{
- /* entry_num = */ 7,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 40,
- /* insert_flag = */ TRUE,
+ /* entry_num = */ 7,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 40,
+ /* insert_flag = */ TRUE,
/* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
/* expected_loaded = */ FALSE,
/* expected_cleared = */ FALSE,
/* expected_flushed = */ TRUE,
- /* expected_destroyed = */ FALSE
+ /* expected_destroyed = */ FALSE
}
};
@@ -4936,14 +4933,14 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr,
if ( spec[i].insert_flag ) {
insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index,
- spec[i].flags);
+ spec[i].flags);
} else {
protect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index);
unprotect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index,
- spec[i].flags);
+ spec[i].flags);
}
total_entry_size += entry_sizes[spec[i].entry_type];
@@ -5164,14 +5161,14 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr,
if ( spec[i].insert_flag ) {
insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index,
- spec[i].flags);
+ spec[i].flags);
} else {
protect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index);
unprotect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index,
- spec[i].flags);
+ spec[i].flags);
}
total_entry_size += entry_sizes[spec[i].entry_type];
@@ -9765,12 +9762,12 @@ static void
check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
{
/* const char * fcn_name = "check_flush_cache__flush_op_eviction_test"; */
+ H5C_t * cache_ptr = file_ptr->shared->cache;
int i;
int num_variable_entries = 8;
int num_monster_entries = 31;
int num_large_entries = 0;
herr_t result;
- H5C_t * cache_ptr = file_ptr->shared->cache;
test_entry_t * entry_ptr;
test_entry_t * base_addr;
struct expected_entry_status expected[8 + 31 + 14] =
@@ -10021,13 +10018,13 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 0; i < 31; i++ )
{
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
for ( i = 0; i < 1; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
/* The cache should now be exactly full */
@@ -10106,7 +10103,6 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
(3 * VARIABLE_ENTRY_SIZE) +
(31 * MONSTER_ENTRY_SIZE) +
(2 * LARGE_ENTRY_SIZE)) ) ) {
-
pass = FALSE;
failure_mssg = "unexpected size/len in flush op eviction test 3.";
}
@@ -10270,13 +10266,13 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 0; i < 31; i++ )
{
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
for ( i = 0; i < 5; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
/* verify cache size */
@@ -10335,7 +10331,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 5; i < 8; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
/* verify cache size */
@@ -10396,7 +10392,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 8; i < 9; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
/* verify cache size */
@@ -10461,7 +10457,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 9; i < 10; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
/* verify cache size */
@@ -10496,13 +10492,13 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 0; i < 31; i++ )
{
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
for ( i = 0; i < 10; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
/* verify cache size */
@@ -10591,8 +10587,8 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
num_large_entries = 12;
- /* a newly loaded entry is not inserted in the cache until after space has been
- * made for it. Thus (LET, 11) will not be flushed.
+ /* a newly loaded entry is not inserted in the cache until after
+ * space has been made for it. Thus (LET, 11) will not be flushed.
*/
for ( i = num_variable_entries;
i < num_variable_entries + num_monster_entries + num_large_entries - 1;
@@ -10605,7 +10601,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 10; i < 12; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
/* verify cache size */
@@ -10637,13 +10633,13 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 0; i < num_monster_entries; i++ )
{
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
for ( i = 0; i < num_large_entries; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
/* update the expected array to mark all these entries dirty again. */
@@ -10715,8 +10711,8 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
num_large_entries = 14;
- /* a newly loaded entry is not inserted in the cache until after space has been
- * made for it. Thus (LET, 13) will not be flushed.
+ /* a newly loaded entry is not inserted in the cache until after
+ * space has been made for it. Thus (LET, 13) will not be flushed.
*/
for ( i = num_variable_entries;
i < num_variable_entries + num_monster_entries + num_large_entries - 1;
@@ -10729,7 +10725,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 12; i < 14; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
/* verify cache size */
@@ -10751,7 +10747,8 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
expected);
}
- /* at this point we have cycled all the variable size entries through the cache.
+ /* at this point we have cycled all the variable size entries through
+ * the cache.
*
* flush the cache and end the test.
*/
@@ -13283,7 +13280,7 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr,
( entry_ptr->cleared != expected_cleared ) ||
( entry_ptr->flushed != expected_flushed ) ||
( entry_ptr->destroyed != expected_destroyed ) ) {
-
+#if 0 /* this is useful debugging code -- keep it around */
HDfprintf(stdout,
"loaded = %d(%d), clrd = %d(%d), flshd = %d(%d), dest = %d(%d)\n",
(int)(entry_ptr->loaded),
@@ -13294,7 +13291,7 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr,
(int)expected_flushed,
(int)(entry_ptr->destroyed),
(int)expected_destroyed);
-
+#endif
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"Unexpected entry status after flush in pinned single entry test #%d.",
@@ -14713,10 +14710,6 @@ check_pin_protected_entry(void)
* Programmer: John Mainzer
* 7/7/06
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
@@ -17190,13 +17183,6 @@ check_pin_entry_errs(void)
* Programmer: John Mainzer
* 6/24/04
*
- * Modifications:
- *
- * - Modified call to H5C_protect() to pass H5C__NO_FLAGS_SET in the
- * the new flags parameter.
- *
- * JRM -- 3/28/07
- *
*-------------------------------------------------------------------------
*/
@@ -17275,16 +17261,6 @@ check_double_protect_err(void)
* Programmer: John Mainzer
* 6/24/04
*
- * Modifications:
- *
- * JRM -- 6/17/05
- * Modified function to use the new dirtied parameter in
- * H5C_unprotect().
- *
- * JRM -- 9/8/05
- * Updated function for the new size change parameter in
- * H5C_unprotect(). We don't use them for now.
- *
*-------------------------------------------------------------------------
*/
@@ -17668,10 +17644,6 @@ check_resize_entry_errs(void)
* Programmer: John Mainzer
* 4/3/07
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
@@ -18024,9 +17996,9 @@ check_check_evictions_enabled_err(void)
*
* Modifications:
*
- * John Mainzer 1/8/08
- * Added a basic set of tests for the flash cache size
- * increment code.
+ * John Mainzer 1/8/08
+ * Added a basic set of tests for the flash cache size
+ * increment code.
*
*-------------------------------------------------------------------------
*/
@@ -21487,19 +21459,19 @@ check_auto_cache_resize(void)
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13, 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13, H5C__DIRTIED_FLAG);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13, H5C__DIRTIED_FLAG);
flush_cache(file_ptr, TRUE, FALSE, FALSE);
@@ -21565,8 +21537,8 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 3 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (3 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
if ( ( pass ) &&
@@ -21590,8 +21562,8 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 10 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (10 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
if ( ( pass ) &&
@@ -21614,8 +21586,8 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, (10 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
if ( ( pass ) &&
@@ -21638,8 +21610,8 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, (10 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
if ( ( pass ) &&
@@ -21663,16 +21635,16 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 1 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (1 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 1 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, (1 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 1 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, (1 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
if ( pass ) {
@@ -21815,16 +21787,16 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 1 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (1 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 1 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, (1 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 1 * 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, (1 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
if ( pass ) {
@@ -22245,9 +22217,9 @@ check_auto_cache_resize(void)
*
* Modifications:
*
- * Added code to include the flash cache size increment
- * code in this test.
- * JRM -- 1/10/08
+ * Added code to include the flash cache size increment
+ * code in this test.
+ * JRM -- 1/10/08
*
*-------------------------------------------------------------------------
*/
@@ -28353,7 +28325,7 @@ check_auto_cache_resize_aux_fcns(void)
pass = FALSE;
failure_mssg = "H5C_get_cache_hit_rate failed.\n";
- } else if ( HDfabs(hit_rate - 0.5) > FP_EPSILON ) { /* i.e. hit_rate != 0.5 */
+ } else if ( ! DBL_REL_EQUAL(hit_rate, 0.5, FP_EPSILON) ) { /* i.e. hit_rate != 0.5 */
pass = FALSE;
failure_mssg =
@@ -28436,7 +28408,7 @@ check_auto_cache_resize_aux_fcns(void)
pass = FALSE;
failure_mssg = "H5C_get_cache_hit_rate failed.\n";
- } else if ( HDfabs(hit_rate - 0.5) > FP_EPSILON ) { /* i.e. hit_rate != 0.5 */
+ } else if ( ! DBL_REL_EQUAL(hit_rate, 0.5, FP_EPSILON) ) { /* i.e. hit_rate != 0.5 */
pass = FALSE;
failure_mssg =
diff --git a/test/cache_api.c b/test/cache_api.c
index e7ba7bd..8ad3635 100644
--- a/test/cache_api.c
+++ b/test/cache_api.c
@@ -30,59 +30,12 @@
/* macro definitions */
-#define RESIZE_CONFIGS_ARE_EQUAL(a, b, compare_init) \
-( ( (a).version == (b).version ) && \
- ( (a).rpt_fcn == (b).rpt_fcn ) && \
- ( ( ! compare_init ) || \
- ( (a).set_initial_size == (b).set_initial_size ) ) && \
- ( ( ! compare_init ) || \
- ( (a).initial_size == (b).initial_size ) ) && \
- ( (a).min_clean_fraction == (b).min_clean_fraction ) && \
- ( (a).max_size == (b).max_size ) && \
- ( (a).min_size == (b).min_size ) && \
- ( (a).epoch_length == (b).epoch_length ) && \
- ( (a).incr_mode == (b).incr_mode ) && \
- ( (a).lower_hr_threshold == (b).lower_hr_threshold ) && \
- ( (a).increment == (b).increment ) && \
- ( (a).apply_max_increment == (b).apply_max_increment ) && \
- ( (a).max_increment == (b).max_increment ) && \
- ( (a).flash_incr_mode == (b).flash_incr_mode ) && \
- ( (a).flash_multiple == (b).flash_multiple ) && \
- ( (a).flash_threshold == (b).flash_threshold ) && \
- ( (a).decr_mode == (b).decr_mode ) && \
- ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \
- ( (a).decrement == (b).decrement ) && \
- ( (a).apply_max_decrement == (b).apply_max_decrement ) && \
- ( (a).max_decrement == (b).max_decrement ) && \
- ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \
- ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \
- ( (a).empty_reserve == (b).empty_reserve ) )
-
-
/* private function declarations: */
static void check_fapl_mdc_api_calls(void);
-static void validate_mdc_config(hid_t file_id,
- H5AC_cache_config_t * ext_config_ptr,
- hbool_t compare_init,
- int test_num);
-
static void check_file_mdc_api_calls(void);
-static void check_and_validate_cache_hit_rate(hid_t file_id,
- double * hit_rate_ptr,
- hbool_t dump_data,
- int64_t min_accesses,
- double min_hit_rate);
-
-static void check_and_validate_cache_size(hid_t file_id,
- size_t * max_size_ptr,
- size_t * min_clean_size_ptr,
- size_t * cur_size_ptr,
- int32_t * cur_num_entries_ptr,
- hbool_t dump_data);
-
static void mdc_api_call_smoke_check(int express_test);
static void check_fapl_mdc_api_errs(void);
@@ -117,73 +70,6 @@ static void check_file_mdc_api_errs(void);
*-------------------------------------------------------------------------
*/
-#define CACHE_CONFIGS_EQUAL(a, b, cmp_set_init, cmp_init_size) \
- ( ( (a).version == (b).version ) && \
- ( (a).rpt_fcn_enabled == (b).rpt_fcn_enabled ) && \
- ( (a).open_trace_file == (b).open_trace_file ) && \
- ( (a).close_trace_file == (b).close_trace_file ) && \
- ( ( (a).open_trace_file == FALSE ) || \
- ( strcmp((a).trace_file_name, (b).trace_file_name) == 0 ) ) && \
- ( (a).evictions_enabled == (b).evictions_enabled ) && \
- ( ( ! cmp_set_init ) || \
- ( (a).set_initial_size == (b).set_initial_size ) ) && \
- ( ( ! cmp_init_size ) || \
- ( (a).initial_size == (b).initial_size ) ) && \
- ( (a).min_clean_fraction == (b).min_clean_fraction ) && \
- ( (a).max_size == (b).max_size ) && \
- ( (a).min_size == (b).min_size ) && \
- ( (a).epoch_length == (b).epoch_length ) && \
- ( (a).incr_mode == (b).incr_mode ) && \
- ( (a).lower_hr_threshold == (b).lower_hr_threshold ) && \
- ( (a).increment == (b).increment ) && \
- ( (a).apply_max_increment == (b).apply_max_increment ) && \
- ( (a).max_increment == (b).max_increment ) && \
- ( (a).flash_incr_mode == (b).flash_incr_mode ) && \
- ( (a).flash_multiple == (b).flash_multiple ) && \
- ( (a).flash_threshold == (b).flash_threshold ) && \
- ( (a).decr_mode == (b).decr_mode ) && \
- ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \
- ( (a).decrement == (b).decrement ) && \
- ( (a).apply_max_decrement == (b).apply_max_decrement ) && \
- ( (a).max_decrement == (b).max_decrement ) && \
- ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \
- ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \
- ( (a).empty_reserve == (b).empty_reserve ) )
-
-#define XLATE_EXT_TO_INT_MDC_CONFIG(i, e) \
-{ \
- (i).version = H5C__CURR_AUTO_SIZE_CTL_VER; \
- if ( (e).rpt_fcn_enabled ) \
- (i).rpt_fcn = H5C_def_auto_resize_rpt_fcn; \
- else \
- (i).rpt_fcn = NULL; \
- (i).set_initial_size = (e).set_initial_size; \
- (i).initial_size = (e).initial_size; \
- (i).min_clean_fraction = (e).min_clean_fraction; \
- (i).max_size = (e).max_size; \
- (i).min_size = (e).min_size; \
- (i).epoch_length = (long int)((e).epoch_length); \
- (i).incr_mode = (e).incr_mode; \
- (i).lower_hr_threshold = (e).lower_hr_threshold; \
- (i).increment = (e).increment; \
- (i).apply_max_increment = (e).apply_max_increment; \
- (i).max_increment = (e).max_increment; \
- (i).flash_incr_mode = (e).flash_incr_mode; \
- (i).flash_multiple = (e).flash_multiple; \
- (i).flash_threshold = (e).flash_threshold; \
- (i).decr_mode = (e).decr_mode; \
- (i).upper_hr_threshold = (e).upper_hr_threshold; \
- (i).flash_incr_mode = (e).flash_incr_mode; \
- (i).flash_multiple = (e).flash_multiple; \
- (i).flash_threshold = (e).flash_threshold; \
- (i).decrement = (e).decrement; \
- (i).apply_max_decrement = (e).apply_max_decrement; \
- (i).max_decrement = (e).max_decrement; \
- (i).epochs_before_eviction = (int)((e).epochs_before_eviction); \
- (i).apply_empty_reserve = (e).apply_empty_reserve; \
- (i).empty_reserve = (e).empty_reserve; \
-}
-
static void
check_fapl_mdc_api_calls(void)
{
@@ -382,7 +268,7 @@ check_fapl_mdc_api_calls(void)
pass = FALSE;
- failure_mssg = "Unexpected value(s) in cache resize_ctl.\n";
+ failure_mssg = "Unexpected value(s) in cache resize_ctl 1.\n";
}
}
@@ -531,7 +417,7 @@ check_fapl_mdc_api_calls(void)
pass = FALSE;
- failure_mssg = "Unexpected value(s) in cache resize_ctl.\n";
+ failure_mssg = "Unexpected value(s) in cache resize_ctl 2.\n";
}
}
@@ -608,128 +494,6 @@ check_fapl_mdc_api_calls(void)
/*-------------------------------------------------------------------------
- * Function: validate_mdc_config()
- *
- * Purpose: Verify that the file indicated by the file_id parameter
- * has both internal and external configuration matching
- * *config_ptr.
- *
- * Do nothin on success. On failure, set pass to FALSE, and
- * load an error message into failue_mssg. Note that
- * failure_msg is assumed to be at least 128 bytes in length.
- *
- * Return: void
- *
- * Programmer: John Mainzer
- * 4/14/04
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-
-static void
-validate_mdc_config(hid_t file_id,
- H5AC_cache_config_t * ext_config_ptr,
- hbool_t compare_init,
- int test_num)
-{
- /* const char * fcn_name = "validate_mdc_config()"; */
- static char msg[256];
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- H5AC_cache_config_t scratch;
- H5C_auto_size_ctl_t int_config;
-
- XLATE_EXT_TO_INT_MDC_CONFIG(int_config, (*ext_config_ptr))
-
- /* get a pointer to the files internal data structure */
- if ( pass ) {
-
- file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE);
-
- if ( file_ptr == NULL ) {
-
- pass = FALSE;
- HDsnprintf(msg, (size_t)128, "Can't get file_ptr #%d.", test_num);
- failure_mssg = msg;
-
- } else {
-
- cache_ptr = file_ptr->shared->cache;
- }
- }
-
- /* verify that we can access the internal version of the cache config */
- if ( pass ) {
-
- if ( ( cache_ptr == NULL ) ||
- ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ||
- ( cache_ptr->resize_ctl.version != H5C__CURR_AUTO_SIZE_CTL_VER ) ){
-
- pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Can't access cache resize_ctl #%d.", test_num);
- failure_mssg = msg;
- }
- }
-
- /* compare the cache's internal configuration with the expected value */
- if ( pass ) {
-
- if ( ! RESIZE_CONFIGS_ARE_EQUAL(int_config, cache_ptr->resize_ctl,
- compare_init) ) {
-
- pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Unexpected internal config #%d.", test_num);
- failure_mssg = msg;
- }
- }
-
- /* obtain external cache config */
- if ( pass ) {
-
- scratch.version = H5AC__CURR_CACHE_CONFIG_VERSION;
-
- if ( H5Fget_mdc_config(file_id, &scratch) < 0 ) {
-
- pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5Fget_mdc_config() failed #%d.", test_num);
- failure_mssg = msg;
- }
- }
-
- if ( pass ) {
-
- /* Recall that in any configuration supplied by the cache
- * at run time, the set_initial_size field will always
- * be FALSE, regardless of the value passed in. Thus we
- * always presume that this field need not match that of
- * the supplied external configuration.
- *
- * The cache also sets the initial_size field to the current
- * cache max size instead of the value initialy supplied.
- * Depending on circumstances, this may or may not match
- * the original. Hence the compare_init parameter.
- */
- if ( ! CACHE_CONFIGS_EQUAL((*ext_config_ptr), scratch, \
- FALSE, compare_init) ) {
-
- pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Unexpected external config #%d.", test_num);
- failure_mssg = msg;
- }
- }
-
- return;
-
-} /* validate_mdc_config() */
-
-
-/*-------------------------------------------------------------------------
* Function: check_file_mdc_api_calls()
*
* Purpose: Verify that the file related metadata cache API calls are
@@ -1072,282 +836,6 @@ check_file_mdc_api_calls(void)
/*-------------------------------------------------------------------------
- * Function: check_and_validate_cache_hit_rate()
- *
- * Purpose: Use the API functions to get and reset the cache hit rate.
- * Verify that the value returned by the API call agrees with
- * the cache internal data structures.
- *
- * If the number of cache accesses exceeds the value provided
- * in the min_accesses parameter, and the hit rate is less than
- * min_hit_rate, set pass to FALSE, and set failure_mssg to
- * a string indicating that hit rate was unexpectedly low.
- *
- * Return hit rate in *hit_rate_ptr, and print the data to
- * stdout if requested.
- *
- * If an error is detected, set pass to FALSE, and set
- * failure_mssg to an appropriate value.
- *
- * Return: void
- *
- * Programmer: John Mainzer
- * 4/18/04
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-
-static void
-check_and_validate_cache_hit_rate(hid_t file_id,
- double * hit_rate_ptr,
- hbool_t dump_data,
- int64_t min_accesses,
- double min_hit_rate)
-{
- /* const char * fcn_name = "check_and_validate_cache_hit_rate()"; */
- herr_t result;
- int64_t cache_hits = 0;
- int64_t cache_accesses = 0;
- double expected_hit_rate;
- double hit_rate;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
-
- /* get a pointer to the files internal data structure */
- if ( pass ) {
-
- file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE);
-
- if ( file_ptr == NULL ) {
-
- pass = FALSE;
- failure_mssg = "Can't get file_ptr.";
-
- } else {
-
- cache_ptr = file_ptr->shared->cache;
- }
- }
-
- /* verify that we can access the cache data structure */
- if ( pass ) {
-
- if ( ( cache_ptr == NULL ) ||
- ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {
-
- pass = FALSE;
- failure_mssg = "Can't access cache resize_ctl.";
- }
- }
-
- /* compare the cache's internal configuration with the expected value */
- if ( pass ) {
-
- cache_hits = cache_ptr->cache_hits;
- cache_accesses = cache_ptr->cache_accesses;
-
- if ( cache_accesses > 0 ) {
-
- expected_hit_rate = ((double)cache_hits) / ((double)cache_accesses);
-
- } else {
-
- expected_hit_rate = 0.0;
- }
-
- result = H5Fget_mdc_hit_rate(file_id, &hit_rate);
-
- if ( result < 0 ) {
-
- pass = FALSE;
- failure_mssg = "H5Fget_mdc_hit_rate() failed.";
-
- } else if ( hit_rate != expected_hit_rate ) {
-
- pass = FALSE;
- failure_mssg = "unexpected hit rate.";
- }
- }
-
- if ( pass ) { /* reset the hit rate */
-
- result = H5Freset_mdc_hit_rate_stats(file_id);
-
- if ( result < 0 ) {
-
- pass = FALSE;
- failure_mssg = "H5Freset_mdc_hit_rate_stats() failed.";
- }
- }
-
- /* set *hit_rate_ptr if appropriate */
- if ( ( pass ) && ( hit_rate_ptr != NULL ) ) {
-
- *hit_rate_ptr = hit_rate;
- }
-
- /* dump data to stdout if requested */
- if ( ( pass ) && ( dump_data ) ) {
-
- HDfprintf(stdout,
- "cache_hits: %ld, cache_accesses: %ld, hit_rate: %lf\n",
- (long)cache_hits, (long)cache_accesses, hit_rate);
- }
-
- if ( ( pass ) &&
- ( cache_accesses > min_accesses ) &&
- ( hit_rate < min_hit_rate ) ) {
-
- pass = FALSE;
- failure_mssg = "Unexpectedly low hit rate.";
- }
-
- return;
-
-} /* check_and_validate_cache_hit_rate() */
-
-
-/*-------------------------------------------------------------------------
- * Function: check_and_validate_cache_size()
- *
- * Purpose: Use the API function to get the cache size data. Verify
- * that the values returned by the API call agree with
- * the cache internal data structures.
- *
- * Return size data in the locations specified by the pointer
- * parameters if these parameters are not NULL. Print the
- * data to stdout if requested.
- *
- * If an error is detected, set pass to FALSE, and set
- * failure_mssg to an appropriate value.
- *
- * Return: void
- *
- * Programmer: John Mainzer
- * 4/18/04
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-
-static void
-check_and_validate_cache_size(hid_t file_id,
- size_t * max_size_ptr,
- size_t * min_clean_size_ptr,
- size_t * cur_size_ptr,
- int32_t * cur_num_entries_ptr,
- hbool_t dump_data)
-{
- /* const char * fcn_name = "check_and_validate_cache_size()"; */
- herr_t result;
- size_t expected_max_size;
- size_t max_size;
- size_t expected_min_clean_size;
- size_t min_clean_size;
- size_t expected_cur_size;
- size_t cur_size;
- int32_t expected_cur_num_entries;
- int cur_num_entries;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
-
- /* get a pointer to the files internal data structure */
- if ( pass ) {
-
- file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE);
-
- if ( file_ptr == NULL ) {
-
- pass = FALSE;
- failure_mssg = "Can't get file_ptr.";
-
- } else {
-
- cache_ptr = file_ptr->shared->cache;
- }
- }
-
- /* verify that we can access the cache data structure */
- if ( pass ) {
-
- if ( ( cache_ptr == NULL ) ||
- ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {
-
- pass = FALSE;
- failure_mssg = "Can't access cache data structure.";
- }
- }
-
- /* compare the cache's internal configuration with the expected value */
- if ( pass ) {
-
- expected_max_size = cache_ptr->max_cache_size;
- expected_min_clean_size = cache_ptr->min_clean_size;
- expected_cur_size = cache_ptr->index_size;
- expected_cur_num_entries = cache_ptr->index_len;
-
- result = H5Fget_mdc_size(file_id,
- &max_size,
- &min_clean_size,
- &cur_size,
- &cur_num_entries);
-
- if ( result < 0 ) {
-
- pass = FALSE;
- failure_mssg = "H5Fget_mdc_size() failed.";
-
- } else if ( ( max_size != expected_max_size ) ||
- ( min_clean_size != expected_min_clean_size ) ||
- ( cur_size != expected_cur_size ) ||
- ( cur_num_entries != (int)expected_cur_num_entries ) ) {
-
- pass = FALSE;
- failure_mssg = "H5Fget_mdc_size() returned unexpected value(s).";
-
- }
- }
-
- /* return size values if requested */
- if ( ( pass ) && ( max_size_ptr != NULL ) ) {
-
- *max_size_ptr = max_size;
- }
-
- if ( ( pass ) && ( min_clean_size_ptr != NULL ) ) {
-
- *min_clean_size_ptr = min_clean_size;
- }
-
- if ( ( pass ) && ( cur_size_ptr != NULL ) ) {
-
- *cur_size_ptr = cur_size;
- }
-
- if ( ( pass ) && ( cur_num_entries_ptr != NULL ) ) {
-
- *cur_num_entries_ptr = cur_num_entries;
- }
-
-
- /* dump data to stdout if requested */
- if ( ( pass ) && ( dump_data ) ) {
-
- HDfprintf(stdout,
- "max_sz: %ld, min_clean_sz: %ld, cur_sz: %ld, cur_ent: %ld\n",
- (long)max_size, (long)min_clean_size, (long)cur_size,
- (long)cur_num_entries);
- }
-
- return;
-
-} /* check_and_validate_cache_size() */
-
-
-/*-------------------------------------------------------------------------
* Function: mdc_api_call_smoke_check()
*
* Purpose:
@@ -3424,7 +2912,9 @@ check_fapl_mdc_api_errs(void)
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
if ( pass ) {
- H5E_BEGIN_TRY { result = H5Pget_mdc_config(-1, &scratch); } H5E_END_TRY;
+ H5E_BEGIN_TRY {
+ result = H5Pget_mdc_config(-1, &scratch);
+ } H5E_END_TRY;
if ( result >= 0 ) {
diff --git a/test/cache_common.c b/test/cache_common.c
index 868b4d9..4024816 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -547,10 +547,6 @@ check_write_permitted(const H5F_t UNUSED * f,
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
- * Added variable_clear. -- JRM 8/30/06
- *
*-------------------------------------------------------------------------
*/
@@ -682,16 +678,6 @@ notify_clear(H5F_t * f, void * thing, hbool_t dest)
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
- * JRM -- 4/4/06
- * Added code to decrement the pinning_ref_count s of entries
- * pinned by the target entry, and to unpin those entries
- * if the reference count drops to zero.
- *
- * JRM -- 8/30/06
- * Added variable_destroy().
- *
*-------------------------------------------------------------------------
*/
@@ -855,14 +841,6 @@ notify_dest(H5F_t * f, void * thing)
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
- * JRM -- 8/30/06
- * Added variable_flush() and flags_ptr parameter.
- *
- * JRM -- 9/1/06
- * Added support for flush operations.
- *
*-------------------------------------------------------------------------
*/
@@ -1042,11 +1020,6 @@ notify_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
- * JRM -- 8/30/06
- * Added variable_load().
- *
*-------------------------------------------------------------------------
*/
@@ -1177,11 +1150,6 @@ notify_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
- * JRM -- 8/30/06
- * Added variable_size().
- *
*-------------------------------------------------------------------------
*/
@@ -1605,7 +1573,7 @@ execute_flush_op(H5F_t * file_ptr,
{
H5C_t * cache_ptr;
- HDassert( file_ptr ) ;
+ HDassert( file_ptr );
cache_ptr = file_ptr->shared->cache;
HDassert( cache_ptr != NULL );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
@@ -1616,7 +1584,7 @@ execute_flush_op(H5F_t * file_ptr,
( entry_ptr->header.size == entry_ptr->size ) );
HDassert( op_ptr != NULL );
HDassert( ( 0 <= entry_ptr->type ) &&
- ( entry_ptr->type < NUMBER_OF_ENTRY_TYPES ) );
+ ( entry_ptr->type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( ( 0 <= entry_ptr->index ) &&
( entry_ptr->index <= max_indices[entry_ptr->type] ) );
HDassert( ( 0 <= op_ptr->type ) &&
@@ -1926,26 +1894,27 @@ resize_entry(H5F_t * file_ptr,
if ( pass ) {
- base_addr = entries[type];
- entry_ptr = &(base_addr[idx]);
-
- HDassert( entry_ptr->index == idx );
- HDassert( entry_ptr->type == type );
- HDassert( entry_ptr == entry_ptr->self );
-
if ( in_cache ) {
H5C_t *cache_ptr = file_ptr->shared->cache;
HDassert( cache_ptr );
- if ( ! entry_in_cache(cache_ptr, type, idx) ) {
+ if ( ! entry_in_cache(cache_ptr, type, idx) ) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "entry to be resized pinned is not in cache.";
- } else {
+ } else {
- if ( ! ( entry_ptr->header.is_pinned || entry_ptr->header.is_protected ) ) {
+ base_addr = entries[type];
+ entry_ptr = &(base_addr[idx]);
+
+ HDassert( entry_ptr->index == idx );
+ HDassert( entry_ptr->type == type );
+ HDassert( entry_ptr->cache_ptr == cache_ptr );
+ HDassert( entry_ptr == entry_ptr->self );
+
+ if ( ! ( entry_ptr->header.is_pinned || entry_ptr->header.is_protected ) ) {
pass = FALSE;
failure_mssg = "entry to be resized is not pinned or protected.";
@@ -3088,9 +3057,8 @@ insert_entry(H5F_t * file_ptr,
void
mark_entry_dirty(int32_t type,
- int32_t idx)
+ int32_t idx)
{
- /* const char * fcn_name = "mark_pinned_entry_dirty()"; */
herr_t result;
test_entry_t * base_addr;
test_entry_t * entry_ptr;
@@ -3138,7 +3106,7 @@ mark_entry_dirty(int32_t type,
/*-------------------------------------------------------------------------
* Function: move_entry()
*
- * Purpose: move the entry indicated by the type and index to its
+ * Purpose: Move the entry indicated by the type and index to its
* main or alternate address as indicated. If the entry is
* already at the desired entry, do nothing.
*
@@ -3163,70 +3131,73 @@ move_entry(H5C_t * cache_ptr,
test_entry_t * base_addr;
test_entry_t * entry_ptr;
- HDassert( cache_ptr );
- HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
+ if ( pass ) {
- base_addr = entries[type];
- entry_ptr = &(base_addr[idx]);
+ HDassert( cache_ptr );
+ HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
+ HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
- HDassert( entry_ptr->index == idx );
- HDassert( entry_ptr->type == type );
- HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->cache_ptr == cache_ptr );
- HDassert( !(entry_ptr->is_protected) );
- HDassert( !(entry_ptr->header.is_protected) );
+ base_addr = entries[type];
+ entry_ptr = &(base_addr[idx]);
+ HDassert( entry_ptr->index == idx );
+ HDassert( entry_ptr->type == type );
+ HDassert( entry_ptr == entry_ptr->self );
+ HDassert( entry_ptr->cache_ptr == cache_ptr );
+ HDassert( !(entry_ptr->is_protected) );
+ HDassert( !(entry_ptr->header.is_protected) );
- if ( entry_ptr->at_main_addr && !main_addr ) {
- /* move to alt addr */
+ if ( entry_ptr->at_main_addr && !main_addr ) {
- HDassert( entry_ptr->addr == entry_ptr->main_addr );
+ /* move to alt addr */
- done = FALSE;
- old_addr = entry_ptr->addr;
- new_addr = entry_ptr->alt_addr;
+ HDassert( entry_ptr->addr == entry_ptr->main_addr );
- } else if ( !(entry_ptr->at_main_addr) && main_addr ) {
+ done = FALSE;
+ old_addr = entry_ptr->addr;
+ new_addr = entry_ptr->alt_addr;
- /* move to main addr */
+ } else if ( !(entry_ptr->at_main_addr) && main_addr ) {
- HDassert( entry_ptr->addr == entry_ptr->alt_addr );
+ /* move to main addr */
- done = FALSE;
- old_addr = entry_ptr->addr;
- new_addr = entry_ptr->main_addr;
- }
+ HDassert( entry_ptr->addr == entry_ptr->alt_addr );
- if ( ! done ) {
+ done = FALSE;
+ old_addr = entry_ptr->addr;
+ new_addr = entry_ptr->main_addr;
+ }
- entry_ptr->is_dirty = TRUE;
+ if ( ! done ) {
- result = H5C_move_entry(cache_ptr, &(types[type]),
- old_addr, new_addr);
- }
+ entry_ptr->is_dirty = TRUE;
- if ( ! done ) {
+ result = H5C_move_entry(cache_ptr, &(types[type]),
+ old_addr, new_addr);
+ }
- if ( ( result < 0 ) ||
- ( ( ! ( entry_ptr->header.destroy_in_progress ) ) &&
- ( entry_ptr->header.addr != new_addr ) ) ) {
+ if ( ! done ) {
- pass = FALSE;
- failure_mssg = "error in H5C_move_entry().";
+ if ( ( result < 0 ) ||
+ ( ( ! ( entry_ptr->header.destroy_in_progress ) ) &&
+ ( entry_ptr->header.addr != new_addr ) ) ) {
- } else {
+ pass = FALSE;
+ failure_mssg = "error in H5C_move_entry().";
+
+ } else {
- entry_ptr->addr = new_addr;
- entry_ptr->at_main_addr = main_addr;
+ entry_ptr->addr = new_addr;
+ entry_ptr->at_main_addr = main_addr;
+ }
}
- }
- HDassert( ((entry_ptr->header).type)->id == type );
+ HDassert( ((entry_ptr->header).type)->id == type );
- HDassert( entry_ptr->header.is_dirty );
- HDassert( entry_ptr->is_dirty );
+ HDassert( entry_ptr->header.is_dirty );
+ HDassert( entry_ptr->is_dirty );
+ }
return;
@@ -3253,7 +3224,6 @@ protect_entry(H5F_t * file_ptr,
int32_t type,
int32_t idx)
{
- /* const char * fcn_name = "protect_entry()"; */
H5C_t * cache_ptr;
test_entry_t * base_addr;
test_entry_t * entry_ptr;
@@ -3489,7 +3459,6 @@ unpin_entry(int32_t type,
test_entry_t * entry_ptr;
if ( pass ) {
-
HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
@@ -3552,8 +3521,6 @@ unprotect_entry(H5F_t * file_ptr,
int32_t idx,
unsigned int flags)
{
- /* const char * fcn_name = "unprotect_entry()"; */
- H5C_t *cache_ptr;
herr_t result;
hbool_t pin_flag_set;
hbool_t unpin_flag_set;
@@ -3561,10 +3528,6 @@ unprotect_entry(H5F_t * file_ptr,
test_entry_t * entry_ptr;
if ( pass ) {
-
- cache_ptr = file_ptr->shared->cache;
-
- HDassert( cache_ptr );
HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
@@ -3574,7 +3537,6 @@ unprotect_entry(H5F_t * file_ptr,
HDassert( entry_ptr->index == idx );
HDassert( entry_ptr->type == type );
HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->cache_ptr == cache_ptr );
HDassert( entry_ptr->header.is_protected );
HDassert( entry_ptr->is_protected );
@@ -3599,26 +3561,6 @@ unprotect_entry(H5F_t * file_ptr,
( entry_ptr->size != entry_ptr->header.size ) ||
( entry_ptr->addr != entry_ptr->header.addr ) ) {
-#if 1 /* JRM */
- if ( result < 0 ) {
- HDfprintf(stdout, "result is negative.\n");
- }
- if ( ( entry_ptr->header.is_protected ) &&
- ( ( ! ( entry_ptr->is_read_only ) ) ||
- ( entry_ptr->ro_ref_count <= 0 ) ) ) {
- HDfprintf(stdout, "protected and not RO or refcnt <= 0.\n");
- }
- if ( entry_ptr->header.type != &(types[type]) ) {
- HDfprintf(stdout, "type disagreement.\n");
- }
- if ( entry_ptr->size != entry_ptr->header.size ) {
- HDfprintf(stdout, "size disagreement.\n");
- }
- if ( entry_ptr->addr != entry_ptr->header.addr ) {
- HDfprintf(stdout, "addr disagreement.\n");
- }
-#endif /* JRM */
-
pass = FALSE;
failure_mssg = "error in H5C_unprotect().";
@@ -5133,3 +5075,399 @@ destroy_flush_dependency(int32_t par_type,
} /* destroy_flush_dependency() */
+
+/*** H5AC level utility functions ***/
+
+
+/*-------------------------------------------------------------------------
+ * Function: check_and_validate_cache_hit_rate()
+ *
+ * Purpose: Use the API functions to get and reset the cache hit rate.
+ * Verify that the value returned by the API call agrees with
+ * the cache internal data structures.
+ *
+ * If the number of cache accesses exceeds the value provided
+ * in the min_accesses parameter, and the hit rate is less than
+ * min_hit_rate, set pass to FALSE, and set failure_mssg to
+ * a string indicating that hit rate was unexpectedly low.
+ *
+ * Return hit rate in *hit_rate_ptr, and print the data to
+ * stdout if requested.
+ *
+ * If an error is detected, set pass to FALSE, and set
+ * failure_mssg to an appropriate value.
+ *
+ * Return: void
+ *
+ * Programmer: John Mainzer
+ * 4/18/04
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void
+check_and_validate_cache_hit_rate(hid_t file_id,
+ double * hit_rate_ptr,
+ hbool_t dump_data,
+ int64_t min_accesses,
+ double min_hit_rate)
+{
+ /* const char * fcn_name = "check_and_validate_cache_hit_rate()"; */
+ herr_t result;
+ int64_t cache_hits = 0;
+ int64_t cache_accesses = 0;
+ double expected_hit_rate;
+ double hit_rate;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+
+ /* get a pointer to the files internal data structure */
+ if ( pass ) {
+
+ file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE);
+
+ if ( file_ptr == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "Can't get file_ptr.";
+
+ } else {
+
+ cache_ptr = file_ptr->shared->cache;
+ }
+ }
+
+ /* verify that we can access the cache data structure */
+ if ( pass ) {
+
+ if ( ( cache_ptr == NULL ) ||
+ ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {
+
+ pass = FALSE;
+ failure_mssg = "Can't access cache resize_ctl.";
+ }
+ }
+
+ /* compare the cache's internal configuration with the expected value */
+ if ( pass ) {
+
+ cache_hits = cache_ptr->cache_hits;
+ cache_accesses = cache_ptr->cache_accesses;
+
+ if ( cache_accesses > 0 ) {
+
+ expected_hit_rate = ((double)cache_hits) / ((double)cache_accesses);
+
+ } else {
+
+ expected_hit_rate = 0.0;
+ }
+
+ result = H5Fget_mdc_hit_rate(file_id, &hit_rate);
+
+ if ( result < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "H5Fget_mdc_hit_rate() failed.";
+
+ } else if ( ! DBL_REL_EQUAL(hit_rate, expected_hit_rate, 0.00001) ) {
+
+ pass = FALSE;
+ failure_mssg = "unexpected hit rate.";
+
+ }
+ }
+
+ if ( pass ) { /* reset the hit rate */
+
+ result = H5Freset_mdc_hit_rate_stats(file_id);
+
+ if ( result < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "H5Freset_mdc_hit_rate_stats() failed.";
+ }
+ }
+
+ /* set *hit_rate_ptr if appropriate */
+ if ( ( pass ) && ( hit_rate_ptr != NULL ) ) {
+
+ *hit_rate_ptr = hit_rate;
+ }
+
+ /* dump data to stdout if requested */
+ if ( ( pass ) && ( dump_data ) ) {
+
+ HDfprintf(stdout,
+ "cache_hits: %ld, cache_accesses: %ld, hit_rate: %lf\n",
+ (long)cache_hits, (long)cache_accesses, hit_rate);
+ }
+
+ if ( ( pass ) &&
+ ( cache_accesses > min_accesses ) &&
+ ( hit_rate < min_hit_rate ) ) {
+
+ pass = FALSE;
+ failure_mssg = "Unexpectedly low hit rate.";
+ }
+
+ return;
+
+} /* check_and_validate_cache_hit_rate() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: check_and_validate_cache_size()
+ *
+ * Purpose: Use the API function to get the cache size data. Verify
+ * that the values returned by the API call agree with
+ * the cache internal data structures.
+ *
+ * Return size data in the locations specified by the pointer
+ * parameters if these parameters are not NULL. Print the
+ * data to stdout if requested.
+ *
+ * If an error is detected, set pass to FALSE, and set
+ * failure_mssg to an appropriate value.
+ *
+ * Return: void
+ *
+ * Programmer: John Mainzer
+ * 4/18/04
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void
+check_and_validate_cache_size(hid_t file_id,
+ size_t * max_size_ptr,
+ size_t * min_clean_size_ptr,
+ size_t * cur_size_ptr,
+ int32_t * cur_num_entries_ptr,
+ hbool_t dump_data)
+{
+ /* const char * fcn_name = "check_and_validate_cache_size()"; */
+ herr_t result;
+ size_t expected_max_size;
+ size_t max_size;
+ size_t expected_min_clean_size;
+ size_t min_clean_size;
+ size_t expected_cur_size;
+ size_t cur_size;
+ int32_t expected_cur_num_entries;
+ int cur_num_entries;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+
+ /* get a pointer to the files internal data structure */
+ if ( pass ) {
+
+ file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE);
+
+ if ( file_ptr == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "Can't get file_ptr.";
+
+ } else {
+
+ cache_ptr = file_ptr->shared->cache;
+ }
+ }
+
+ /* verify that we can access the cache data structure */
+ if ( pass ) {
+
+ if ( ( cache_ptr == NULL ) ||
+ ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {
+
+ pass = FALSE;
+ failure_mssg = "Can't access cache data structure.";
+ }
+ }
+
+ /* compare the cache's internal configuration with the expected value */
+ if ( pass ) {
+
+ expected_max_size = cache_ptr->max_cache_size;
+ expected_min_clean_size = cache_ptr->min_clean_size;
+ expected_cur_size = cache_ptr->index_size;
+ expected_cur_num_entries = cache_ptr->index_len;
+
+ result = H5Fget_mdc_size(file_id,
+ &max_size,
+ &min_clean_size,
+ &cur_size,
+ &cur_num_entries);
+
+ if ( result < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "H5Fget_mdc_size() failed.";
+
+ } else if ( ( max_size != expected_max_size ) ||
+ ( min_clean_size != expected_min_clean_size ) ||
+ ( cur_size != expected_cur_size ) ||
+ ( cur_num_entries != (int)expected_cur_num_entries ) ) {
+
+ pass = FALSE;
+ failure_mssg = "H5Fget_mdc_size() returned unexpected value(s).";
+
+ }
+ }
+
+ /* return size values if requested */
+ if ( ( pass ) && ( max_size_ptr != NULL ) ) {
+
+ *max_size_ptr = max_size;
+ }
+
+ if ( ( pass ) && ( min_clean_size_ptr != NULL ) ) {
+
+ *min_clean_size_ptr = min_clean_size;
+ }
+
+ if ( ( pass ) && ( cur_size_ptr != NULL ) ) {
+
+ *cur_size_ptr = cur_size;
+ }
+
+ if ( ( pass ) && ( cur_num_entries_ptr != NULL ) ) {
+
+ *cur_num_entries_ptr = cur_num_entries;
+ }
+
+
+ /* dump data to stdout if requested */
+ if ( ( pass ) && ( dump_data ) ) {
+
+ HDfprintf(stdout,
+ "max_sz: %ld, min_clean_sz: %ld, cur_sz: %ld, cur_ent: %ld\n",
+ (long)max_size, (long)min_clean_size, (long)cur_size,
+ (long)cur_num_entries);
+ }
+
+ return;
+
+} /* check_and_validate_cache_size() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: validate_mdc_config()
+ *
+ * Purpose: Verify that the file indicated by the file_id parameter
+ * has both internal and external configuration matching
+ * *config_ptr.
+ *
+ * Do nothin on success. On failure, set pass to FALSE, and
+ * load an error message into failue_mssg. Note that
+ * failure_msg is assumed to be at least 128 bytes in length.
+ *
+ * Return: void
+ *
+ * Programmer: John Mainzer
+ * 4/14/04
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void
+validate_mdc_config(hid_t file_id,
+ H5AC_cache_config_t * ext_config_ptr,
+ hbool_t compare_init,
+ int test_num)
+{
+ /* const char * fcn_name = "validate_mdc_config()"; */
+ static char msg[256];
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ H5AC_cache_config_t scratch;
+ H5C_auto_size_ctl_t int_config;
+
+ XLATE_EXT_TO_INT_MDC_CONFIG(int_config, (*ext_config_ptr))
+
+ /* get a pointer to the files internal data structure */
+ if ( pass ) {
+
+ file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE);
+
+ if ( file_ptr == NULL ) {
+
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128, "Can't get file_ptr #%d.", test_num);
+ failure_mssg = msg;
+
+ } else {
+
+ cache_ptr = file_ptr->shared->cache;
+ }
+ }
+
+ /* verify that we can access the internal version of the cache config */
+ if ( pass ) {
+
+ if ( ( cache_ptr == NULL ) ||
+ ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ||
+ ( cache_ptr->resize_ctl.version != H5C__CURR_AUTO_SIZE_CTL_VER ) ){
+
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128,
+ "Can't access cache resize_ctl #%d.", test_num);
+ failure_mssg = msg;
+ }
+ }
+
+ /* compare the cache's internal configuration with the expected value */
+ if ( pass ) {
+
+ if ( ! RESIZE_CONFIGS_ARE_EQUAL(int_config, cache_ptr->resize_ctl,
+ compare_init) ) {
+
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128,
+ "Unexpected internal config #%d.", test_num);
+ failure_mssg = msg;
+ }
+ }
+
+ /* obtain external cache config */
+ if ( pass ) {
+
+ scratch.version = H5AC__CURR_CACHE_CONFIG_VERSION;
+
+ if ( H5Fget_mdc_config(file_id, &scratch) < 0 ) {
+
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128,
+ "H5Fget_mdc_config() failed #%d.", test_num);
+ failure_mssg = msg;
+ }
+ }
+
+ if ( pass ) {
+
+ /* Recall that in any configuration supplied by the cache
+ * at run time, the set_initial_size field will always
+ * be FALSE, regardless of the value passed in. Thus we
+ * always presume that this field need not match that of
+ * the supplied external configuration.
+ *
+ * The cache also sets the initial_size field to the current
+ * cache max size instead of the value initialy supplied.
+ * Depending on circumstances, this may or may not match
+ * the original. Hence the compare_init parameter.
+ */
+ if ( ! CACHE_CONFIGS_EQUAL((*ext_config_ptr), scratch, \
+ FALSE, compare_init) ) {
+
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128,
+ "Unexpected external config #%d.", test_num);
+ failure_mssg = msg;
+ }
+ }
+
+ return;
+
+} /* validate_mdc_config() */
+
diff --git a/test/cache_common.h b/test/cache_common.h
index d828304..91fdd6c 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -329,8 +329,8 @@ typedef struct test_entry_t
unsigned notify_before_evict_count; /* Count of times that entry was removed in cache */
} test_entry_t;
-/* The following is a cut down copy of the hash table manipulation
- * macros from H5C.c, which have been further modified to avoid references
+/* The following are cut down test versions of the hash table manipulation
+ * macros from H5Cpkg.h, which have been further modified to avoid references
* to the error reporting macros. Needless to say, these macros must be
* updated as necessary.
*/
@@ -339,14 +339,14 @@ typedef struct test_entry_t
#define H5C__HASH_FCN(x) (int)(((x) & H5C__HASH_MASK) >> 3)
#define H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \
-if ( ( (cache_ptr) == NULL ) || \
- ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
- ( (cache_ptr)->index_size != \
+if ( ( (cache_ptr) == NULL ) || \
+ ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
+ ( (cache_ptr)->index_size != \
((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \
- ( ! H5F_addr_defined(Addr) ) || \
- ( H5C__HASH_FCN(Addr) < 0 ) || \
- ( H5C__HASH_FCN(Addr) >= H5C__HASH_TABLE_LEN ) ) { \
- HDfprintf(stdout, "Pre HT search SC failed.\n"); \
+ ( ! H5F_addr_defined(Addr) ) || \
+ ( H5C__HASH_FCN(Addr) < 0 ) || \
+ ( H5C__HASH_FCN(Addr) >= H5C__HASH_TABLE_LEN ) ) { \
+ HDfprintf(stdout, "Pre HT search SC failed.\n"); \
}
#define H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \
@@ -371,18 +371,18 @@ if ( ( (cache_ptr) == NULL ) || \
HDfprintf(stdout, "Post successful HT search SC failed.\n"); \
}
-#define H5C_TEST__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k) \
+#define H5C_TEST__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k) \
if ( ( (cache_ptr) == NULL ) || \
( ((cache_ptr)->index)[k] != (entry_ptr) ) || \
( (entry_ptr)->ht_prev != NULL ) ) { \
HDfprintf(stdout, "Post HT shift to front failed.\n"); \
}
-#define H5C_TEST__SEARCH_INDEX(cache_ptr, Addr, entry_ptr) \
+#define H5C_TEST__SEARCH_INDEX(cache_ptr, Addr, entry_ptr) \
{ \
int k; \
int depth = 0; \
- H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \
+ H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \
k = H5C__HASH_FCN(Addr); \
entry_ptr = ((cache_ptr)->index)[k]; \
while ( ( entry_ptr ) && ( H5F_addr_ne(Addr, (entry_ptr)->addr) ) ) \
@@ -392,7 +392,7 @@ if ( ( (cache_ptr) == NULL ) || \
} \
if ( entry_ptr ) \
{ \
- H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \
+ H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \
if ( entry_ptr != ((cache_ptr)->index)[k] ) \
{ \
if ( (entry_ptr)->ht_next ) \
@@ -405,11 +405,109 @@ if ( ( (cache_ptr) == NULL ) || \
(entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \
(entry_ptr)->ht_prev = NULL; \
((cache_ptr)->index)[k] = (entry_ptr); \
- H5C_TEST__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k) \
+ H5C_TEST__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k) \
} \
} \
}
+/* Macros used in H5AC level tests */
+
+#define CACHE_CONFIGS_EQUAL(a, b, cmp_set_init, cmp_init_size) \
+ ( ( (a).version == (b).version ) && \
+ ( (a).rpt_fcn_enabled == (b).rpt_fcn_enabled ) && \
+ ( (a).open_trace_file == (b).open_trace_file ) && \
+ ( (a).close_trace_file == (b).close_trace_file ) && \
+ ( ( (a).open_trace_file == FALSE ) || \
+ ( strcmp((a).trace_file_name, (b).trace_file_name) == 0 ) ) && \
+ ( (a).evictions_enabled == (b).evictions_enabled ) && \
+ ( ( ! cmp_set_init ) || \
+ ( (a).set_initial_size == (b).set_initial_size ) ) && \
+ ( ( ! cmp_init_size ) || \
+ ( (a).initial_size == (b).initial_size ) ) && \
+ ( (a).min_clean_fraction == (b).min_clean_fraction ) && \
+ ( (a).max_size == (b).max_size ) && \
+ ( (a).min_size == (b).min_size ) && \
+ ( (a).epoch_length == (b).epoch_length ) && \
+ ( (a).incr_mode == (b).incr_mode ) && \
+ ( (a).lower_hr_threshold == (b).lower_hr_threshold ) && \
+ ( (a).increment == (b).increment ) && \
+ ( (a).apply_max_increment == (b).apply_max_increment ) && \
+ ( (a).max_increment == (b).max_increment ) && \
+ ( (a).flash_incr_mode == (b).flash_incr_mode ) && \
+ ( (a).flash_multiple == (b).flash_multiple ) && \
+ ( (a).flash_threshold == (b).flash_threshold ) && \
+ ( (a).decr_mode == (b).decr_mode ) && \
+ ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \
+ ( (a).decrement == (b).decrement ) && \
+ ( (a).apply_max_decrement == (b).apply_max_decrement ) && \
+ ( (a).max_decrement == (b).max_decrement ) && \
+ ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \
+ ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \
+ ( (a).empty_reserve == (b).empty_reserve ) )
+
+#define RESIZE_CONFIGS_ARE_EQUAL(a, b, compare_init) \
+( ( (a).version == (b).version ) && \
+ ( (a).rpt_fcn == (b).rpt_fcn ) && \
+ ( ( ! compare_init ) || \
+ ( (a).set_initial_size == (b).set_initial_size ) ) && \
+ ( ( ! compare_init ) || \
+ ( (a).initial_size == (b).initial_size ) ) && \
+ ( DBL_REL_EQUAL((a).min_clean_fraction, (b).min_clean_fraction, 0.00001 ) ) && \
+ ( (a).max_size == (b).max_size ) && \
+ ( (a).min_size == (b).min_size ) && \
+ ( (a).epoch_length == (b).epoch_length ) && \
+ ( (a).incr_mode == (b).incr_mode ) && \
+ ( DBL_REL_EQUAL((a).lower_hr_threshold, (b).lower_hr_threshold, 0.00001 ) ) && \
+ ( DBL_REL_EQUAL((a).increment, (b).increment, 0.00001 ) ) && \
+ ( (a).apply_max_increment == (b).apply_max_increment ) && \
+ ( (a).max_increment == (b).max_increment ) && \
+ ( (a).flash_incr_mode == (b).flash_incr_mode ) && \
+ ( DBL_REL_EQUAL((a).flash_multiple, (b).flash_multiple, 0.00001 ) ) && \
+ ( DBL_REL_EQUAL((a).flash_threshold, (b).flash_threshold, 0.00001 ) ) && \
+ ( (a).decr_mode == (b).decr_mode ) && \
+ ( DBL_REL_EQUAL((a).upper_hr_threshold, (b).upper_hr_threshold, 0.00001 ) ) && \
+ ( DBL_REL_EQUAL((a).decrement, (b).decrement, 0.00001 ) ) && \
+ ( (a).apply_max_decrement == (b).apply_max_decrement ) && \
+ ( (a).max_decrement == (b).max_decrement ) && \
+ ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \
+ ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \
+ ( DBL_REL_EQUAL((a).empty_reserve, (b).empty_reserve, 0.00001 ) ) )
+
+
+#define XLATE_EXT_TO_INT_MDC_CONFIG(i, e) \
+{ \
+ (i).version = H5C__CURR_AUTO_SIZE_CTL_VER; \
+ if ( (e).rpt_fcn_enabled ) \
+ (i).rpt_fcn = H5C_def_auto_resize_rpt_fcn; \
+ else \
+ (i).rpt_fcn = NULL; \
+ (i).set_initial_size = (e).set_initial_size; \
+ (i).initial_size = (e).initial_size; \
+ (i).min_clean_fraction = (e).min_clean_fraction; \
+ (i).max_size = (e).max_size; \
+ (i).min_size = (e).min_size; \
+ (i).epoch_length = (long int)((e).epoch_length); \
+ (i).incr_mode = (e).incr_mode; \
+ (i).lower_hr_threshold = (e).lower_hr_threshold; \
+ (i).increment = (e).increment; \
+ (i).apply_max_increment = (e).apply_max_increment; \
+ (i).max_increment = (e).max_increment; \
+ (i).flash_incr_mode = (e).flash_incr_mode; \
+ (i).flash_multiple = (e).flash_multiple; \
+ (i).flash_threshold = (e).flash_threshold; \
+ (i).decr_mode = (e).decr_mode; \
+ (i).upper_hr_threshold = (e).upper_hr_threshold; \
+ (i).flash_incr_mode = (e).flash_incr_mode; \
+ (i).flash_multiple = (e).flash_multiple; \
+ (i).flash_threshold = (e).flash_threshold; \
+ (i).decrement = (e).decrement; \
+ (i).apply_max_decrement = (e).apply_max_decrement; \
+ (i).max_decrement = (e).max_decrement; \
+ (i).epochs_before_eviction = (int)((e).epochs_before_eviction); \
+ (i).apply_empty_reserve = (e).apply_empty_reserve; \
+ (i).empty_reserve = (e).empty_reserve; \
+}
+
/* misc type definitions */
@@ -506,7 +604,7 @@ void insert_entry(H5F_t * file_ptr,
unsigned int flags);
void mark_entry_dirty(int32_t type,
- int32_t idx);
+ int32_t idx);
void move_entry(H5C_t * cache_ptr,
int32_t type,
@@ -660,5 +758,25 @@ void destroy_flush_dependency(int32_t parent_type,
int32_t child_type,
int32_t child_idx);
+/*** H5AC level utility functions ***/
+
+void check_and_validate_cache_hit_rate(hid_t file_id,
+ double * hit_rate_ptr,
+ hbool_t dump_data,
+ int64_t min_accesses,
+ double min_hit_rate);
+
+void check_and_validate_cache_size(hid_t file_id,
+ size_t * max_size_ptr,
+ size_t * min_clean_size_ptr,
+ size_t * cur_size_ptr,
+ int32_t * cur_num_entries_ptr,
+ hbool_t dump_data);
+
+void validate_mdc_config(hid_t file_id,
+ H5AC_cache_config_t * ext_config_ptr,
+ hbool_t compare_init,
+ int test_num);
+
#endif /* _CACHE_COMMON_H */