From dfb1f40cbbe847d25368861c6cc1e60cf6dcb17a Mon Sep 17 00:00:00 2001 From: John Mainzer Date: Fri, 27 Jan 2006 17:58:48 -0500 Subject: [svn-r11897] Purpose: 1) Add parallel test for metadata cache 2) Split serial test for metadata cache into two parts 3) Fix bug in which cache was flushed needlessly when the cache wasn't full. 4) Performance improvements 5) Update API for parallel cache coherency bug fix. Description: See above. Solution: See above. Platforms tested: h5committest Misc. update: --- src/H5AC.c | 289 +- src/H5ACprivate.h | 8 +- src/H5ACpublic.h | 47 +- src/H5C.c | 657 +- src/H5Cpkg.h | 12 +- src/H5Cprivate.h | 25 +- test/Makefile.am | 4 +- test/Makefile.in | 44 +- test/cache.c | 23274 ++++++++++++++++++-------------------------------- testpar/Makefile.am | 2 +- testpar/Makefile.in | 26 +- 11 files changed, 9410 insertions(+), 14978 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index 4b00b52..6e814a4 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -71,6 +71,19 @@ #define H5AC_DEBUG_DIRTY_BYTES_CREATION 0 +/*------------------------------------------------------------------------- + * It is a bit difficult to set ranges of allowable values on the + * dirty_bytes_threshold field of H5AC_aux_t. The following are + * probably broader than they should be. + *------------------------------------------------------------------------- + */ + +#define H5AC__MIN_DIRTY_BYTES_THRESHOLD (int32_t) \ + (H5C__MIN_MAX_CACHE_SIZE / 2) +#define H5AC__DEFAULT_DIRTY_BYTES_THRESHOLD (256 * 1024) +#define H5AC__MAX_DIRTY_BYTES_THRESHOLD (int32_t) \ + (H5C__MAX_MAX_CACHE_SIZE / 4) + /**************************************************************************** * * structure H5AC_aux_t @@ -392,7 +405,12 @@ static herr_t H5AC_check_if_write_permitted(const H5F_t *f, #ifdef H5_HAVE_PARALLEL static herr_t H5AC_broadcast_clean_list(H5AC_t * cache_ptr); +#endif /* JRM */ +static herr_t H5AC_ext_config_2_int_config(H5AC_cache_config_t * ext_conf_ptr, + H5C_auto_size_ctl_t * int_conf_ptr); + +#ifdef H5_HAVE_PARALLEL static herr_t H5AC_log_deleted_entry(H5AC_t * cache_ptr, H5AC_info_t * entry_ptr, haddr_t addr, @@ -707,6 +725,10 @@ H5AC_term_interface(void) * * JRM - 6/28/05 * + * Added code to set the prefix if required. + * + * JRM - 1/20/06 + * *------------------------------------------------------------------------- */ @@ -723,7 +745,8 @@ static const char * H5AC_entry_type_names[H5AC_NTYPES] = "block tracker nodes", "segmented heaps", "B+ tree headers", - "B+ tree leaves" + "B+ tree leaves", + "test entry" /* for testing only -- not used for actual files */ }; herr_t @@ -733,6 +756,7 @@ H5AC_create(const H5F_t *f, herr_t ret_value = SUCCEED; /* Return value */ herr_t result; #ifdef H5_HAVE_PARALLEL + char prefix[H5C__PREFIX_LEN] = ""; MPI_Comm mpi_comm = MPI_COMM_NULL; int mpi_rank = -1; int mpi_size = -1; @@ -789,7 +813,8 @@ H5AC_create(const H5F_t *f, aux_ptr->mpi_rank = mpi_rank; aux_ptr->mpi_size = mpi_size; aux_ptr->write_permitted = FALSE; - aux_ptr->dirty_bytes_threshold = 256 * 1024; + aux_ptr->dirty_bytes_threshold = + H5AC__DEFAULT_DIRTY_BYTES_THRESHOLD; aux_ptr->dirty_bytes = 0; #if H5AC_DEBUG_DIRTY_BYTES_CREATION aux_ptr->dirty_bytes_propagations = 0; @@ -804,6 +829,8 @@ H5AC_create(const H5F_t *f, aux_ptr->d_slist_len = 0; aux_ptr->c_slist_ptr = NULL; aux_ptr->c_slist_len = 0; + + sprintf(prefix, "%d:", mpi_rank); } if ( mpi_rank == 0 ) { @@ -856,6 +883,7 @@ H5AC_create(const H5F_t *f, #endif /* JRM */ (void *)aux_ptr); } + } else { f->shared->cache = H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, @@ -889,7 +917,19 @@ H5AC_create(const H5F_t *f, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + } +#ifdef H5_HAVE_PARALLEL + else if ( aux_ptr != NULL ) { + + result = H5C_set_prefix(f->shared->cache, prefix); + + if ( result != SUCCEED ) { + + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, \ + "H5C_set_prefix() failed") + } } +#endif /* H5_HAVE_PARALLEL */ result = H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr); @@ -1133,7 +1173,7 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id, unsigned flags) * flush first. */ if ( ( aux_ptr->mpi_rank == 0 ) && - ( (flags & H5AC__FLUSH_CLEAR_ONLY_FLAG) != 0 ) ) { + ( (flags & H5AC__FLUSH_CLEAR_ONLY_FLAG) == 0 ) ) { unsigned init_flush_flags = H5AC__NO_FLAGS_SET; @@ -2058,7 +2098,8 @@ H5AC_stats(const H5F_t *f) HDassert(f); HDassert(f->shared->cache); - (void)H5C_stats(f->shared->cache, f->name, FALSE); /* at present, this can't fail */ + /* at present, this can't fail */ + (void)H5C_stats(f->shared->cache, f->name, FALSE); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2081,6 +2122,10 @@ done: * JRM - 4/6/05 * Reworked for the addition of struct H5AC_cache_config_t. * + * JRM - 10/25/05 + * Added support for the new dirty_bytes_threshold field of + * both H5AC_cache_config_t and H5AC_aux_t. + * *------------------------------------------------------------------------- */ @@ -2094,9 +2139,22 @@ H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr, FUNC_ENTER_NOAPI(H5AC_get_cache_auto_resize_config, FAIL) - if ( ( cache_ptr == NULL ) || - ( config_ptr == NULL ) || - ( config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION ) ) + if ( ( cache_ptr == NULL ) + || +#ifdef H5_HAVE_PARALLEL + ( ( cache_ptr->aux_ptr != NULL ) + && + ( ((H5AC_aux_t *)(cache_ptr->aux_ptr))->magic + != + H5AC__H5AC_AUX_T_MAGIC + ) + ) + || +#endif /* H5_HAVE_PARALLEL */ + ( config_ptr == NULL ) + || + ( config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION ) + ) { HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "Bad cache_ptr or config_ptr on entry.") @@ -2142,6 +2200,21 @@ H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr, config_ptr->apply_empty_reserve = internal_config.apply_empty_reserve; config_ptr->empty_reserve = internal_config.empty_reserve; +#ifdef H5_HAVE_PARALLEL + if ( cache_ptr->aux_ptr != NULL ) { + + config_ptr->dirty_bytes_threshold = + ((H5AC_aux_t *)(cache_ptr->aux_ptr))->dirty_bytes_threshold; + + } else { +#endif /* H5_HAVE_PARALLEL */ + + config_ptr->dirty_bytes_threshold = H5AC__DEFAULT_DIRTY_BYTES_THRESHOLD; + +#ifdef H5_HAVE_PARALLEL + } +#endif /* H5_HAVE_PARALLEL */ + done: FUNC_LEAVE_NOAPI(ret_value) @@ -2294,6 +2367,10 @@ done: * John Mainzer -- 4/6/05 * Updated for the addition of H5AC_cache_config_t. * + * John Mainzer -- 1025/05 + * Added support for the new dirty_bytes_threshold field of + * both H5AC_cache_config_t and H5AC_aux_t. + * *------------------------------------------------------------------------- */ @@ -2307,9 +2384,21 @@ H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr, FUNC_ENTER_NOAPI(H5AC_set_cache_auto_resize_config, FAIL) - if ( cache_ptr == NULL ) { + if ( ( cache_ptr == NULL ) +#ifdef H5_HAVE_PARALLEL + || + ( ( cache_ptr->aux_ptr != NULL ) + && + ( + ((H5AC_aux_t *)(cache_ptr->aux_ptr))->magic + != + H5AC__H5AC_AUX_T_MAGIC + ) + ) +#endif /* H5_HAVE_PARALLEL */ + ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL cache_ptr on entry.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad cache_ptr on entry.") } if ( config_ptr == NULL ) { @@ -2329,40 +2418,30 @@ H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr, "config_ptr->rpt_fcn_enabled must be either TRUE or FALSE.") } - internal_config.version = H5C__CURR_AUTO_SIZE_CTL_VER; - - if ( config_ptr->rpt_fcn_enabled ) { + if ( + ( + config_ptr->dirty_bytes_threshold + < + H5AC__MIN_DIRTY_BYTES_THRESHOLD + ) + || + ( + config_ptr->dirty_bytes_threshold + > + H5AC__MAX_DIRTY_BYTES_THRESHOLD + ) + ) { - internal_config.rpt_fcn = H5C_def_auto_resize_rpt_fcn; + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "config_ptr->dirty_bytes_threshold out of range.") + } - } else { + if ( H5AC_ext_config_2_int_config(config_ptr, &internal_config) != + SUCCEED ) { - internal_config.rpt_fcn = NULL; - } - - internal_config.set_initial_size = config_ptr->set_initial_size; - internal_config.initial_size = config_ptr->initial_size; - internal_config.min_clean_fraction = config_ptr->min_clean_fraction; - internal_config.max_size = config_ptr->max_size; - internal_config.min_size = config_ptr->min_size; - internal_config.epoch_length = - (int64_t)(config_ptr->epoch_length); - - internal_config.incr_mode = config_ptr->incr_mode; - internal_config.lower_hr_threshold = config_ptr->lower_hr_threshold; - internal_config.increment = config_ptr->increment; - internal_config.apply_max_increment = config_ptr->apply_max_increment; - internal_config.max_increment = config_ptr->max_increment; - - internal_config.decr_mode = config_ptr->decr_mode; - internal_config.upper_hr_threshold = config_ptr->upper_hr_threshold; - internal_config.decrement = config_ptr->decrement; - internal_config.apply_max_decrement = config_ptr->apply_max_decrement; - internal_config.max_decrement = config_ptr->max_decrement; - internal_config.epochs_before_eviction = - (int32_t)(config_ptr->epochs_before_eviction); - internal_config.apply_empty_reserve = config_ptr->apply_empty_reserve; - internal_config.empty_reserve = config_ptr->empty_reserve; + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "H5AC_ext_config_2_int_config() failed.") + } result = H5C_set_cache_auto_resize_config((H5C_t *)cache_ptr, &internal_config); @@ -2372,6 +2451,14 @@ H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr, "H5C_set_cache_auto_resize_config() failed.") } +#ifdef H5_HAVE_PARALLEL + if ( cache_ptr->aux_ptr != NULL ) { + + ((H5AC_aux_t *)(cache_ptr->aux_ptr))->dirty_bytes_threshold = + config_ptr->dirty_bytes_threshold; + } +#endif /* H5_HAVE_PARALLEL */ + done: FUNC_LEAVE_NOAPI(ret_value) @@ -2433,40 +2520,23 @@ H5AC_validate_config(H5AC_cache_config_t * config_ptr) "config_ptr->rpt_fcn_enabled must be either TRUE or FALSE.") } - internal_config.version = H5C__CURR_AUTO_SIZE_CTL_VER; + if ( config_ptr->dirty_bytes_threshold < H5AC__MIN_DIRTY_BYTES_THRESHOLD ) { - if ( config_ptr->rpt_fcn_enabled ) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "dirty_bytes_threshold too small.") + } else + if ( config_ptr->dirty_bytes_threshold > H5AC__MAX_DIRTY_BYTES_THRESHOLD ) { - internal_config.rpt_fcn = H5C_def_auto_resize_rpt_fcn; + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "dirty_bytes_threshold too big.") + } - } else { + if ( H5AC_ext_config_2_int_config(config_ptr, &internal_config) != + SUCCEED ) { - internal_config.rpt_fcn = NULL; - } - - internal_config.set_initial_size = config_ptr->set_initial_size; - internal_config.initial_size = config_ptr->initial_size; - internal_config.min_clean_fraction = config_ptr->min_clean_fraction; - internal_config.max_size = config_ptr->max_size; - internal_config.min_size = config_ptr->min_size; - internal_config.epoch_length = - (int64_t)(config_ptr->epoch_length); - - internal_config.incr_mode = config_ptr->incr_mode; - internal_config.lower_hr_threshold = config_ptr->lower_hr_threshold; - internal_config.increment = config_ptr->increment; - internal_config.apply_max_increment = config_ptr->apply_max_increment; - internal_config.max_increment = config_ptr->max_increment; - - internal_config.decr_mode = config_ptr->decr_mode; - internal_config.upper_hr_threshold = config_ptr->upper_hr_threshold; - internal_config.decrement = config_ptr->decrement; - internal_config.apply_max_decrement = config_ptr->apply_max_decrement; - internal_config.max_decrement = config_ptr->max_decrement; - internal_config.epochs_before_eviction = - (int32_t)(config_ptr->epochs_before_eviction); - internal_config.apply_empty_reserve = config_ptr->apply_empty_reserve; - internal_config.empty_reserve = config_ptr->empty_reserve; + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "H5AC_ext_config_2_int_config() failed.") + } result = H5C_validate_resize_config(&internal_config, H5C_RESIZE_CFG__VALIDATE_ALL); @@ -2750,6 +2820,85 @@ done: /*------------------------------------------------------------------------- + * Function: H5AC_ext_config_2_int_config() + * + * Purpose: Utility function to translate an instance of + * H5AC_cache_config_t to an instance of H5C_auto_size_ctl_t. + * + * Places translation in *int_conf_ptr and returns SUCCEED + * if successful. Returns FAIL on failure. + * + * Does only minimal sanity checking. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * 1/26/06 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +herr_t +H5AC_ext_config_2_int_config(H5AC_cache_config_t * ext_conf_ptr, + H5C_auto_size_ctl_t * int_conf_ptr) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5AC_ext_config_2_int_config, FAIL) + + if ( ( ext_conf_ptr == NULL ) || + ( ext_conf_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION ) || + ( int_conf_ptr == NULL ) ) { + + } + + int_conf_ptr->version = H5C__CURR_AUTO_SIZE_CTL_VER; + + if ( ext_conf_ptr->rpt_fcn_enabled ) { + + int_conf_ptr->rpt_fcn = H5C_def_auto_resize_rpt_fcn; + + } else { + + int_conf_ptr->rpt_fcn = NULL; + } + + int_conf_ptr->set_initial_size = ext_conf_ptr->set_initial_size; + int_conf_ptr->initial_size = ext_conf_ptr->initial_size; + int_conf_ptr->min_clean_fraction = ext_conf_ptr->min_clean_fraction; + int_conf_ptr->max_size = ext_conf_ptr->max_size; + int_conf_ptr->min_size = ext_conf_ptr->min_size; + int_conf_ptr->epoch_length = + (int64_t)(ext_conf_ptr->epoch_length); + + int_conf_ptr->incr_mode = ext_conf_ptr->incr_mode; + int_conf_ptr->lower_hr_threshold = ext_conf_ptr->lower_hr_threshold; + int_conf_ptr->increment = ext_conf_ptr->increment; + int_conf_ptr->apply_max_increment = ext_conf_ptr->apply_max_increment; + int_conf_ptr->max_increment = ext_conf_ptr->max_increment; + + int_conf_ptr->decr_mode = ext_conf_ptr->decr_mode; + int_conf_ptr->upper_hr_threshold = ext_conf_ptr->upper_hr_threshold; + int_conf_ptr->decrement = ext_conf_ptr->decrement; + int_conf_ptr->apply_max_decrement = ext_conf_ptr->apply_max_decrement; + int_conf_ptr->max_decrement = ext_conf_ptr->max_decrement; + int_conf_ptr->epochs_before_eviction = + (int32_t)(ext_conf_ptr->epochs_before_eviction); + int_conf_ptr->apply_empty_reserve = ext_conf_ptr->apply_empty_reserve; + int_conf_ptr->empty_reserve = ext_conf_ptr->empty_reserve; + +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5AC_ext_config_2_int_config() */ + + +/*------------------------------------------------------------------------- * * Function: H5AC_log_deleted_entry() * diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 3cbe62e..f492556 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -51,7 +51,8 @@ #define H5AC_SHEAP_ID 9 /*segmented heap */ #define H5AC_BPT_HDR_ID 10 /*B+ tree header */ #define H5AC_BPT_LEAF_ID 11 /*B+ tree leaf */ -#define H5AC_NTYPES 12 +#define H5AC_TEST_ID 12 /*test entry -- not used for actual files */ +#define H5AC_NTYPES 13 /* H5AC_DUMP_STATS_ON_CLOSE should always be FALSE when * H5C_COLLECT_CACHE_STATS is FALSE. @@ -183,7 +184,7 @@ extern hid_t H5AC_ind_dxpl_id; /* hbool_t rpt_fcn_enabled = */ FALSE, \ /* hbool_t set_initial_size = */ TRUE, \ /* size_t initial_size = */ ( 1 * 1024 * 1024), \ - /* double min_clean_fraction = */ 0.25, \ + /* double min_clean_fraction = */ 0.5, \ /* size_t max_size = */ (16 * 1024 * 1024), \ /* size_t min_size = */ ( 1 * 1024 * 1024), \ /* long int epoch_length = */ 50000, \ @@ -199,7 +200,8 @@ extern hid_t H5AC_ind_dxpl_id; /* size_t max_decrement = */ (1 * 1024 * 1024), \ /* int epochs_before_eviction = */ 3, \ /* hbool_t apply_empty_reserve = */ TRUE, \ - /* double empty_reserve = */ 0.1 \ + /* double empty_reserve = */ 0.1, \ + /* int dirty_bytes_threshold = */ (256 * 1024) \ } diff --git a/src/H5ACpublic.h b/src/H5ACpublic.h index 2381ccc..5db8c5a 100644 --- a/src/H5ACpublic.h +++ b/src/H5ACpublic.h @@ -40,9 +40,18 @@ extern "C" { * structure H5AC_cache_config_t * * H5AC_cache_config_t is a public structure intended for use in public APIs. - * At least in its initial incarnation, it is a essentially a copy of - * struct H5C_auto_size_ctl_t, minus the report_fcn field. This is omitted, - * as including it would require us to make H5C_t structure public. + * At least in its initial incarnation, it is basicaly a copy of struct + * H5C_auto_size_ctl_t, minus the report_fcn field, and plus the + * dirty_bytes_threshold field. + * + * The report_fcn field is omitted, as including it would require us to + * make H5C_t structure public. + * + * The dirty_bytes_threshold field does not appear in H5C_auto_size_ctl_t, + * as synchronization between caches on different processes is handled at + * the H5AC level, not at the level of H5C. Note however that there is + * considerable interaction between this value and the other fields in this + * structure. * * The structure is in H5ACpublic.h as we may wish to allow different * configuration options for metadata and raw data caches. @@ -226,6 +235,34 @@ extern "C" { * The value of this field must be in the range [0.0, 1.0]. I would * expect typical values to be in the range of 0.01 to 0.1. * + * + * Parallel Configuration Fields: + * + * In PHDF5, all operations that modify metadata must be executed collectively. + * We used to think that this was enough to ensure consistency across the + * metadata caches, but since we allow processes to read metadata individually, + * the order of dirty entries in the LRU list can vary across processes, + * which can result in inconsistencies between the caches. + * + * To prevent this, only the metadata cache on process 0 is allowed to write + * to file, and then only after synchronizing with the other caches. After + * it writes entries to file, it sends the base addresses of the now clean + * entries to the other caches, so they can mark these entries clean as well. + * + * The different caches know when to synchronize caches by counting the + * number of bytes of dirty metadata created by the collective operations + * modifying metadata. Whenever this count exceeds a user specified + * threshold (see below), process 0 flushes down to its minimum clean size, + * and then sends the list of newly cleaned entries to the other caches. + * + * dirty_bytes_threshold: Threshold of dirty byte creation used to + * synchronize updates between caches. (See above for outline and + * motivation.) + * + * This value MUST be consistant across all processes accessing the + * file. This field is ignored unless HDF5 has been compiled for + * parallel. + * ****************************************************************************/ #define H5AC__CURR_CACHE_CONFIG_VERSION 1 @@ -274,6 +311,10 @@ typedef struct H5AC_cache_config_t hbool_t apply_empty_reserve; double empty_reserve; + + /* parallel configuration fields: */ + int dirty_bytes_threshold; + } H5AC_cache_config_t; diff --git a/src/H5C.c b/src/H5C.c index 8ac73e7..b934529 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -908,6 +908,38 @@ if ( ( (cache_ptr) == NULL ) || \ H5C__UPDATE_STATS_FOR_HT_SEARCH(cache_ptr, (entry_ptr != NULL), depth) \ } +#define H5C__SEARCH_INDEX_NO_STATS(cache_ptr, Addr, entry_ptr, fail_val) \ +{ \ + int k; \ + int depth = 0; \ + H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) \ + k = H5C__HASH_FCN(Addr); \ + entry_ptr = ((cache_ptr)->index)[k]; \ + while ( ( entry_ptr ) && ( H5F_addr_ne(Addr, (entry_ptr)->addr) ) ) \ + { \ + (entry_ptr) = (entry_ptr)->ht_next; \ + (depth)++; \ + } \ + if ( entry_ptr ) \ + { \ + H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k, fail_val) \ + if ( entry_ptr != ((cache_ptr)->index)[k] ) \ + { \ + if ( (entry_ptr)->ht_next ) \ + { \ + (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \ + } \ + HDassert( (entry_ptr)->ht_prev != NULL ); \ + (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \ + ((cache_ptr)->index)[k]->ht_prev = (entry_ptr); \ + (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \ + (entry_ptr)->ht_prev = NULL; \ + ((cache_ptr)->index)[k] = (entry_ptr); \ + H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) \ + } \ + } \ +} + #define H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \ { \ H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size) \ @@ -1088,6 +1120,117 @@ if ( ( (cache_ptr) == NULL ) || \ /*------------------------------------------------------------------------- * + * Macro: H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS + * + * Purpose: For efficiency, we sometimes change the order of flushes -- + * but doing so can confuse the replacement policy. This + * macro exists to allow us to specify an entry as the + * most recently touched so we can repair any such + * confusion. + * + * At present, we only support the modified LRU policy, so + * this function deals with that case unconditionally. If + * we ever support other replacement policies, the macro + * should switch on the current policy and act accordingly. + * + * Return: N/A + * + * Programmer: John Mainzer, 10/13/05 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS + +#define H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS(cache_ptr, entry_ptr, fail_val) \ +{ \ + HDassert( (cache_ptr) ); \ + HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ + HDassert( (entry_ptr) ); \ + HDassert( !((entry_ptr)->is_protected) ); \ + HDassert( (entry_ptr)->size > 0 ); \ + \ + /* modified LRU specific code */ \ + \ + /* remove the entry from the LRU list, and re-insert it at the head. */ \ + \ + H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ + (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \ + (cache_ptr)->LRU_list_size, (fail_val)) \ + \ + H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ + (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \ + (cache_ptr)->LRU_list_size, (fail_val)) \ + \ + /* Use the dirty flag to infer whether the entry is on the clean or \ + * dirty LRU list, and remove it. Then insert it at the head of the \ + * same LRU list. \ + * \ + * At least initially, all entries should be clean. That may change, \ + * so we may as well deal with both cases now. \ + */ \ + \ + if ( (entry_ptr)->is_dirty ) { \ + H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ + (cache_ptr)->dLRU_tail_ptr, \ + (cache_ptr)->dLRU_list_len, \ + (cache_ptr)->dLRU_list_size, (fail_val)) \ + \ + H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ + (cache_ptr)->dLRU_tail_ptr, \ + (cache_ptr)->dLRU_list_len, \ + (cache_ptr)->dLRU_list_size, (fail_val)) \ + } else { \ + H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ + (cache_ptr)->cLRU_tail_ptr, \ + (cache_ptr)->cLRU_list_len, \ + (cache_ptr)->cLRU_list_size, (fail_val)) \ + \ + H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ + (cache_ptr)->cLRU_tail_ptr, \ + (cache_ptr)->cLRU_list_len, \ + (cache_ptr)->cLRU_list_size, (fail_val)) \ + } \ + \ + /* End modified LRU specific code. */ \ + \ +} /* H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS */ + +#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + +#define H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS(cache_ptr, entry_ptr, fail_val) \ +{ \ + HDassert( (cache_ptr) ); \ + HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ + HDassert( (entry_ptr) ); \ + HDassert( !((entry_ptr)->is_protected) ); \ + HDassert( (entry_ptr)->size > 0 ); \ + \ + /* modified LRU specific code */ \ + \ + /* remove the entry from the LRU list, and re-insert it at the head. */ \ + \ + H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ + (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \ + (cache_ptr)->LRU_list_size, (fail_val)) \ + \ + H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ + (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \ + (cache_ptr)->LRU_list_size, (fail_val)) \ + \ + /* End modified LRU specific code. */ \ + \ +} /* H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS */ + +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + + +/*------------------------------------------------------------------------- + * * Macro: H5C__UPDATE_RP_FOR_EVICTION * * Purpose: Update the replacement policy data structures for an @@ -2030,6 +2173,9 @@ done: * JRM -- 9/21/05 * Added the new aux_ptr parameter and supporting code. * + * JRM -- 1/20/06 + * Added initialization of the new prefix field in H5C_t. + * *------------------------------------------------------------------------- */ @@ -2199,6 +2345,7 @@ H5C_create(size_t max_cache_size, cache_ptr->skip_file_checks = FALSE; cache_ptr->skip_dxpl_id_checks = FALSE; + cache_ptr->prefix[0] = '\0'; /* empty string */ /* Set return value */ ret_value = cache_ptr; @@ -2244,6 +2391,10 @@ done: * Reworked function to adapt it to the addition of the * ageout method of cache size reduction. * + * JRM -- 1/19/06 + * Updated function for display the new prefix field of + * H5C_t in output. + * *------------------------------------------------------------------------- */ void @@ -2263,25 +2414,27 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, switch ( status ) { case in_spec: - HDfprintf(stdout, "Auto cache resize -- no change. "); - HDfprintf(stdout, "(hit rate = %lf)\n", hit_rate); + HDfprintf(stdout, + "%sAuto cache resize -- no change. (hit rate = %lf)\n", + cache_ptr->prefix, hit_rate); break; case increase: HDassert( hit_rate < (cache_ptr->resize_ctl).lower_hr_threshold ); HDassert( old_max_cache_size < new_max_cache_size ); - HDfprintf(stdout, "Auto cache resize -- hit rate (%lf) ", hit_rate); - - HDfprintf(stdout, "out of bounds low (%6.5lf).\n", + HDfprintf(stdout, + "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n", + cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).lower_hr_threshold); HDfprintf(stdout, - " cache size increased from (%Zu/%Zu) to (%Zu/%Zu).\n", - old_max_cache_size, - old_min_clean_size, - new_max_cache_size, - new_min_clean_size); + "%s cache size increased from (%Zu/%Zu) to (%Zu/%Zu).\n", + cache_ptr->prefix, + old_max_cache_size, + old_min_clean_size, + new_max_cache_size, + new_min_clean_size); break; case decrease: @@ -2294,20 +2447,19 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, (cache_ptr->resize_ctl).upper_hr_threshold ); HDfprintf(stdout, - "Auto cache resize -- decrease by threshold. "); - - HDfprintf(stdout, "HR = %lf > %6.5lf\n", - hit_rate, + "%sAuto cache resize -- decrease by threshold. HR = %lf > %6.5lf\n", + cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).upper_hr_threshold); - HDfprintf(stdout, "out of bounds high (%6.5lf).\n", + HDfprintf(stdout, "%sout of bounds high (%6.5lf).\n", + cache_ptr->prefix, (cache_ptr->resize_ctl).upper_hr_threshold); break; case H5C_decr__age_out: HDfprintf(stdout, - "Auto cache resize -- decrease by ageout. "); - HDfprintf(stdout, "HR = %lf\n", hit_rate); + "%sAuto cache resize -- decrease by ageout. HR = %lf\n", + cache_ptr->prefix, hit_rate); break; case H5C_decr__age_out_with_threshold: @@ -2315,20 +2467,20 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, (cache_ptr->resize_ctl).upper_hr_threshold ); HDfprintf(stdout, - "Auto cache resize -- decrease by ageout with "); - HDfprintf(stdout, "threshold. HR = %lf > %6.5lf\n", - hit_rate, + "%sAuto cache resize -- decrease by ageout with threshold. HR = %lf > %6.5lf\n", + cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).upper_hr_threshold); break; default: HDfprintf(stdout, - "Auto cache resize -- decrease by unknown mode."); - HDfprintf(stdout, " HR = %lf\n", hit_rate); + "%sAuto cache resize -- decrease by unknown mode. HR = %lf\n", + cache_ptr->prefix, hit_rate); } HDfprintf(stdout, - " cache size decreased from (%Zu/%Zu) to (%Zu/%Zu).\n", + "%s cache size decreased from (%Zu/%Zu) to (%Zu/%Zu).\n", + cache_ptr->prefix, old_max_cache_size, old_min_clean_size, new_max_cache_size, @@ -2336,39 +2488,50 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, break; case at_max_size: - HDfprintf(stdout, "Auto cache resize -- hit rate (%lf) ", hit_rate); - HDfprintf(stdout, "out of bounds low (%6.5lf).\n", + HDfprintf(stdout, + "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n", + cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).lower_hr_threshold); - HDfprintf(stdout, " cache already at maximum size so no change.\n"); + HDfprintf(stdout, + "%s cache already at maximum size so no change.\n", + cache_ptr->prefix); break; case at_min_size: - HDfprintf(stdout, "Auto cache resize -- hit rate (%lf) ", hit_rate); - HDfprintf(stdout, "-- can't decrease.\n"); - HDfprintf(stdout, " cache already at minimum size.\n"); + HDfprintf(stdout, + "%sAuto cache resize -- hit rate (%lf) -- can't decrease.\n", + cache_ptr->prefix, hit_rate); + HDfprintf(stdout, "%s cache already at minimum size.\n", + cache_ptr->prefix); break; case increase_disabled: - HDfprintf(stdout, "Auto cache resize -- increase disabled -- "); - HDfprintf(stdout, "HR = %lf.", hit_rate); + HDfprintf(stdout, + "%sAuto cache resize -- increase disabled -- HR = %lf.", + cache_ptr->prefix, hit_rate); break; case decrease_disabled: - HDfprintf(stdout, "Auto cache resize -- decrease disabled -- "); - HDfprintf(stdout, "HR = %lf.\n", hit_rate); + HDfprintf(stdout, + "%sAuto cache resize -- decrease disabled -- HR = %lf.\n", + cache_ptr->prefix, hit_rate); break; case not_full: HDassert( hit_rate < (cache_ptr->resize_ctl).lower_hr_threshold ); - HDfprintf(stdout, "Auto cache resize -- hit rate (%lf) ", hit_rate); - HDfprintf(stdout, "out of bounds low (%6.5lf).\n", + HDfprintf(stdout, + "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n", + cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).lower_hr_threshold); - HDfprintf(stdout, " cache not full so no increase in size.\n"); + HDfprintf(stdout, + "%s cache not full so no increase in size.\n", + cache_ptr->prefix); break; default: - HDfprintf(stdout, "Auto cache resize -- unknown status code.\n"); + HDfprintf(stdout, "%sAuto cache resize -- unknown status code.\n", + cache_ptr->prefix); break; } @@ -2549,6 +2712,21 @@ done: * H5C__FLUSH_MARKED_ENTRIES_FLAG, it will only apply to * the marked entries. * + * JRM -- 10/15/05 + * Added code supporting the new + * H5C__FLUSH_IGNORE_PROTECTED_FLAG. We need this flag, as + * we now use this function to flush large number of entries + * in increasing address order. We do this by marking the + * entries to be flushed, calling this function to flush them, + * and then restoring LRU order. + * + * However, it is possible that the cache will contain other, + * unmarked entries, when we make this call. This new flag + * allows us to ignore this. + * + * Note that even with this flag set, it is still an error + * to try to flush a protected entry. + * *------------------------------------------------------------------------- */ herr_t @@ -2563,6 +2741,8 @@ H5C_flush_cache(H5F_t * f, hbool_t destroy; hbool_t flush_marked_entries; hbool_t first_flush = TRUE; + hbool_t ignore_protected; + hbool_t tried_to_flush_protected_entry = FALSE; int32_t protected_entries = 0; int32_t i; H5SL_node_t * node_ptr = NULL; @@ -2581,6 +2761,8 @@ H5C_flush_cache(H5F_t * f, HDassert( cache_ptr->skip_file_checks || f ); HDassert( cache_ptr->slist_ptr ); + ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 ); + destroy = ( (flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 ); /* note that flush_marked_entries is set to FALSE if destroy is TRUE */ @@ -2589,6 +2771,8 @@ H5C_flush_cache(H5F_t * f, ( ! destroy ) ); + HDassert( ! ( destroy && ignore_protected ) ); + if ( ( destroy ) && ( cache_ptr->epoch_markers_active > 0 ) ) { status = H5C__autoadjust__ageout__remove_all_markers(cache_ptr); @@ -2643,9 +2827,11 @@ H5C_flush_cache(H5F_t * f, if ( entry_ptr->is_protected ) { - /* we have major problems -- but lets flush everything - * we can before we flag an error. + /* we probably have major problems -- but lets flush + * everything we can before we decide whether to flag + * an error. */ + tried_to_flush_protected_entry = TRUE; protected_entries++; } else { @@ -2777,7 +2963,9 @@ H5C_flush_cache(H5F_t * f, HDassert( protected_entries <= cache_ptr->pl_len ); - if ( cache_ptr->pl_len > 0 ) { + if ( ( ( cache_ptr->pl_len > 0 ) && ( !ignore_protected ) ) + || + ( tried_to_flush_protected_entry ) ) { HGOTO_ERROR(H5E_CACHE, H5E_PROTECT, FAIL, "cache has protected items") } @@ -2813,8 +3001,26 @@ done: * * Modifications: * - * None. + * Re-wrote function to flush dirty entries in increasing + * address order, while maintaining LRU order in the LRU list + * upon return. + * + * Do this by scanning up the dirty LRU list for entries to + * flush to reach min clean size, setting their flush_marker + * flags, and recording their addresses in the order + * encountered. + * + * Then call H5C_flush_cache() to flush the marked entries. * + * Finally, use the list of marked entries to force the + * correct LRU list order after the flush. + * + * JRM - 10/13/05 + * + * This change had the oposite of the desired effect. Lets + * leave it in (albeit commented out for now). If we can't + * find a case where it helps, lets get rid of it. + * *------------------------------------------------------------------------- */ herr_t @@ -2823,10 +3029,18 @@ H5C_flush_to_min_clean(H5F_t * f, hid_t secondary_dxpl_id, H5C_t * cache_ptr) { - herr_t result; + herr_t result; herr_t ret_value = SUCCEED; hbool_t first_flush = TRUE; hbool_t write_permitted; +#if 0 /* modified code -- commented out for now */ + int i; + int flushed_entries_count = 0; + size_t flushed_entries_size = 0; + size_t space_needed = 0; + haddr_t * flushed_entries_list = NULL; + H5C_cache_entry_t * entry_ptr = NULL; +#endif /* JRM */ FUNC_ENTER_NOAPI(H5C_flush_to_min_clean, FAIL) @@ -2855,8 +3069,7 @@ H5C_flush_to_min_clean(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "cache write is not permitted!?!\n"); } - - +#if 1 /* original code */ result = H5C_make_space_in_cache(f, primary_dxpl_id, secondary_dxpl_id, @@ -2870,6 +3083,115 @@ H5C_flush_to_min_clean(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "H5C_make_space_in_cache failed.") } +#else /* modified code -- commented out for now */ + if ( cache_ptr->max_cache_size > cache_ptr->index_size ) { + + if ( ((cache_ptr->max_cache_size - cache_ptr->index_size) + + cache_ptr->cLRU_list_size) >= cache_ptr->min_clean_size ) { + + space_needed = 0; + + } else { + + space_needed = cache_ptr->min_clean_size - + ((cache_ptr->max_cache_size - cache_ptr->index_size) + + cache_ptr->cLRU_list_size); + } + } else { + + if ( cache_ptr->min_clean_size <= cache_ptr->cLRU_list_size ) { + + space_needed = 0; + + } else { + + space_needed = cache_ptr->min_clean_size - + cache_ptr->cLRU_list_size; + } + } + + if ( space_needed > 0 ) { /* we have work to do */ + + HDassert( cache_ptr->slist_len > 0 ); + + /* allocate an array to keep a list of the entries that we + * mark for flush. We need this list to touch up the LRU + * list after the flush. + */ + flushed_entries_list = (haddr_t *)H5MM_malloc(sizeof(haddr_t) * + (size_t)(cache_ptr->slist_len)); + + if ( flushed_entries_list == NULL ) { + + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, \ + "memory allocation failed for flushed entries list") + } + + /* Scan the dirty LRU list from tail forward and mark sufficient + * entries to free up the necessary space. Keep a list of the + * entries marked in the order in which they are encountered. + */ + entry_ptr = cache_ptr->dLRU_tail_ptr; + + while ( ( flushed_entries_size < space_needed ) && + ( flushed_entries_count < cache_ptr->slist_len ) && + ( entry_ptr != NULL ) ) + { + HDassert( ! (entry_ptr->is_protected) ); + HDassert( entry_ptr->is_dirty ); + HDassert( entry_ptr->in_slist ); + + entry_ptr->flush_marker = TRUE; + flushed_entries_size += entry_ptr->size; + flushed_entries_list[flushed_entries_count] = entry_ptr->addr; + flushed_entries_count++; + entry_ptr = entry_ptr->aux_prev; + } + + if ( ( flushed_entries_count > cache_ptr->slist_len) || + ( flushed_entries_size < space_needed ) ) { + HDfprintf(stdout, "flushed_entries_count = %d <= %d = slist_size\n", + (int)flushed_entries_count, (int)(cache_ptr->slist_size)); + HDfprintf(stdout, + "flushed_entries_size = %d < %d = space_needed.\n", + (int)flushed_entries_size, (int)space_needed); + } + + HDassert( flushed_entries_count <= cache_ptr->slist_len ); + HDassert( flushed_entries_size >= space_needed ); + + + /* Flush the marked entries */ + result = H5C_flush_cache(f, primary_dxpl_id, secondary_dxpl_id, + cache_ptr, H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_IGNORE_PROTECTED_FLAG); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_flush_cache failed.") + } + + /* Now touch up the LRU list so as to place the flushed entries in + * the order they they would be in if we had flushed them in the + * order we encountered them in. + */ + + i = 0; + while ( i < flushed_entries_count ) + { + H5C__SEARCH_INDEX_NO_STATS(cache_ptr, flushed_entries_list[i], \ + entry_ptr, FAIL) + + /* At present, the above search must always succeed. However, + * that may change. Write the code so we need only remove the + * following assert in that event. + */ + HDassert( entry_ptr != NULL ); + H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS(cache_ptr, entry_ptr, FAIL) + i++; + } + } /* if ( space_needed > 0 ) */ +#endif /* end modified code -- commented out for now */ done: @@ -3445,6 +3767,15 @@ done: * * Modifications: * + * Reworked function to flush entries in LRU order instead + * of increasing address order. The hope is that this will + * improve the hit rate on the slave caches. + * + * JRM - 10/13/05 + * + * Leave the old code in place for now (commented out) for + * benchmarking. + * *------------------------------------------------------------------------- */ @@ -3459,11 +3790,15 @@ H5C_mark_entries_as_clean(H5F_t * f, { herr_t ret_value = SUCCEED; /* Return value */ hbool_t first_flush = TRUE; + int entries_cleared; + int entries_examined; int i; + int initial_list_len; haddr_t addr; #if H5C_DO_SANITY_CHECKS haddr_t last_addr; #endif /* H5C_DO_SANITY_CHECKS */ + H5C_cache_entry_t * clear_ptr = NULL; H5C_cache_entry_t * entry_ptr = NULL; FUNC_ENTER_NOAPI(H5C_mark_entries_as_clean, FAIL) @@ -3540,7 +3875,7 @@ H5C_mark_entries_as_clean(H5F_t * f, #endif /* H5C_DO_SANITY_CHECKS */ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "Listed entry not dirty?!?!?.") - +#if 0 /* original code */ } else if ( entry_ptr->is_protected ) { entry_ptr->clear_on_unprotect = TRUE; @@ -3560,7 +3895,75 @@ H5C_mark_entries_as_clean(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") } } +#else /* modified code -- commented out for now */ + } else { + /* Mark the entry to be cleared on unprotect. We will + * scan the LRU list shortly, and clear all those entries + * not currently protected. + */ + entry_ptr->clear_on_unprotect = TRUE; + } +#endif /* end modified code */ + } +#if 1 /* modified code -- commented out for now */ + /* Scan through the LRU list from back to front, and flush the + * entries whose clear_on_unprotect flags are set. Observe that + * any protected entries will not be on the LRU, and therefore + * will not be flushed at this time. + */ + + entries_cleared = 0; + entries_examined = 0; + initial_list_len = cache_ptr->LRU_list_len; + entry_ptr = cache_ptr->LRU_tail_ptr; + + while ( ( entry_ptr != NULL ) && + ( entries_examined <= initial_list_len ) && + ( entries_cleared < ce_array_len ) ) + { + if ( entry_ptr->clear_on_unprotect ) { + + entry_ptr->clear_on_unprotect = FALSE; + clear_ptr = entry_ptr; + entry_ptr = entry_ptr->prev; + entries_cleared++; + + if ( H5C_flush_single_entry(f, + primary_dxpl_id, + secondary_dxpl_id, + cache_ptr, + clear_ptr->type, + clear_ptr->addr, + H5C__FLUSH_CLEAR_ONLY_FLAG, + &first_flush, + TRUE) < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") + } + } else { + + entry_ptr = entry_ptr->prev; + } + entries_examined++; + } + + HDassert( ( entries_cleared == ce_array_len ) || + ( (ce_array_len - entries_cleared) <= cache_ptr->pl_len ) ); + +#if H5C_DO_SANITY_CHECKS + i = 0; + entry_ptr = cache_ptr->pl_head_ptr; + while ( entry_ptr != NULL ) + { + if ( entry_ptr->clear_on_unprotect ) { + + i++; + } + entry_ptr = entry_ptr->next; } + HDassert( (entries_cleared + i) == ce_array_len ); +#endif /* H5C_DO_SANITY_CHECKS */ +#endif /* modified code -- commented out for now */ done: @@ -3772,6 +4175,9 @@ done: * JRM -- 6/24/05 * Added support for the new write_permitted field of H5C_t. * + * JRM -- 10/22/05 + * Hand optimizations. + * *------------------------------------------------------------------------- */ @@ -3785,14 +4191,14 @@ H5C_protect(H5F_t * f, const void * udata1, void * udata2) { - hbool_t hit = FALSE; - hbool_t first_flush = TRUE; + hbool_t hit; + hbool_t first_flush; hbool_t have_write_permitted = FALSE; - hbool_t write_permitted = TRUE; + hbool_t write_permitted; herr_t result; - void * thing = NULL; + void * thing; H5C_cache_entry_t * entry_ptr; - void * ret_value = NULL; /* Return value */ + void * ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5C_protect, NULL) @@ -3858,12 +4264,16 @@ H5C_protect(H5F_t * f, } else { have_write_permitted = TRUE; + + first_flush = TRUE; } } else { write_permitted = cache_ptr->write_permitted; have_write_permitted = TRUE; + + first_flush = TRUE; } HDassert( entry_ptr->size <= H5C_MAX_ENTRY_SIZE ); @@ -3966,12 +4376,16 @@ H5C_protect(H5F_t * f, } else { have_write_permitted = TRUE; + + first_flush = TRUE; } } else { write_permitted = cache_ptr->write_permitted; have_write_permitted = TRUE; + + first_flush = TRUE; } } @@ -4327,6 +4741,49 @@ done: /*------------------------------------------------------------------------- + * Function: H5C_set_prefix + * + * Purpose: Set the values of the prefix field of H5C_t. This + * filed is used to label some debugging output. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * 1/20/06 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5C_set_prefix(H5C_t * cache_ptr, + char * prefix) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5C_set_prefix, FAIL) + + /* This would normally be an assert, but we need to use an HGOTO_ERROR + * call to shut up the compiler. + */ + if ( ( ! cache_ptr ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr") + } + + HDassert( prefix ); + HDassert( HDstrlen(prefix) < H5C__PREFIX_LEN ) ; + + HDstrcpy(&(cache_ptr->prefix[0]), prefix); + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5C_set_prefix() */ + + +/*------------------------------------------------------------------------- * Function: H5C_set_skip_flags * * Purpose: Set the values of the skip sanity check flags. @@ -4390,6 +4847,10 @@ done: * Updated function for the addition of cache entry size * change statistics. * + * JRM -- 1/13/06 + * Added code to use the prefix field of H5C_t to allow + * tagging of statistics output. + * *------------------------------------------------------------------------- */ @@ -4489,93 +4950,109 @@ H5C_stats(H5C_t * cache_ptr, } - HDfprintf(stdout, "\nH5C: cache statistics for %s\n", - cache_name); + HDfprintf(stdout, "\n%sH5C: cache statistics for %s\n", + cache_ptr->prefix, cache_name); HDfprintf(stdout, "\n"); HDfprintf(stdout, - " hash table insertion / deletions = %ld / %ld\n", + "%s hash table insertion / deletions = %ld / %ld\n", + cache_ptr->prefix, (long)(cache_ptr->total_ht_insertions), (long)(cache_ptr->total_ht_deletions)); HDfprintf(stdout, - " HT successful / failed searches = %ld / %ld\n", + "%s HT successful / failed searches = %ld / %ld\n", + cache_ptr->prefix, (long)(cache_ptr->successful_ht_searches), (long)(cache_ptr->failed_ht_searches)); HDfprintf(stdout, - " Av. HT suc / failed search depth = %f / %f\n", + "%s Av. HT suc / failed search depth = %f / %f\n", + cache_ptr->prefix, average_successful_search_depth, average_failed_search_depth); HDfprintf(stdout, - " current (max) index size / length = %ld (%ld) / %ld (%ld)\n", + "%s current (max) index size / length = %ld (%ld) / %ld (%ld)\n", + cache_ptr->prefix, (long)(cache_ptr->index_size), (long)(cache_ptr->max_index_size), (long)(cache_ptr->index_len), (long)(cache_ptr->max_index_len)); HDfprintf(stdout, - " current (max) slist size / length = %ld (%ld) / %ld (%ld)\n", + "%s current (max) slist size / length = %ld (%ld) / %ld (%ld)\n", + cache_ptr->prefix, (long)(cache_ptr->slist_size), (long)(cache_ptr->max_slist_size), (long)(cache_ptr->slist_len), (long)(cache_ptr->max_slist_len)); HDfprintf(stdout, - " current (max) PL size / length = %ld (%ld) / %ld (%ld)\n", + "%s current (max) PL size / length = %ld (%ld) / %ld (%ld)\n", + cache_ptr->prefix, (long)(cache_ptr->pl_size), (long)(cache_ptr->max_pl_size), (long)(cache_ptr->pl_len), (long)(cache_ptr->max_pl_len)); HDfprintf(stdout, - " current LRU list size / length = %ld / %ld\n", + "%s current LRU list size / length = %ld / %ld\n", + cache_ptr->prefix, (long)(cache_ptr->LRU_list_size), (long)(cache_ptr->LRU_list_len)); HDfprintf(stdout, - " current clean LRU size / length = %ld / %ld\n", + "%s current clean LRU size / length = %ld / %ld\n", + cache_ptr->prefix, (long)(cache_ptr->cLRU_list_size), (long)(cache_ptr->cLRU_list_len)); HDfprintf(stdout, - " current dirty LRU size / length = %ld / %ld\n", + "%s current dirty LRU size / length = %ld / %ld\n", + cache_ptr->prefix, (long)(cache_ptr->dLRU_list_size), (long)(cache_ptr->dLRU_list_len)); HDfprintf(stdout, - " Total hits / misses / hit_rate = %ld / %ld / %f\n", + "%s Total hits / misses / hit_rate = %ld / %ld / %f\n", + cache_ptr->prefix, (long)total_hits, (long)total_misses, hit_rate); HDfprintf(stdout, - " Total clears / flushes / evictions = %ld / %ld / %ld\n", + "%s Total clears / flushes / evictions = %ld / %ld / %ld\n", + cache_ptr->prefix, (long)total_clears, (long)total_flushes, (long)total_evictions); - HDfprintf(stdout, " Total insertions / renames = %ld / %ld\n", + HDfprintf(stdout, "%s Total insertions / renames = %ld / %ld\n", + cache_ptr->prefix, (long)total_insertions, (long)total_renames); - HDfprintf(stdout, " Total entry size incrs / decrs = %ld / %ld\n", + HDfprintf(stdout, "%s Total entry size incrs / decrs = %ld / %ld\n", + cache_ptr->prefix, (long)total_size_increases, (long)total_size_decreases); #if H5C_COLLECT_CACHE_ENTRY_STATS - HDfprintf(stdout, " aggregate max / min accesses = %d / %d\n", + HDfprintf(stdout, "%s aggregate max / min accesses = %d / %d\n", + cache_ptr->prefix, (int)aggregate_max_accesses, (int)aggregate_min_accesses); - HDfprintf(stdout, " aggregate max_clears / max_flushes = %d / %d\n", + HDfprintf(stdout, "%s aggregate max_clears / max_flushes = %d / %d\n", + cache_ptr->prefix, (int)aggregate_max_clears, (int)aggregate_max_flushes); - HDfprintf(stdout, " aggregate max_size = %d\n", + HDfprintf(stdout, "%s aggregate max_size = %d\n", + cache_ptr->prefix, (int)aggregate_max_size); @@ -4588,7 +5065,8 @@ H5C_stats(H5C_t * cache_ptr, HDfprintf(stdout, "\n"); - HDfprintf(stdout, " Stats on %s:\n", + HDfprintf(stdout, "%s Stats on %s:\n", + cache_ptr->prefix, ((cache_ptr->type_name_table_ptr))[i]); if ( ( cache_ptr->hits[i] > 0 ) || ( cache_ptr->misses[i] > 0 ) ) { @@ -4600,41 +5078,48 @@ H5C_stats(H5C_t * cache_ptr, } HDfprintf(stdout, - " hits / misses / hit_rate = %ld / %ld / %f\n", + "%s hits / misses / hit_rate = %ld / %ld / %f\n", + cache_ptr->prefix, (long)(cache_ptr->hits[i]), (long)(cache_ptr->misses[i]), hit_rate); HDfprintf(stdout, - " clears / flushes / evictions = %ld / %ld / %ld\n", + "%s clears / flushes / evictions = %ld / %ld / %ld\n", + cache_ptr->prefix, (long)(cache_ptr->clears[i]), (long)(cache_ptr->flushes[i]), (long)(cache_ptr->evictions[i])); HDfprintf(stdout, - " insertions / renames = %ld / %ld\n", + "%s insertions / renames = %ld / %ld\n", + cache_ptr->prefix, (long)(cache_ptr->insertions[i]), (long)(cache_ptr->renames[i])); HDfprintf(stdout, - " size increases / decreases = %ld / %ld\n", + "%s size increases / decreases = %ld / %ld\n", + cache_ptr->prefix, (long)(cache_ptr->size_increases[i]), (long)(cache_ptr->size_decreases[i])); #if H5C_COLLECT_CACHE_ENTRY_STATS HDfprintf(stdout, - " entry max / min accesses = %d / %d\n", + "%s entry max / min accesses = %d / %d\n", + cache_ptr->prefix, cache_ptr->max_accesses[i], cache_ptr->min_accesses[i]); HDfprintf(stdout, - " entry max_clears / max_flushes = %d / %d\n", + "%s entry max_clears / max_flushes = %d / %d\n", + cache_ptr->prefix, cache_ptr->max_clears[i], cache_ptr->max_flushes[i]); HDfprintf(stdout, - " entry max_size = %d\n", + "%s entry max_size = %d\n", + cache_ptr->prefix, (int)(cache_ptr->max_size[i])); @@ -6903,6 +7388,11 @@ done: * JRM -- 12/13/04 * Added code to skip over epoch markers if present. * + * JRM -- 1/3/06 + * Modified function to work correctly when the the cache + * is not full. This case occurs when we need to flush to + * min clean size before the cache has filled. + * *------------------------------------------------------------------------- */ @@ -6919,6 +7409,9 @@ H5C_make_space_in_cache(H5F_t * f, herr_t result; int32_t entries_examined = 0; int32_t initial_list_len; +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS + size_t empty_space; +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ H5C_cache_entry_t * entry_ptr; H5C_cache_entry_t * prev_ptr; @@ -6995,7 +7488,17 @@ H5C_make_space_in_cache(H5F_t * f, initial_list_len = cache_ptr->dLRU_list_len; entry_ptr = cache_ptr->dLRU_tail_ptr; - while ( ( cache_ptr->cLRU_list_size < cache_ptr->min_clean_size ) && + if ( cache_ptr->index_size < cache_ptr->max_cache_size ) { + + empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; + + } else { + + empty_space = 0; + } + + while ( ( (cache_ptr->cLRU_list_size + empty_space) + < cache_ptr->min_clean_size ) && ( entries_examined <= initial_list_len ) && ( entry_ptr != NULL ) ) diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 007f30f..eb8db3a 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -187,7 +187,8 @@ * on how frequently the cache is flushed. We will see how it goes. * * For now at least, I will not remove dirty entries from the list as they - * are flushed. + * are flushed. (this has been changed -- dirty entries are now removed from + * the skip list as they are flushed. JRM - 10/25/05) * * slist_len: Number of entries currently in the skip list * used to maintain a sorted list of dirty entries in the @@ -601,10 +602,15 @@ * When this flag is set, all sanity checks on the dxpl_id * parameters are skipped. The field defaults to FALSE. * + * prefix Array of char used to prefix debugging output. The + * field is intended to allow marking of output of with + * the processes mpi rank. + * ****************************************************************************/ #define H5C__H5C_T_MAGIC 0x005CAC0E -#define H5C__MAX_NUM_TYPE_IDS 12 +#define H5C__MAX_NUM_TYPE_IDS 13 +#define H5C__PREFIX_LEN 32 struct H5C_t { @@ -715,7 +721,7 @@ struct H5C_t hbool_t skip_file_checks; hbool_t skip_dxpl_id_checks; - + char prefix[H5C__PREFIX_LEN]; }; #endif /* _H5Cpkg_H */ diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 57d74af..c7d0313 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -699,20 +699,25 @@ typedef struct H5C_auto_size_ctl_t */ /* Generic "no flags set" value for all function calls */ -#define H5C__NO_FLAGS_SET 0x0000 +#define H5C__NO_FLAGS_SET 0x0000 /* These flags apply to H5C_insert_entry() & H5C_unprotect() */ -#define H5C__SET_FLUSH_MARKER_FLAG 0x0001 -#define H5C__DELETED_FLAG 0x0002 +#define H5C__SET_FLUSH_MARKER_FLAG 0x0001 +#define H5C__DELETED_FLAG 0x0002 /* These flags applies only to H5C_unprotect() */ -#define H5C__DIRTIED_FLAG 0x0004 -#define H5C__SIZE_CHANGED_FLAG 0x0008 +#define H5C__DIRTIED_FLAG 0x0004 +#define H5C__SIZE_CHANGED_FLAG 0x0008 -/* These flags apply to H5C_flush() & H5C_flush_single_entry() */ -#define H5C__FLUSH_INVALIDATE_FLAG 0x0010 -#define H5C__FLUSH_CLEAR_ONLY_FLAG 0x0020 -#define H5C__FLUSH_MARKED_ENTRIES_FLAG 0x0040 +/* These flags apply to H5C_flush_cache() & H5C_flush_single_entry() */ +#define H5C__FLUSH_INVALIDATE_FLAG 0x0010 +#define H5C__FLUSH_CLEAR_ONLY_FLAG 0x0020 +#define H5C__FLUSH_MARKED_ENTRIES_FLAG 0x0040 + +/* This flag applies to H5C_flush_cache() only. It is an error to use + * it in combination with the H5C__FLUSH_INVALIDATE_FLAG + */ +#define H5C__FLUSH_IGNORE_PROTECTED_FLAG 0x0080 H5_DLL H5C_t * H5C_create(size_t max_cache_size, @@ -805,6 +810,8 @@ H5_DLL herr_t H5C_reset_cache_hit_rate_stats(H5C_t * cache_ptr); H5_DLL herr_t H5C_set_cache_auto_resize_config(H5C_t * cache_ptr, H5C_auto_size_ctl_t *config_ptr); +H5_DLL herr_t H5C_set_prefix(H5C_t * cache_ptr, char * prefix); + H5_DLL herr_t H5C_set_skip_flags(H5C_t * cache_ptr, hbool_t skip_file_checks, hbool_t skip_dxpl_id_checks); diff --git a/test/Makefile.am b/test/Makefile.am index 29f06a0..0b1f7f2 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -32,7 +32,7 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) # executed, generally most specific tests to least specific tests. # As an exception, long-running tests should occur earlier in the list. # This gives them more time to run when tests are executing in parallel. -TEST_PROG=testhdf5 lheap ohdr stab gheap btree2 cache b+tree blocktrack sheap \ +TEST_PROG=testhdf5 lheap ohdr stab gheap btree2 cache cache_api b+tree blocktrack sheap \ pool hyperslab istore bittests dt_arith \ dtypes dsets cmpd_dset extend external objcopy links unlink big mtime \ fillval mount flush1 flush2 enum \ @@ -66,7 +66,7 @@ noinst_PROGRAMS=$(BUILD_ALL_PROGS) # The libh5test library provides common support code for the tests. noinst_LTLIBRARIES=libh5test.la -libh5test_la_SOURCES=h5test.c testframe.c +libh5test_la_SOURCES=h5test.c testframe.c cache_common.c # Use libhd5test.la to compile all of the tests LDADD=libh5test.la $(LIBHDF5) diff --git a/test/Makefile.in b/test/Makefile.in index b89a04a..f8dac31 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -31,7 +31,7 @@ # -SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c blocktrack.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c fillval.c flush1.c flush2.c gen_deflate.c gen_filters.c gen_new_array.c gen_new_fill.c gen_new_group.c gen_new_mtime.c gen_new_super.c gen_noencoder.c gen_nullspace.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c reserved.c set_extent.c sheap.c space_overflow.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c +SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c blocktrack.c btree2.c cache.c cache_api.c cmpd_dset.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c fillval.c flush1.c flush2.c gen_deflate.c gen_filters.c gen_new_array.c gen_new_fill.c gen_new_group.c gen_new_mtime.c gen_new_super.c gen_noencoder.c gen_nullspace.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c reserved.c set_extent.c sheap.c space_overflow.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -71,19 +71,20 @@ CONFIG_HEADER = $(top_builddir)/src/H5config.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libh5test_la_LIBADD = -am_libh5test_la_OBJECTS = h5test.lo testframe.lo +am_libh5test_la_OBJECTS = h5test.lo testframe.lo cache_common.lo libh5test_la_OBJECTS = $(am_libh5test_la_OBJECTS) am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \ stab$(EXEEXT) gheap$(EXEEXT) btree2$(EXEEXT) cache$(EXEEXT) \ - b+tree$(EXEEXT) blocktrack$(EXEEXT) sheap$(EXEEXT) \ - pool$(EXEEXT) hyperslab$(EXEEXT) istore$(EXEEXT) \ - bittests$(EXEEXT) dt_arith$(EXEEXT) dtypes$(EXEEXT) \ - dsets$(EXEEXT) cmpd_dset$(EXEEXT) extend$(EXEEXT) \ - external$(EXEEXT) objcopy$(EXEEXT) links$(EXEEXT) \ - unlink$(EXEEXT) big$(EXEEXT) mtime$(EXEEXT) fillval$(EXEEXT) \ - mount$(EXEEXT) flush1$(EXEEXT) flush2$(EXEEXT) enum$(EXEEXT) \ - set_extent$(EXEEXT) ttsafe$(EXEEXT) stream_test$(EXEEXT) \ - getname$(EXEEXT) vfd$(EXEEXT) ntypes$(EXEEXT) dangle$(EXEEXT) \ + cache_api$(EXEEXT) b+tree$(EXEEXT) blocktrack$(EXEEXT) \ + sheap$(EXEEXT) pool$(EXEEXT) hyperslab$(EXEEXT) \ + istore$(EXEEXT) bittests$(EXEEXT) dt_arith$(EXEEXT) \ + dtypes$(EXEEXT) dsets$(EXEEXT) cmpd_dset$(EXEEXT) \ + extend$(EXEEXT) external$(EXEEXT) objcopy$(EXEEXT) \ + links$(EXEEXT) unlink$(EXEEXT) big$(EXEEXT) mtime$(EXEEXT) \ + fillval$(EXEEXT) mount$(EXEEXT) flush1$(EXEEXT) \ + flush2$(EXEEXT) enum$(EXEEXT) set_extent$(EXEEXT) \ + ttsafe$(EXEEXT) stream_test$(EXEEXT) getname$(EXEEXT) \ + vfd$(EXEEXT) ntypes$(EXEEXT) dangle$(EXEEXT) \ dtransform$(EXEEXT) reserved$(EXEEXT) @BUILD_ALL_CONDITIONAL_TRUE@am__EXEEXT_2 = gen_deflate$(EXEEXT) \ @BUILD_ALL_CONDITIONAL_TRUE@ gen_filters$(EXEEXT) \ @@ -121,6 +122,10 @@ cache_SOURCES = cache.c cache_OBJECTS = cache.$(OBJEXT) cache_LDADD = $(LDADD) cache_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1) +cache_api_SOURCES = cache_api.c +cache_api_OBJECTS = cache_api.$(OBJEXT) +cache_api_LDADD = $(LDADD) +cache_api_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1) cmpd_dset_SOURCES = cmpd_dset.c cmpd_dset_OBJECTS = cmpd_dset.$(OBJEXT) cmpd_dset_LDADD = $(LDADD) @@ -326,8 +331,8 @@ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c \ - blocktrack.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c \ - dt_arith.c dtransform.c dtypes.c enum.c err_compat.c \ + blocktrack.c btree2.c cache.c cache_api.c cmpd_dset.c dangle.c \ + dsets.c dt_arith.c dtransform.c dtypes.c enum.c err_compat.c \ error_test.c extend.c external.c fillval.c flush1.c flush2.c \ gen_deflate.c gen_filters.c gen_new_array.c gen_new_fill.c \ gen_new_group.c gen_new_mtime.c gen_new_super.c \ @@ -337,8 +342,8 @@ SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c \ stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c \ $(ttsafe_SOURCES) unlink.c vfd.c DIST_SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c \ - blocktrack.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c \ - dt_arith.c dtransform.c dtypes.c enum.c err_compat.c \ + blocktrack.c btree2.c cache.c cache_api.c cmpd_dset.c dangle.c \ + dsets.c dt_arith.c dtransform.c dtypes.c enum.c err_compat.c \ error_test.c extend.c external.c fillval.c flush1.c flush2.c \ gen_deflate.c gen_filters.c gen_new_array.c gen_new_fill.c \ gen_new_group.c gen_new_mtime.c gen_new_super.c \ @@ -621,7 +626,7 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) # executed, generally most specific tests to least specific tests. # As an exception, long-running tests should occur earlier in the list. # This gives them more time to run when tests are executing in parallel. -TEST_PROG = testhdf5 lheap ohdr stab gheap btree2 cache b+tree blocktrack sheap \ +TEST_PROG = testhdf5 lheap ohdr stab gheap btree2 cache cache_api b+tree blocktrack sheap \ pool hyperslab istore bittests dt_arith \ dtypes dsets cmpd_dset extend external objcopy links unlink big mtime \ fillval mount flush1 flush2 enum \ @@ -644,7 +649,7 @@ TEST_PROG = testhdf5 lheap ohdr stab gheap btree2 cache b+tree blocktrack sheap # The libh5test library provides common support code for the tests. noinst_LTLIBRARIES = libh5test.la -libh5test_la_SOURCES = h5test.c testframe.c +libh5test_la_SOURCES = h5test.c testframe.c cache_common.c # Use libhd5test.la to compile all of the tests LDADD = libh5test.la $(LIBHDF5) @@ -752,6 +757,9 @@ btree2$(EXEEXT): $(btree2_OBJECTS) $(btree2_DEPENDENCIES) cache$(EXEEXT): $(cache_OBJECTS) $(cache_DEPENDENCIES) @rm -f cache$(EXEEXT) $(LINK) $(cache_LDFLAGS) $(cache_OBJECTS) $(cache_LDADD) $(LIBS) +cache_api$(EXEEXT): $(cache_api_OBJECTS) $(cache_api_DEPENDENCIES) + @rm -f cache_api$(EXEEXT) + $(LINK) $(cache_api_LDFLAGS) $(cache_api_OBJECTS) $(cache_api_LDADD) $(LIBS) cmpd_dset$(EXEEXT): $(cmpd_dset_OBJECTS) $(cmpd_dset_DEPENDENCIES) @rm -f cmpd_dset$(EXEEXT) $(LINK) $(cmpd_dset_LDFLAGS) $(cmpd_dset_OBJECTS) $(cmpd_dset_LDADD) $(LIBS) @@ -903,6 +911,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blocktrack.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/btree2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache_api.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache_common.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmpd_dset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dangle.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dsets.Po@am__quote@ diff --git a/test/cache.c b/test/cache.c index fbe93a5..58b2af5 100644 --- a/test/cache.c +++ b/test/cache.c @@ -21,623 +21,10 @@ #include "h5test.h" #include "H5Iprivate.h" #include "H5ACprivate.h" +#include "cache_common.h" -const char *FILENAME[] = { - "cache", - NULL -}; - -#define H5C_PACKAGE /*suppress error about including H5Cpkg */ - -#include "H5Cpkg.h" - -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ - -#include "H5Fpkg.h" - -/* with apologies for the abuse of terminology... */ - -#define PICO_ENTRY_TYPE 0 -#define NANO_ENTRY_TYPE 1 -#define MICRO_ENTRY_TYPE 2 -#define TINY_ENTRY_TYPE 3 -#define SMALL_ENTRY_TYPE 4 -#define MEDIUM_ENTRY_TYPE 5 -#define LARGE_ENTRY_TYPE 6 -#define HUGE_ENTRY_TYPE 7 -#define MONSTER_ENTRY_TYPE 8 - -#define NUMBER_OF_ENTRY_TYPES 9 - -#define PICO_ENTRY_SIZE (size_t)1 -#define NANO_ENTRY_SIZE (size_t)4 -#define MICRO_ENTRY_SIZE (size_t)16 -#define TINY_ENTRY_SIZE (size_t)64 -#define SMALL_ENTRY_SIZE (size_t)256 -#define MEDIUM_ENTRY_SIZE (size_t)1024 -#define LARGE_ENTRY_SIZE (size_t)(4 * 1024) -#define HUGE_ENTRY_SIZE (size_t)(16 * 1024) -#define MONSTER_ENTRY_SIZE (size_t)(64 * 1024) - -#define NUM_PICO_ENTRIES (10 * 1024) -#define NUM_NANO_ENTRIES (10 * 1024) -#define NUM_MICRO_ENTRIES (10 * 1024) -#define NUM_TINY_ENTRIES (10 * 1024) -#define NUM_SMALL_ENTRIES (10 * 1024) -#define NUM_MEDIUM_ENTRIES (10 * 1024) -#define NUM_LARGE_ENTRIES (10 * 1024) -#define NUM_HUGE_ENTRIES (10 * 1024) -#define NUM_MONSTER_ENTRIES (10 * 1024) - -#define MAX_ENTRIES (10 * 1024) - -#define PICO_BASE_ADDR (haddr_t)0 -#define NANO_BASE_ADDR (haddr_t)(PICO_BASE_ADDR + \ - (PICO_ENTRY_SIZE * NUM_PICO_ENTRIES)) -#define MICRO_BASE_ADDR (haddr_t)(NANO_BASE_ADDR + \ - (NANO_ENTRY_SIZE * NUM_NANO_ENTRIES)) -#define TINY_BASE_ADDR (haddr_t)(MICRO_BASE_ADDR + \ - (MICRO_ENTRY_SIZE * NUM_MICRO_ENTRIES)) -#define SMALL_BASE_ADDR (haddr_t)(TINY_BASE_ADDR + \ - (TINY_ENTRY_SIZE * NUM_TINY_ENTRIES)) -#define MEDIUM_BASE_ADDR (haddr_t)(SMALL_BASE_ADDR + \ - (SMALL_ENTRY_SIZE * NUM_SMALL_ENTRIES)) -#define LARGE_BASE_ADDR (haddr_t)(MEDIUM_BASE_ADDR + \ - (MEDIUM_ENTRY_SIZE * NUM_MEDIUM_ENTRIES)) -#define HUGE_BASE_ADDR (haddr_t)(LARGE_BASE_ADDR + \ - (LARGE_ENTRY_SIZE * NUM_LARGE_ENTRIES)) -#define MONSTER_BASE_ADDR (haddr_t)(HUGE_BASE_ADDR + \ - (HUGE_ENTRY_SIZE * NUM_HUGE_ENTRIES)) - -#define PICO_ALT_BASE_ADDR (haddr_t)(MONSTER_BASE_ADDR + \ - (MONSTER_ENTRY_SIZE * NUM_MONSTER_ENTRIES)) -#define NANO_ALT_BASE_ADDR (haddr_t)(PICO_ALT_BASE_ADDR + \ - (PICO_ENTRY_SIZE * NUM_PICO_ENTRIES)) -#define MICRO_ALT_BASE_ADDR (haddr_t)(NANO_ALT_BASE_ADDR + \ - (NANO_ENTRY_SIZE * NUM_NANO_ENTRIES)) -#define TINY_ALT_BASE_ADDR (haddr_t)(MICRO_ALT_BASE_ADDR + \ - (MICRO_ENTRY_SIZE * NUM_MICRO_ENTRIES)) -#define SMALL_ALT_BASE_ADDR (haddr_t)(TINY_ALT_BASE_ADDR + \ - (TINY_ENTRY_SIZE * NUM_TINY_ENTRIES)) -#define MEDIUM_ALT_BASE_ADDR (haddr_t)(SMALL_ALT_BASE_ADDR + \ - (SMALL_ENTRY_SIZE * NUM_SMALL_ENTRIES)) -#define LARGE_ALT_BASE_ADDR (haddr_t)(MEDIUM_ALT_BASE_ADDR + \ - (MEDIUM_ENTRY_SIZE * NUM_MEDIUM_ENTRIES)) -#define HUGE_ALT_BASE_ADDR (haddr_t)(LARGE_ALT_BASE_ADDR + \ - (LARGE_ENTRY_SIZE * NUM_LARGE_ENTRIES)) -#define MONSTER_ALT_BASE_ADDR (haddr_t)(HUGE_ALT_BASE_ADDR + \ - (HUGE_ENTRY_SIZE * NUM_HUGE_ENTRIES)) - -typedef struct test_entry_t -{ - H5C_cache_entry_t header; /* entry data used by the cache - * -- must be first - */ - struct test_entry_t * self; /* pointer to this entry -- used for - * sanity checking. - */ - haddr_t addr; /* where the cache thinks this entry - * is located - */ - hbool_t at_main_addr; /* boolean flag indicating whether - * the entry is supposed to be at - * either its main or alternate - * address. - */ - haddr_t main_addr; /* initial location of the entry - */ - haddr_t alt_addr; /* location to which the entry - * can be relocated or "renamed" - */ - size_t size; /* how big the cache thinks this - * entry is - */ - int32_t type; /* indicates which entry array this - * entry is in - */ - int32_t index; /* index in its entry array - */ - int32_t reads; /* number of times this entry has - * been loaded. - */ - int32_t writes; /* number of times this entry has - * been written - */ - hbool_t is_dirty; /* entry has been modified since - * last write - */ - hbool_t is_protected; /* entry should currently be on - * the cache's protected list. - */ - hbool_t loaded; /* entry has been loaded since the - * last time it was reset. - */ - hbool_t cleared; /* entry has been cleared since the - * last time it was reset. - */ - hbool_t flushed; /* entry has been flushed since the - * last time it was reset. - */ - hbool_t destroyed; /* entry has been destroyed since the - * last time it was reset. - */ -} 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 - * to the error reporting macros. Needless to say, these macros must be - * updated as necessary. - */ - -#define H5C__HASH_MASK ((size_t)(H5C__HASH_TABLE_LEN - 1) << 3) -#define H5C__HASH_FCN(x) (int)(((x) & H5C__HASH_MASK) >> 3) - -#define H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr) \ -if ( ( (cache_ptr) == NULL ) || \ - ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ - ( ! 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__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \ -if ( ( (cache_ptr) == NULL ) || \ - ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ - ( (cache_ptr)->index_len < 1 ) || \ - ( (entry_ptr) == NULL ) || \ - ( (cache_ptr)->index_size < (entry_ptr)->size ) || \ - ( H5F_addr_ne((entry_ptr)->addr, (Addr)) ) || \ - ( (entry_ptr)->size <= 0 ) || \ - ( ((cache_ptr)->index)[k] == NULL ) || \ - ( ( ((cache_ptr)->index)[k] != (entry_ptr) ) && \ - ( (entry_ptr)->ht_prev == NULL ) ) || \ - ( ( ((cache_ptr)->index)[k] == (entry_ptr) ) && \ - ( (entry_ptr)->ht_prev != NULL ) ) || \ - ( ( (entry_ptr)->ht_prev != NULL ) && \ - ( (entry_ptr)->ht_prev->ht_next != (entry_ptr) ) ) || \ - ( ( (entry_ptr)->ht_next != NULL ) && \ - ( (entry_ptr)->ht_next->ht_prev != (entry_ptr) ) ) ) { \ - HDfprintf(stdout, "Post successful HT search SC failed.\n"); \ -} - - -#define H5C__SEARCH_INDEX(cache_ptr, Addr, entry_ptr) \ -{ \ - int k; \ - int depth = 0; \ - H5C__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) ) ) \ - { \ - (entry_ptr) = (entry_ptr)->ht_next; \ - (depth)++; \ - } \ - if ( entry_ptr ) \ - { \ - H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \ - if ( entry_ptr != ((cache_ptr)->index)[k] ) \ - { \ - if ( (entry_ptr)->ht_next ) \ - { \ - (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \ - } \ - HDassert( (entry_ptr)->ht_prev != NULL ); \ - (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \ - ((cache_ptr)->index)[k]->ht_prev = (entry_ptr); \ - (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \ - (entry_ptr)->ht_prev = NULL; \ - ((cache_ptr)->index)[k] = (entry_ptr); \ - } \ - } \ -} - - -/* misc type definitions */ - -struct flush_cache_test_spec -{ - int entry_num; - int entry_type; - int entry_index; - hbool_t insert_flag; - hbool_t dirty_flag; - unsigned int flags; - hbool_t expected_loaded; - hbool_t expected_cleared; - hbool_t expected_flushed; - hbool_t expected_destroyed; -}; - - -/* global variable declarations: */ - -static hbool_t write_permitted = TRUE; -static hbool_t pass = TRUE; /* set to false on error */ -static hbool_t skip_long_tests = TRUE; -static hbool_t run_full_test = TRUE; -const char *failure_mssg = NULL; - -test_entry_t pico_entries[NUM_PICO_ENTRIES]; -test_entry_t nano_entries[NUM_NANO_ENTRIES]; -test_entry_t micro_entries[NUM_MICRO_ENTRIES]; -test_entry_t tiny_entries[NUM_TINY_ENTRIES]; -test_entry_t small_entries[NUM_SMALL_ENTRIES]; -test_entry_t medium_entries[NUM_MEDIUM_ENTRIES]; -test_entry_t large_entries[NUM_LARGE_ENTRIES]; -test_entry_t huge_entries[NUM_HUGE_ENTRIES]; -test_entry_t monster_entries[NUM_MONSTER_ENTRIES]; - -test_entry_t * entries[NUMBER_OF_ENTRY_TYPES] = -{ - pico_entries, - nano_entries, - micro_entries, - tiny_entries, - small_entries, - medium_entries, - large_entries, - huge_entries, - monster_entries -}; - -const int32_t max_indices[NUMBER_OF_ENTRY_TYPES] = -{ - NUM_PICO_ENTRIES - 1, - NUM_NANO_ENTRIES - 1, - NUM_MICRO_ENTRIES - 1, - NUM_TINY_ENTRIES - 1, - NUM_SMALL_ENTRIES - 1, - NUM_MEDIUM_ENTRIES - 1, - NUM_LARGE_ENTRIES - 1, - NUM_HUGE_ENTRIES - 1, - NUM_MONSTER_ENTRIES - 1 -}; - -const size_t entry_sizes[NUMBER_OF_ENTRY_TYPES] = -{ - PICO_ENTRY_SIZE, - NANO_ENTRY_SIZE, - MICRO_ENTRY_SIZE, - TINY_ENTRY_SIZE, - SMALL_ENTRY_SIZE, - MEDIUM_ENTRY_SIZE, - LARGE_ENTRY_SIZE, - HUGE_ENTRY_SIZE, - MONSTER_ENTRY_SIZE -}; - -const haddr_t base_addrs[NUMBER_OF_ENTRY_TYPES] = -{ - PICO_BASE_ADDR, - NANO_BASE_ADDR, - MICRO_BASE_ADDR, - TINY_BASE_ADDR, - SMALL_BASE_ADDR, - MEDIUM_BASE_ADDR, - LARGE_BASE_ADDR, - HUGE_BASE_ADDR, - MONSTER_BASE_ADDR -}; - -const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES] = -{ - PICO_ALT_BASE_ADDR, - NANO_ALT_BASE_ADDR, - MICRO_ALT_BASE_ADDR, - TINY_ALT_BASE_ADDR, - SMALL_ALT_BASE_ADDR, - MEDIUM_ALT_BASE_ADDR, - LARGE_ALT_BASE_ADDR, - HUGE_ALT_BASE_ADDR, - MONSTER_ALT_BASE_ADDR -}; - -const char * entry_type_names[NUMBER_OF_ENTRY_TYPES] = -{ - "pico entries -- 1 B", - "nano entries -- 4 B", - "micro entries -- 16 B", - "tiny entries -- 64 B", - "small entries -- 256 B", - "medium entries -- 1 KB", - "large entries -- 4 KB", - "huge entries -- 16 KB", - "monster entries -- 64 KB" -}; - - -/* call back function declarations: */ - -static herr_t check_write_permitted(const H5F_t UNUSED * f, - hid_t UNUSED dxpl_id, - hbool_t * write_permitted_ptr); - -static herr_t clear(H5F_t * f, void * thing, hbool_t dest); - -herr_t pico_clear(H5F_t * f, void * thing, hbool_t dest); -herr_t nano_clear(H5F_t * f, void * thing, hbool_t dest); -herr_t micro_clear(H5F_t * f, void * thing, hbool_t dest); -herr_t tiny_clear(H5F_t * f, void * thing, hbool_t dest); -herr_t small_clear(H5F_t * f, void * thing, hbool_t dest); -herr_t medium_clear(H5F_t * f, void * thing, hbool_t dest); -herr_t large_clear(H5F_t * f, void * thing, hbool_t dest); -herr_t huge_clear(H5F_t * f, void * thing, hbool_t dest); -herr_t monster_clear(H5F_t * f, void * thing, hbool_t dest); - - -static herr_t destroy(H5F_t UNUSED * f, void * thing); - -herr_t pico_dest(H5F_t * f, void * thing); -herr_t nano_dest(H5F_t * f, void * thing); -herr_t micro_dest(H5F_t * f, void * thing); -herr_t tiny_dest(H5F_t * f, void * thing); -herr_t small_dest(H5F_t * f, void * thing); -herr_t medium_dest(H5F_t * f, void * thing); -herr_t large_dest(H5F_t * f, void * thing); -herr_t huge_dest(H5F_t * f, void * thing); -herr_t monster_dest(H5F_t * f, void * thing); - - -static herr_t flush(H5F_t *f, hid_t UNUSED dxpl_id, hbool_t dest, - haddr_t addr, void *thing); - -herr_t pico_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing); -herr_t nano_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing); -herr_t micro_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing); -herr_t tiny_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing); -herr_t small_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing); -herr_t medium_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing); -herr_t large_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing); -herr_t huge_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing); -herr_t monster_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing); - - -static void * load(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t addr, - const void UNUSED *udata1, void UNUSED *udata2); - -void * pico_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); -void * nano_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); -void * micro_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); -void * tiny_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); -void * small_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); -void * medium_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); -void * large_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); -void * huge_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); -void * monster_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2); - - -static herr_t size(H5F_t UNUSED * f, void * thing, size_t * size_ptr); - -herr_t pico_size(H5F_t * f, void * thing, size_t * size_ptr); -herr_t nano_size(H5F_t * f, void * thing, size_t * size_ptr); -herr_t micro_size(H5F_t * f, void * thing, size_t * size_ptr); -herr_t tiny_size(H5F_t * f, void * thing, size_t * size_ptr); -herr_t small_size(H5F_t * f, void * thing, size_t * size_ptr); -herr_t medium_size(H5F_t * f, void * thing, size_t * size_ptr); -herr_t large_size(H5F_t * f, void * thing, size_t * size_ptr); -herr_t huge_size(H5F_t * f, void * thing, size_t * size_ptr); -herr_t monster_size(H5F_t * f, void * thing, size_t * size_ptr); - - -/* callback table declaration */ - -static const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = -{ - { - PICO_ENTRY_TYPE, - (H5C_load_func_t)pico_load, - (H5C_flush_func_t)pico_flush, - (H5C_dest_func_t)pico_dest, - (H5C_clear_func_t)pico_clear, - (H5C_size_func_t)pico_size - }, - { - NANO_ENTRY_TYPE, - (H5C_load_func_t)nano_load, - (H5C_flush_func_t)nano_flush, - (H5C_dest_func_t)nano_dest, - (H5C_clear_func_t)nano_clear, - (H5C_size_func_t)nano_size - }, - { - MICRO_ENTRY_TYPE, - (H5C_load_func_t)micro_load, - (H5C_flush_func_t)micro_flush, - (H5C_dest_func_t)micro_dest, - (H5C_clear_func_t)micro_clear, - (H5C_size_func_t)micro_size - }, - { - TINY_ENTRY_TYPE, - (H5C_load_func_t)tiny_load, - (H5C_flush_func_t)tiny_flush, - (H5C_dest_func_t)tiny_dest, - (H5C_clear_func_t)tiny_clear, - (H5C_size_func_t)tiny_size - }, - { - SMALL_ENTRY_TYPE, - (H5C_load_func_t)small_load, - (H5C_flush_func_t)small_flush, - (H5C_dest_func_t)small_dest, - (H5C_clear_func_t)small_clear, - (H5C_size_func_t)small_size - }, - { - MEDIUM_ENTRY_TYPE, - (H5C_load_func_t)medium_load, - (H5C_flush_func_t)medium_flush, - (H5C_dest_func_t)medium_dest, - (H5C_clear_func_t)medium_clear, - (H5C_size_func_t)medium_size - }, - { - LARGE_ENTRY_TYPE, - (H5C_load_func_t)large_load, - (H5C_flush_func_t)large_flush, - (H5C_dest_func_t)large_dest, - (H5C_clear_func_t)large_clear, - (H5C_size_func_t)large_size - }, - { - HUGE_ENTRY_TYPE, - (H5C_load_func_t)huge_load, - (H5C_flush_func_t)huge_flush, - (H5C_dest_func_t)huge_dest, - (H5C_clear_func_t)huge_clear, - (H5C_size_func_t)huge_size - }, - { - MONSTER_ENTRY_TYPE, - (H5C_load_func_t)monster_load, - (H5C_flush_func_t)monster_flush, - (H5C_dest_func_t)monster_dest, - (H5C_clear_func_t)monster_clear, - (H5C_size_func_t)monster_size - } -}; - - /* private function declarations: */ -static void addr_to_type_and_index(haddr_t addr, - int32_t * type_ptr, - int32_t * index_ptr); - -#if 0 /* keep this for a while -- it may be useful */ -static haddr_t type_and_index_to_addr(int32_t type, - int32_t idx); -#endif - -static void insert_entry(H5C_t * cache_ptr, - int32_t type, - int32_t idx, - hbool_t dirty, - unsigned int flags); - -static void rename_entry(H5C_t * cache_ptr, - int32_t type, - int32_t idx, - hbool_t main_addr); - -static void protect_entry(H5C_t * cache_ptr, - int32_t type, - int32_t idx); - -hbool_t entry_in_cache(H5C_t * cache_ptr, - int32_t type, - int32_t idx); - -static void reset_entries(void); - -static H5C_t * setup_cache(size_t max_cache_size, size_t min_clean_size); - -static void row_major_scan_forward(H5C_t * cache_ptr, - int32_t lag, - hbool_t verbose, - hbool_t reset_stats, - hbool_t display_stats, - hbool_t display_detailed_stats, - hbool_t do_inserts, - hbool_t dirty_inserts, - hbool_t do_renames, - hbool_t rename_to_main_addr, - hbool_t do_destroys, - int dirty_destroys, - int dirty_unprotects); - -static void hl_row_major_scan_forward(H5C_t * cache_ptr, - int32_t max_index, - hbool_t verbose, - hbool_t reset_stats, - hbool_t display_stats, - hbool_t display_detailed_stats, - hbool_t do_inserts, - hbool_t dirty_inserts); - -static void row_major_scan_backward(H5C_t * cache_ptr, - int32_t lag, - hbool_t verbose, - hbool_t reset_stats, - hbool_t display_stats, - hbool_t display_detailed_stats, - hbool_t do_inserts, - hbool_t dirty_inserts, - hbool_t do_renames, - hbool_t rename_to_main_addr, - hbool_t do_destroys, - int dirty_destroys, - int dirty_unprotects); - -static void hl_row_major_scan_backward(H5C_t * cache_ptr, - int32_t max_index, - hbool_t verbose, - hbool_t reset_stats, - hbool_t display_stats, - hbool_t display_detailed_stats, - hbool_t do_inserts, - hbool_t dirty_inserts); - -static void col_major_scan_forward(H5C_t * cache_ptr, - int32_t lag, - hbool_t verbose, - hbool_t reset_stats, - hbool_t display_stats, - hbool_t display_detailed_stats, - hbool_t do_inserts, - hbool_t dirty_inserts, - int dirty_unprotects); - -static void hl_col_major_scan_forward(H5C_t * cache_ptr, - int32_t max_index, - hbool_t verbose, - hbool_t reset_stats, - hbool_t display_stats, - hbool_t display_detailed_stats, - hbool_t do_inserts, - hbool_t dirty_inserts, - int dirty_unprotects); - -static void col_major_scan_backward(H5C_t * cache_ptr, - int32_t lag, - hbool_t verbose, - hbool_t reset_stats, - hbool_t display_stats, - hbool_t display_detailed_stats, - hbool_t do_inserts, - hbool_t dirty_inserts, - int dirty_unprotects); - -static void hl_col_major_scan_backward(H5C_t * cache_ptr, - int32_t max_index, - hbool_t verbose, - hbool_t reset_stats, - hbool_t display_stats, - hbool_t display_detailed_stats, - hbool_t do_inserts, - hbool_t dirty_inserts, - int dirty_unprotects); - static void smoke_check_1(void); static void smoke_check_2(void); static void smoke_check_3(void); @@ -680,2283 +67,1879 @@ static void check_auto_cache_resize_epoch_markers(void); static void check_auto_cache_resize_input_errs(void); static void check_auto_cache_resize_aux_fcns(void); -static void takedown_cache(H5C_t * cache_ptr, - hbool_t dump_stats, - hbool_t dump_detailed_stats); - -static void flush_cache(H5C_t * cache_ptr, - hbool_t destroy_entries, - hbool_t dump_stats, - hbool_t dump_detailed_stats); - -static void unprotect_entry(H5C_t * cache_ptr, - int32_t type, - int32_t idx, - int dirty, - unsigned int flags); - -static void verify_clean(void); - -static void verify_unprotected(void); - -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(void); - -static void check_fapl_mdc_api_errs(void); - -static void check_file_mdc_api_errs(void); - -/* address translation funtions: */ +/**************************************************************************/ +/**************************************************************************/ +/********************************* tests: *********************************/ +/**************************************************************************/ +/**************************************************************************/ /*------------------------------------------------------------------------- - * Function: addr_to_type_and_index + * Function: smoke_check_1() * - * Purpose: Given an address, compute the type and index of the - * associated entry. + * Purpose: A basic functional test, inserts, destroys, and renames in + * the mix, along with repeated protects and unprotects. + * All entries are marked as clean. * * Return: void * * Programmer: John Mainzer - * 6/10/04 + * 6/16/04 * * Modifications: * + * JRM -- 1/18/05 + * Added code to skip this test if the skip_long_tests global + * is true. + * *------------------------------------------------------------------------- */ + static void -addr_to_type_and_index(haddr_t addr, - int32_t * type_ptr, - int32_t * index_ptr) +smoke_check_1(void) { - int i; - int32_t type; - int32_t idx; + const char * fcn_name = "smoke_check_1"; + hbool_t show_progress = FALSE; + hbool_t dirty_inserts = FALSE; + int dirty_unprotects = FALSE; + int dirty_destroys = FALSE; + hbool_t display_stats = FALSE; + int32_t lag = 10; + int mile_stone = 1; + H5C_t * cache_ptr = NULL; - HDassert( type_ptr ); - HDassert( index_ptr ); + TESTING("smoke check #1 -- all clean, ins, dest, ren, 4/2 MB cache"); - /* we only have a small number of entry types, so just do a - * linear search. If NUMBER_OF_ENTRY_TYPES grows, we may want - * to do a binary search instead. - */ - i = 1; - if ( addr >= PICO_ALT_BASE_ADDR ) { + if ( skip_long_tests ) { - while ( ( i < NUMBER_OF_ENTRY_TYPES ) && - ( addr >= alt_base_addrs[i] ) ) - { - i++; - } + SKIPPED(); - } else { + HDfprintf(stdout, " Long tests disabled.\n"); - while ( ( i < NUMBER_OF_ENTRY_TYPES ) && - ( addr >= base_addrs[i] ) ) - { - i++; - } + return; } - type = i - 1; + pass = TRUE; - HDassert( ( type >= 0 ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); + if ( show_progress ) /* 1 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( addr >= PICO_ALT_BASE_ADDR ) { + reset_entries(); - idx = (addr - alt_base_addrs[type]) / entry_sizes[type]; - HDassert( !((entries[type])[idx].at_main_addr) ); - HDassert( addr == (entries[type])[idx].alt_addr ); + if ( show_progress ) /* 2 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - } else { + cache_ptr = setup_cache((size_t)(4 * 1024 * 1024), + (size_t)(2 * 1024 * 1024)); - idx = (addr - base_addrs[type]) / entry_sizes[type]; - HDassert( (entries[type])[idx].at_main_addr ); - HDassert( addr == (entries[type])[idx].main_addr ); - } + if ( show_progress ) /* 3 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - HDassert( ( idx >= 0 ) && ( idx <= max_indices[type] ) ); + row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ FALSE, + /* do_destroys */ TRUE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); - HDassert( addr == (entries[type])[idx].addr ); + if ( show_progress ) /* 4 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - *type_ptr = type; - *index_ptr = idx; + row_major_scan_backward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ FALSE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ TRUE, + /* do_destroys */ FALSE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); - return; + if ( show_progress ) /* 5 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -} /* addr_to_type_and_index() */ + row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ FALSE, + /* do_destroys */ FALSE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); - -#if 0 /* This function has never been used, but we may want it - * some time. Lets keep it for now. - */ -/*------------------------------------------------------------------------- - * Function: type_and_index_to_addr - * - * Purpose: Given a type and index of an entry, compute the associated - * addr and return that value. - * - * Return: computed addr - * - * Programmer: John Mainzer - * 6/10/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static haddr_t -type_and_index_to_addr(int32_t type, - int32_t idx) -{ - haddr_t addr; + if ( show_progress ) /* 6 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - HDassert( ( type >= 0 ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); - HDassert( ( idx >= 0 ) && ( idx <= max_indices[type] ) ); + /* flush and destroy all entries in the cache: */ - addr = base_addrs[type] + (((haddr_t)idx) * entry_sizes[type]); + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ TRUE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); - HDassert( addr == (entries[type])[idx].addr ); + if ( show_progress ) /* 7 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( (entries[type])[idx].at_main_addr ) { + col_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); - HDassert( addr == (entries[type])[idx].main_addr ); + if ( show_progress ) /* 8 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - } else { + /* flush all entries in the cache: */ - HDassert( addr == (entries[type])[idx].alt_addr ); - } + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ FALSE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); - return(addr); + if ( show_progress ) /* 9 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -} /* type_and_index_to_addr() */ + col_major_scan_backward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); -#endif + if ( show_progress ) /* 10 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - -/* Call back functions: */ + takedown_cache(cache_ptr, display_stats, TRUE); -/*------------------------------------------------------------------------- - * - * Function: H5AC_check_if_write_permitted - * - * Purpose: Determine if a write is permitted under the current - * circumstances, and set *write_permitted_ptr accordingly. - * As a general rule it is, but when we are running in parallel - * mode with collective I/O, we must ensure that a read cannot - * cause a write. - * - * In the event of failure, the value of *write_permitted_ptr - * is undefined. - * - * Return: Non-negative on success/Negative on failure. - * - * Programmer: John Mainzer, 5/15/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ + if ( show_progress ) /* 11 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -static herr_t -check_write_permitted(const H5F_t UNUSED * f, - hid_t UNUSED dxpl_id, - hbool_t * write_permitted_ptr) -{ + verify_clean(); + verify_unprotected(); - HDassert( write_permitted_ptr ); - *write_permitted_ptr = write_permitted; + if ( pass ) { PASSED(); } else { H5_FAILED(); } - return(SUCCEED); + if ( ! pass ) + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); -} /* check_write_permitted() */ +} /* smoke_check_1() */ /*------------------------------------------------------------------------- - * Function: clear & friends + * Function: smoke_check_2() * - * Purpose: clear the entry. The helper functions verify that the - * correct version of clear is being called, and then call - * clear proper. + * Purpose: A basic functional test, with inserts, destroys, and + * renames in the mix, along with some repeated protects + * and unprotects. About half the entries are marked as + * dirty. * - * Return: SUCCEED + * Return: void * * Programmer: John Mainzer - * 6/10/04 + * 6/24/04 * * Modifications: * + * JRM -- 1/18/05 + * Added code to skip this test if the skip_long_tests global + * is true. + * *------------------------------------------------------------------------- */ -static herr_t -clear(H5F_t * f, - void * thing, - hbool_t dest) +static void +smoke_check_2(void) { - test_entry_t * entry_ptr; - test_entry_t * base_addr; - - HDassert( thing ); - - entry_ptr = (test_entry_t *)thing; - base_addr = entries[entry_ptr->type]; - - HDassert( entry_ptr->index >= 0 ); - HDassert( entry_ptr->index <= max_indices[entry_ptr->type] ); - HDassert( entry_ptr == &(base_addr[entry_ptr->index]) ); - HDassert( entry_ptr == entry_ptr->self ); - HDassert( entry_ptr->header.addr == entry_ptr->addr ); - HDassert( entry_ptr->header.size == entry_ptr->size ); - HDassert( entry_ptr->size == entry_sizes[entry_ptr->type] ); + const char * fcn_name = "smoke_check_2"; + hbool_t show_progress = FALSE; + hbool_t dirty_inserts = TRUE; + int dirty_unprotects = TRUE; + int dirty_destroys = TRUE; + hbool_t display_stats = FALSE; + int32_t lag = 10; + int mile_stone = 1; + H5C_t * cache_ptr = NULL; - entry_ptr->header.is_dirty = FALSE; - entry_ptr->is_dirty = FALSE; + TESTING("smoke check #2 -- ~1/2 dirty, ins, dest, ren, 4/2 MB cache"); - entry_ptr->cleared = TRUE; + if ( skip_long_tests ) { - if ( dest ) { + SKIPPED(); - destroy(f, thing); + HDfprintf(stdout, " Long tests disabled.\n"); + return; } - return(SUCCEED); - -} /* clear() */ + pass = TRUE; -herr_t -pico_clear(H5F_t * f, void * thing, hbool_t dest) -{ - HDassert ( ((test_entry_t *)thing)->type == PICO_ENTRY_TYPE ); - return(clear(f, thing, dest)); -} + if ( show_progress ) /* 1 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -herr_t -nano_clear(H5F_t * f, void * thing, hbool_t dest) -{ - HDassert ( ((test_entry_t *)thing)->type == NANO_ENTRY_TYPE ); - return(clear(f, thing, dest)); -} + reset_entries(); -herr_t -micro_clear(H5F_t * f, void * thing, hbool_t dest) -{ - HDassert ( ((test_entry_t *)thing)->type == MICRO_ENTRY_TYPE ); - return(clear(f, thing, dest)); -} + if ( show_progress ) /* 2 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -herr_t -tiny_clear(H5F_t * f, void * thing, hbool_t dest) -{ - HDassert ( ((test_entry_t *)thing)->type == TINY_ENTRY_TYPE ); - return(clear(f, thing, dest)); -} + cache_ptr = setup_cache((size_t)(4 * 1024 * 1024), + (size_t)(2 * 1024 * 1024)); -herr_t -small_clear(H5F_t * f, void * thing, hbool_t dest) -{ - HDassert ( ((test_entry_t *)thing)->type == SMALL_ENTRY_TYPE ); - return(clear(f, thing, dest)); -} + if ( show_progress ) /* 3 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -herr_t -medium_clear(H5F_t * f, void * thing, hbool_t dest) -{ - HDassert ( ((test_entry_t *)thing)->type == MEDIUM_ENTRY_TYPE ); - return(clear(f, thing, dest)); -} + row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ FALSE, + /* do_destroys */ TRUE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); -herr_t -large_clear(H5F_t * f, void * thing, hbool_t dest) -{ - HDassert ( ((test_entry_t *)thing)->type == LARGE_ENTRY_TYPE ); - return(clear(f, thing, dest)); -} + if ( show_progress ) /* 4 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -herr_t -huge_clear(H5F_t * f, void * thing, hbool_t dest) -{ - HDassert ( ((test_entry_t *)thing)->type == HUGE_ENTRY_TYPE ); - return(clear(f, thing, dest)); -} + row_major_scan_backward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ FALSE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ TRUE, + /* do_destroys */ FALSE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); -herr_t -monster_clear(H5F_t * f, void * thing, hbool_t dest) -{ - HDassert ( ((test_entry_t *)thing)->type == MONSTER_ENTRY_TYPE ); - return(clear(f, thing, dest)); -} + if ( show_progress ) /* 5 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - -/*------------------------------------------------------------------------- - * Function: dest & friends - * - * Purpose: Destroy the entry. The helper functions verify that the - * correct version of dest is being called, and then call - * dest proper. - * - * Return: SUCCEED - * - * Programmer: John Mainzer - * 6/10/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ + row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ FALSE, + /* do_destroys */ FALSE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); -static herr_t -destroy(H5F_t UNUSED * f, - void * thing) -{ - test_entry_t * entry_ptr; - test_entry_t * base_addr; + if ( show_progress ) /* 6 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - HDassert( thing ); + /* flush and destroy all entries in the cache: */ - entry_ptr = (test_entry_t *)thing; - base_addr = entries[entry_ptr->type]; + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ TRUE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); - HDassert ( entry_ptr->index >= 0 ); - HDassert ( entry_ptr->index <= max_indices[entry_ptr->type] ); - HDassert( entry_ptr == &(base_addr[entry_ptr->index]) ); - HDassert( entry_ptr == entry_ptr->self ); - HDassert( entry_ptr->header.addr == entry_ptr->addr ); - HDassert( entry_ptr->header.size == entry_ptr->size ); - HDassert( entry_ptr->size == entry_sizes[entry_ptr->type] ); + if ( show_progress ) /* 7 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - HDassert( !(entry_ptr->is_dirty) ); - HDassert( !(entry_ptr->header.is_dirty) ); + col_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); - entry_ptr->destroyed = TRUE; + if ( show_progress ) /* 8 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - return(SUCCEED); + /* flush all entries in the cache: */ -} /* dest() */ + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ FALSE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); -herr_t -pico_dest(H5F_t * f, void * thing) -{ - HDassert ( ((test_entry_t *)thing)->type == PICO_ENTRY_TYPE ); - return(destroy(f, thing)); -} + if ( show_progress ) /* 9 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -herr_t -nano_dest(H5F_t * f, void * thing) -{ - HDassert ( ((test_entry_t *)thing)->type == NANO_ENTRY_TYPE ); - return(destroy(f, thing)); -} + col_major_scan_backward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); -herr_t -micro_dest(H5F_t * f, void * thing) -{ - HDassert ( ((test_entry_t *)thing)->type == MICRO_ENTRY_TYPE ); - return(destroy(f, thing)); -} + if ( show_progress ) /* 10 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -herr_t -tiny_dest(H5F_t * f, void * thing) -{ - HDassert ( ((test_entry_t *)thing)->type == TINY_ENTRY_TYPE ); - return(destroy(f, thing)); -} + takedown_cache(cache_ptr, display_stats, TRUE); -herr_t -small_dest(H5F_t * f, void * thing) -{ - HDassert ( ((test_entry_t *)thing)->type == SMALL_ENTRY_TYPE ); - return(destroy(f, thing)); -} + if ( show_progress ) /* 11 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -herr_t -medium_dest(H5F_t * f, void * thing) -{ - HDassert ( ((test_entry_t *)thing)->type == MEDIUM_ENTRY_TYPE ); - return(destroy(f, thing)); -} + verify_clean(); + verify_unprotected(); -herr_t -large_dest(H5F_t * f, void * thing) -{ - HDassert ( ((test_entry_t *)thing)->type == LARGE_ENTRY_TYPE ); - return(destroy(f, thing)); -} + if ( pass ) { PASSED(); } else { H5_FAILED(); } -herr_t -huge_dest(H5F_t * f, void * thing) -{ - HDassert ( ((test_entry_t *)thing)->type == HUGE_ENTRY_TYPE ); - return(destroy(f, thing)); -} + if ( ! pass ) + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); -herr_t -monster_dest(H5F_t * f, void * thing) -{ - HDassert ( ((test_entry_t *)thing)->type == MONSTER_ENTRY_TYPE ); - return(destroy(f, thing)); -} +} /* smoke_check_2() */ /*------------------------------------------------------------------------- - * Function: flush & friends + * Function: smoke_check_3() * - * Purpose: flush the entry and mark it as clean. The helper functions - * verify that the correct version of flush is being called, - * and then call flush proper. + * Purpose: A basic functional test on a tiny cache, with inserts, + * destroys, and renames in the mix, along with repeated + * protects and unprotects. All entries are marked as clean. * - * Return: SUCCEED + * Return: void * * Programmer: John Mainzer - * 6/10/04 + * 6/16/04 * * Modifications: * + * JRM -- 1/18/05 + * Added code to skip this test if the skip_long_tests global + * is true. + * *------------------------------------------------------------------------- */ -static herr_t -flush(H5F_t *f, - hid_t UNUSED dxpl_id, - hbool_t dest, - haddr_t addr, - void *thing) +static void +smoke_check_3(void) { - test_entry_t * entry_ptr; - test_entry_t * base_addr; - - HDassert( thing ); - - entry_ptr = (test_entry_t *)thing; - base_addr = entries[entry_ptr->type]; - - HDassert( entry_ptr->index >= 0 ); - HDassert( entry_ptr->index <= max_indices[entry_ptr->type] ); - HDassert( entry_ptr == &(base_addr[entry_ptr->index]) ); - HDassert( entry_ptr == entry_ptr->self ); - HDassert( entry_ptr->header.addr == entry_ptr->addr ); - HDassert( entry_ptr->addr == addr ); - HDassert( entry_ptr->header.size == entry_ptr->size ); - HDassert( entry_ptr->size == entry_sizes[entry_ptr->type] ); - HDassert( entry_ptr->header.is_dirty == entry_ptr->is_dirty ); + const char * fcn_name = "smoke_check_3"; + hbool_t show_progress = FALSE; + hbool_t dirty_inserts = FALSE; + int dirty_unprotects = FALSE; + int dirty_destroys = FALSE; + hbool_t display_stats = FALSE; + int32_t lag = 10; + int mile_stone = 1; + H5C_t * cache_ptr = NULL; - entry_ptr->flushed = TRUE; + TESTING("smoke check #3 -- all clean, ins, dest, ren, 2/1 KB cache"); - if ( ( ! write_permitted ) && ( entry_ptr->is_dirty ) ) { + if ( skip_long_tests ) { - pass = FALSE; - failure_mssg = "called flush when write_permitted is FALSE."; - } + SKIPPED(); - if ( entry_ptr->is_dirty ) { + HDfprintf(stdout, " Long tests disabled.\n"); - (entry_ptr->writes)++; - entry_ptr->is_dirty = FALSE; - entry_ptr->header.is_dirty = FALSE; + return; } - if ( dest ) { - - destroy(f, thing); + pass = TRUE; - } + if ( show_progress ) /* 1 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - return(SUCCEED); + reset_entries(); -} /* flush() */ + if ( show_progress ) /* 2 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -herr_t -pico_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, void *thing) -{ - HDassert ( ((test_entry_t *)thing)->type == PICO_ENTRY_TYPE ); - return(flush(f, dxpl_id, dest, addr, thing)); -} + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); -herr_t -nano_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, void *thing) -{ - HDassert ( ((test_entry_t *)thing)->type == NANO_ENTRY_TYPE ); - return(flush(f, dxpl_id, dest, addr, thing)); -} + if ( show_progress ) /* 3 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -herr_t -micro_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, void *thing) -{ - HDassert ( ((test_entry_t *)thing)->type == MICRO_ENTRY_TYPE ); - return(flush(f, dxpl_id, dest, addr, thing)); -} + row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ FALSE, + /* do_destroys */ TRUE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); -herr_t -tiny_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, void *thing) -{ - HDassert ( ((test_entry_t *)thing)->type == TINY_ENTRY_TYPE ); - return(flush(f, dxpl_id, dest, addr, thing)); -} + if ( show_progress ) /* 4 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -herr_t -small_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, void *thing) -{ - HDassert ( ((test_entry_t *)thing)->type == SMALL_ENTRY_TYPE ); - return(flush(f, dxpl_id, dest, addr, thing)); -} + row_major_scan_backward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ FALSE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ TRUE, + /* do_destroys */ FALSE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); -herr_t -medium_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, void *thing) -{ - HDassert ( ((test_entry_t *)thing)->type == MEDIUM_ENTRY_TYPE ); - return(flush(f, dxpl_id, dest, addr, thing)); -} + if ( show_progress ) /* 5 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -herr_t -large_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, void *thing) -{ - HDassert ( ((test_entry_t *)thing)->type == LARGE_ENTRY_TYPE ); - return(flush(f, dxpl_id, dest, addr, thing)); -} - -herr_t -huge_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, void *thing) -{ - HDassert ( ((test_entry_t *)thing)->type == HUGE_ENTRY_TYPE ); - return(flush(f, dxpl_id, dest, addr, thing)); -} - -herr_t -monster_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, void *thing) -{ - HDassert ( ((test_entry_t *)thing)->type == MONSTER_ENTRY_TYPE ); - return(flush(f, dxpl_id, dest, addr, thing)); -} - - -/*------------------------------------------------------------------------- - * Function: load & friends - * - * Purpose: "load" the requested entry and mark it as clean. The - * helper functions verify that the correct version of load - * is being called, and then call load proper. - * - * Return: SUCCEED - * - * Programmer: John Mainzer - * 6/10/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static void * -load(H5F_t UNUSED *f, - hid_t UNUSED dxpl_id, - haddr_t addr, - const void UNUSED *udata1, - void UNUSED *udata2) -{ - int32_t type; - int32_t idx; - test_entry_t * entry_ptr; - test_entry_t * base_addr; + row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ FALSE, + /* do_destroys */ FALSE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); - addr_to_type_and_index(addr, &type, &idx); + if ( show_progress ) /* 6 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - base_addr = entries[type]; - entry_ptr = &(base_addr[idx]); + /* flush and destroy all entries in the cache: */ - HDassert( entry_ptr->type == type ); - HDassert( entry_ptr->type >= 0 ); - HDassert( entry_ptr->type < NUMBER_OF_ENTRY_TYPES ); - HDassert( entry_ptr->index == idx ); - HDassert( entry_ptr->index >= 0 ); - HDassert( entry_ptr->index <= max_indices[type] ); - HDassert( entry_ptr == entry_ptr->self ); - HDassert( entry_ptr->addr == addr ); - HDassert( entry_ptr->size == entry_sizes[type] ); + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ TRUE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); - entry_ptr->loaded = TRUE; + if ( show_progress ) /* 7 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - entry_ptr->header.is_dirty = FALSE; - entry_ptr->is_dirty = FALSE; + col_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); - (entry_ptr->reads)++; + if ( show_progress ) /* 8 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - return(entry_ptr); + /* flush all entries in the cache: */ -} /* load() */ + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ FALSE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); -void * -pico_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) -{ - return(load(f, dxpl_id, addr, udata1, udata2)); -} + if ( show_progress ) /* 9 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -void * -nano_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) -{ - return(load(f, dxpl_id, addr, udata1, udata2)); -} + col_major_scan_backward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); -void * -micro_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) -{ - return(load(f, dxpl_id, addr, udata1, udata2)); -} + if ( show_progress ) /* 10 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -void * -tiny_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) -{ - return(load(f, dxpl_id, addr, udata1, udata2)); -} + takedown_cache(cache_ptr, display_stats, TRUE); -void * -small_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) -{ - return(load(f, dxpl_id, addr, udata1, udata2)); -} + if ( show_progress ) /* 11 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -void * -medium_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) -{ - return(load(f, dxpl_id, addr, udata1, udata2)); -} + verify_clean(); + verify_unprotected(); -void * -large_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) -{ - return(load(f, dxpl_id, addr, udata1, udata2)); -} + if ( pass ) { PASSED(); } else { H5_FAILED(); } -void * -huge_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) -{ - return(load(f, dxpl_id, addr, udata1, udata2)); -} + if ( ! pass ) + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); -void * -monster_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *udata1, void *udata2) -{ - return(load(f, dxpl_id, addr, udata1, udata2)); -} +} /* smoke_check_3() */ /*------------------------------------------------------------------------- - * Function: size & friends + * Function: smoke_check_4() * - * Purpose: Get the size of the specified entry. The helper functions - * verify that the correct version of size is being called, - * and then call size proper. + * Purpose: A basic functional test on a tiny cache, with inserts, + * destroys, and renames in the mix, along with repeated + * protects and unprotects. About half the entries are + * marked as dirty. * - * Return: SUCCEED + * Return: void * * Programmer: John Mainzer - * 6/10/04 + * 6/24/04 * * Modifications: * + * JRM -- 1/18/05 + * Added code to skip this test if the skip_long_tests global + * is true. + * *------------------------------------------------------------------------- */ -static herr_t -size(H5F_t UNUSED * f, - void * thing, - size_t * size_ptr) +static void +smoke_check_4(void) { - test_entry_t * entry_ptr; - test_entry_t * base_addr; + const char * fcn_name = "smoke_check_4"; + hbool_t show_progress = FALSE; + hbool_t dirty_inserts = TRUE; + int dirty_unprotects = TRUE; + int dirty_destroys = TRUE; + hbool_t display_stats = FALSE; + int32_t lag = 10; + int mile_stone = 1; + H5C_t * cache_ptr = NULL; - HDassert( size_ptr ); - HDassert( thing ); + TESTING("smoke check #4 -- ~1/2 dirty, ins, dest, ren, 2/1 KB cache"); - entry_ptr = (test_entry_t *)thing; - base_addr = entries[entry_ptr->type]; + if ( skip_long_tests ) { - HDassert( entry_ptr->index >= 0 ); - HDassert( entry_ptr->index <= max_indices[entry_ptr->type] ); - HDassert( entry_ptr == &(base_addr[entry_ptr->index]) ); - HDassert( entry_ptr == entry_ptr->self ); - HDassert( entry_ptr->header.addr == entry_ptr->addr ); - HDassert( entry_ptr->size == entry_sizes[entry_ptr->type] ); + SKIPPED(); - *size_ptr = entry_ptr->size; + HDfprintf(stdout, " Long tests disabled.\n"); - return(SUCCEED); + return; + } -} /* size() */ + pass = TRUE; -herr_t -pico_size(H5F_t * f, void * thing, size_t * size_ptr) -{ - HDassert ( ((test_entry_t *)thing)->type == PICO_ENTRY_TYPE ); - return(size(f, thing, size_ptr)); -} + if ( show_progress ) /* 1 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -herr_t -nano_size(H5F_t * f, void * thing, size_t * size_ptr) -{ - HDassert ( ((test_entry_t *)thing)->type == NANO_ENTRY_TYPE ); - return(size(f, thing, size_ptr)); -} + reset_entries(); -herr_t -micro_size(H5F_t * f, void * thing, size_t * size_ptr) -{ - HDassert ( ((test_entry_t *)thing)->type == MICRO_ENTRY_TYPE ); - return(size(f, thing, size_ptr)); -} + if ( show_progress ) /* 2 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -herr_t -tiny_size(H5F_t * f, void * thing, size_t * size_ptr) -{ - HDassert ( ((test_entry_t *)thing)->type == TINY_ENTRY_TYPE ); - return(size(f, thing, size_ptr)); -} + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); -herr_t -small_size(H5F_t * f, void * thing, size_t * size_ptr) -{ - HDassert ( ((test_entry_t *)thing)->type == SMALL_ENTRY_TYPE ); - return(size(f, thing, size_ptr)); -} + if ( show_progress ) /* 3 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -herr_t -medium_size(H5F_t * f, void * thing, size_t * size_ptr) -{ - HDassert ( ((test_entry_t *)thing)->type == MEDIUM_ENTRY_TYPE ); - return(size(f, thing, size_ptr)); -} + row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ FALSE, + /* do_destroys */ TRUE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); -herr_t -large_size(H5F_t * f, void * thing, size_t * size_ptr) -{ - HDassert ( ((test_entry_t *)thing)->type == LARGE_ENTRY_TYPE ); - return(size(f, thing, size_ptr)); -} + if ( show_progress ) /* 4 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -herr_t -huge_size(H5F_t * f, void * thing, size_t * size_ptr) -{ - HDassert ( ((test_entry_t *)thing)->type == HUGE_ENTRY_TYPE ); - return(size(f, thing, size_ptr)); -} + row_major_scan_backward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ FALSE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ TRUE, + /* do_destroys */ FALSE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); -herr_t -monster_size(H5F_t * f, void * thing, size_t * size_ptr) -{ - HDassert ( ((test_entry_t *)thing)->type == MONSTER_ENTRY_TYPE ); - return(size(f, thing, size_ptr)); -} + if ( show_progress ) /* 5 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - -/**************************************************************************/ -/**************************************************************************/ -/************************** test utility functions: ***********************/ -/**************************************************************************/ -/**************************************************************************/ + row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ FALSE, + /* do_destroys */ FALSE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); -/*------------------------------------------------------------------------- - * Function: entry_in_cache - * - * Purpose: Given a pointer to a cache, an entry type, and an index, - * determine if the entry is currently in the cache. - * - * Return: TRUE if the entry is in the cache, and FALSE otherwise. - * - * Programmer: John Mainzer - * 6/10/04 - * - * Modifications: - * - * JRM - 10/12/04 - * Removed references to local_H5C_t, as we now get direct - * access to the definition of H5C_t via H5Cpkg.h. - * - *------------------------------------------------------------------------- - */ + if ( show_progress ) /* 6 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -hbool_t -entry_in_cache(H5C_t * cache_ptr, - int32_t type, - int32_t idx) -{ - hbool_t in_cache = FALSE; /* will set to TRUE if necessary */ - test_entry_t * base_addr; - test_entry_t * entry_ptr; - H5C_cache_entry_t * test_ptr = NULL; + /* flush and destroy all entries in the cache: */ - HDassert( cache_ptr ); - HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); - HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ TRUE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); - base_addr = entries[type]; - entry_ptr = &(base_addr[idx]); + if ( show_progress ) /* 7 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - HDassert( entry_ptr->index == idx ); - HDassert( entry_ptr->type == type ); - HDassert( entry_ptr == entry_ptr->self ); + col_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); - H5C__SEARCH_INDEX(cache_ptr, entry_ptr->addr, test_ptr) + if ( show_progress ) /* 8 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( test_ptr != NULL ) { + /* flush all entries in the cache: */ - in_cache = TRUE; - HDassert( test_ptr == (H5C_cache_entry_t *)entry_ptr ); - HDassert( entry_ptr->addr == entry_ptr->header.addr ); - } + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ FALSE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); - return(in_cache); + if ( show_progress ) /* 9 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -} /* entry_in_cache() */ + col_major_scan_backward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); - -/*------------------------------------------------------------------------- - * Function: reset_entries - * - * Purpose: reset the contents of the entries arrays to know values. - * - * Return: void - * - * Programmer: John Mainzer - * 6/10/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ + if ( show_progress ) /* 10 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -static void -reset_entries(void) + takedown_cache(cache_ptr, display_stats, TRUE); -{ - int i; - int j; - int32_t max_index; - haddr_t addr = 0; - haddr_t alt_addr = PICO_ALT_BASE_ADDR; - size_t entry_size; - test_entry_t * base_addr; + if ( show_progress ) /* 11 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ ) - { - entry_size = entry_sizes[i]; - max_index = max_indices[i]; - base_addr = entries[i]; + verify_clean(); + verify_unprotected(); - HDassert( base_addr ); + if ( pass ) { PASSED(); } else { H5_FAILED(); } - for ( j = 0; j <= max_index; j++ ) - { - /* one can argue that we should fill the header with garbage. - * If this is desired, we can simply comment out the header - * initialization - the headers will be full of garbage soon - * enough. - */ - - base_addr[j].header.addr = (haddr_t)0; - base_addr[j].header.size = (size_t)0; - base_addr[j].header.type = NULL; - base_addr[j].header.is_dirty = FALSE; - base_addr[j].header.is_protected = FALSE; - base_addr[j].header.next = NULL; - base_addr[j].header.prev = NULL; - base_addr[j].header.aux_next = NULL; - base_addr[j].header.aux_prev = NULL; - - base_addr[j].self = &(base_addr[j]); - base_addr[j].addr = addr; - base_addr[j].at_main_addr = TRUE; - base_addr[j].main_addr = addr; - base_addr[j].alt_addr = alt_addr; - base_addr[j].size = entry_size; - base_addr[j].type = i; - base_addr[j].index = j; - base_addr[j].reads = 0; - base_addr[j].writes = 0; - base_addr[j].is_dirty = FALSE; - base_addr[j].is_protected = FALSE; - - base_addr[j].loaded = FALSE; - base_addr[j].cleared = FALSE; - base_addr[j].flushed = FALSE; - base_addr[j].destroyed = FALSE; - - addr += (haddr_t)entry_size; - alt_addr += (haddr_t)entry_size; - } - } - - return; - -} /* reset_entries() */ + if ( ! pass ) + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); + +} /* smoke_check_4() */ /*------------------------------------------------------------------------- - * Function: verify_clean - * - * Purpose: Verify that all cache entries are marked as clean. If any - * are not, set pass to FALSE. + * Function: smoke_check_5() * - * Do nothing if pass is FALSE on entry. + * Purpose: A basic functional test on a cache with automatic cache + * resizing enabled, with inserts in the mix, along with + * repeated protects and unprotects. All entries are marked + * as clean. * * Return: void * * Programmer: John Mainzer - * 6/10/04 + * 10/14/04 * * Modifications: * + * JRM -- 1/18/05 + * Added code to skip this test if the skip_long_tests global + * is true. + * *------------------------------------------------------------------------- */ static void -verify_clean(void) - +smoke_check_5(void) { - int i; - int j; - int dirty_count = 0; - int32_t max_index; - test_entry_t * base_addr; + const char * fcn_name = "smoke_check_5"; + herr_t result; + hbool_t show_progress = FALSE; + hbool_t dirty_inserts = FALSE; + int dirty_unprotects = FALSE; + hbool_t display_stats = FALSE; + int32_t max_index = 1024; + int mile_stone = 1; + H5C_t * cache_ptr = NULL; + H5C_auto_size_ctl_t auto_size_ctl = + { + /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, +#if 1 + /* H5C_auto_resize_report_fcn rpt_fcn = */ NULL, +#else + /* H5C_auto_resize_report_fcn rpt_fcn = */ H5C_def_auto_resize_rpt_fcn, +#endif + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (2 * 1024 * 1024), - if ( pass ) { + /* double min_clean_fraction = */ 0.1, - for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ ) - { - max_index = max_indices[i]; - base_addr = entries[i]; + /* size_t max_size = */ (32 * 1024 * 1025), + /* size_t min_size = */ (512 * 1024), - HDassert( base_addr ); + /* int64_t epoch_length = */ 50000, - for ( j = 0; j <= max_index; j++ ) - { - if ( ( base_addr[j].header.is_dirty ) || ( base_addr[j].is_dirty ) ) { - dirty_count++; - } - } - } + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - if ( dirty_count > 0 ) { + /* double lower_hr_threshold = */ 0.75, - pass = FALSE; - failure_mssg = "verify_clean() found dirty entry(s)."; - } - } + /* double increment = */ 2.0, - return; + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), -} /* verify_clean() */ - -/*------------------------------------------------------------------------- - * Function: verify_unprotected - * - * Purpose: Verify that no cache entries are marked as protected. If - * any are, set pass to FALSE. - * - * Do nothing if pass is FALSE on entry. - * - * Return: void - * - * Programmer: John Mainzer - * 6/10/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, -static void -verify_unprotected(void) + /* double upper_hr_threshold = */ 0.995, -{ - int i; - int j; - int protected_count = 0; - int32_t max_index; - test_entry_t * base_addr; + /* double decrement = */ 0.9, - if ( pass ) { + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), - for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ ) - { - max_index = max_indices[i]; - base_addr = entries[i]; + /* int32_t epochs_before_eviction = */ 3, - HDassert( base_addr ); + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.5 + }; - for ( j = 0; j <= max_index; j++ ) - { - HDassert( base_addr[j].header.is_protected == - base_addr[j].is_protected ); + TESTING("smoke check #5 -- all clean, ins, prot, unprot, AR cache 1"); - if ( ( base_addr[j].header.is_protected ) || - ( base_addr[j].is_protected ) ) { + if ( skip_long_tests ) { - protected_count++; - } - } - } + SKIPPED(); - if ( protected_count > 0 ) { + HDfprintf(stdout, " Long tests disabled.\n"); - pass = FALSE; - failure_mssg = "verify_unprotected() found protected entry(s)."; - } + return; } - return; - -} /* verify_unprotected() */ - - -/*------------------------------------------------------------------------- - * Function: setup_cache() - * - * Purpose: Allocate a cache of the desired size and configure it for - * use in the test bed. Return a pointer to the new cache - * structure. - * - * Return: Pointer to new cache, or NULL on failure. - * - * Programmer: John Mainzer - * 6/11/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static H5C_t * -setup_cache(size_t max_cache_size, - size_t min_clean_size) -{ - H5C_t * cache_ptr = NULL; - - cache_ptr = H5C_create(max_cache_size, - min_clean_size, - (NUMBER_OF_ENTRY_TYPES - 1), - (const char **)entry_type_names, - check_write_permitted, - TRUE, - NULL, - NULL); - - if ( cache_ptr == NULL ) { - - pass = FALSE; - failure_mssg = "H5C_create() returned NULL."; - - } else { + if ( run_full_test ) { - H5C_set_skip_flags(cache_ptr, TRUE, TRUE); + max_index = (10 * 1024) - 1; } - return(cache_ptr); + pass = TRUE; -} /* setup_cache() */ + if ( show_progress ) /* 1 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - -/*------------------------------------------------------------------------- - * Function: takedown_cache() - * - * Purpose: Flush the specified cache and disable it. If requested, - * dump stats first. If pass is FALSE, do nothing. - * - * Return: void - * - * Programmer: John Mainzer - * 6/11/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ + reset_entries(); -static void -takedown_cache(H5C_t * cache_ptr, - hbool_t dump_stats, - hbool_t dump_detailed_stats) -{ - HDassert(cache_ptr); + if ( show_progress ) /* 2 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); if ( pass ) { - if ( dump_stats ) { + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - H5C_stats(cache_ptr, "test cache", dump_detailed_stats); - } + if ( result != SUCCEED ) { - H5C_dest(NULL, -1, -1, cache_ptr); + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n"; + } } - return; + if ( show_progress ) /* 3 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -} /* takedown_cache() */ + hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ FALSE, + /* dirty_inserts */ dirty_inserts); - -/*------------------------------------------------------------------------- - * Function: flush_cache() - * - * Purpose: Flush the specified cache, destroying all entries if - requested. If requested, dump stats first. - * - * Return: void - * - * Programmer: John Mainzer - * 6/23/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ + if ( show_progress ) /* 4 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -static void -flush_cache(H5C_t * cache_ptr, - hbool_t destroy_entries, - hbool_t dump_stats, - hbool_t dump_detailed_stats) -{ - herr_t result = 0; + hl_row_major_scan_backward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ FALSE, + /* dirty_inserts */ dirty_inserts); - HDassert(cache_ptr); + if ( show_progress ) /* 5 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - verify_unprotected(); + hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts); - if ( pass ) { + if ( show_progress ) /* 6 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( destroy_entries ) { + /* flush and destroy all entries in the cache: */ - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, - H5C__FLUSH_INVALIDATE_FLAG); + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ TRUE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); - } else { + if ( show_progress ) /* 7 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, - H5C__NO_FLAGS_SET); - } - } + hl_col_major_scan_forward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); + + if ( show_progress ) /* 8 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( dump_stats ) { + /* flush all entries in the cache: */ - H5C_stats(cache_ptr, "test cache", dump_detailed_stats); - } + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ FALSE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); - if ( result < 0 ) { + if ( show_progress ) /* 9 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - pass = FALSE; - failure_mssg = "error in H5C_flush_cache()."; - } + hl_col_major_scan_backward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); + + if ( show_progress ) /* 10 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + takedown_cache(cache_ptr, display_stats, TRUE); + + if ( show_progress ) /* 11 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + verify_clean(); + verify_unprotected(); + + if ( pass ) { PASSED(); } else { H5_FAILED(); } - return; + if ( ! pass ) + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); -} /* flush_cache() */ +} /* smoke_check_5() */ /*------------------------------------------------------------------------- - * Function: insert_entry() - * - * Purpose: Insert the entry indicated by the type and index. Mark - * it clean or dirty as indicated. - * - * Note that I don't see much practical use for inserting - * a clean entry, but the interface permits it so we should - * test it. + * Function: smoke_check_6() * - * Do nothing if pass is false. + * Purpose: A basic functional test on a cache with automatic cache + * resizing enabled, with inserts in the mix, along with + * repeated protects and unprotects. About one half of all + * entries are marked as dirty. * * Return: void * * Programmer: John Mainzer - * 6/16/04 + * 10/25/04 * * Modifications: * - * JRM -- 1/13/05 - * Updated function for the flags parameter in - * H5C_insert_entry(), and to allow access to this parameter. - * - * JRM -- 6/17/05 - * The interface no longer permits clean inserts. - * Accordingly, the dirty parameter is no longer meaningfull. + * JRM -- 1/18/05 + * Added code to skip this test if the skip_long_tests global + * is true. * *------------------------------------------------------------------------- */ static void -insert_entry(H5C_t * cache_ptr, - int32_t type, - int32_t idx, - hbool_t UNUSED dirty, - unsigned int flags) +smoke_check_6(void) { + const char * fcn_name = "smoke_check_6"; herr_t result; - test_entry_t * base_addr; - test_entry_t * entry_ptr; - - if ( pass ) { - - HDassert( cache_ptr ); - HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); - HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); - - base_addr = entries[type]; - entry_ptr = &(base_addr[idx]); + hbool_t show_progress = FALSE; + hbool_t dirty_inserts = TRUE; + int dirty_unprotects = FALSE; + hbool_t display_stats = FALSE; + int mile_stone = 1; + int32_t max_index = 1024; + H5C_t * cache_ptr = NULL; + H5C_auto_size_ctl_t auto_size_ctl = + { + /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, +#if 1 + /* H5C_auto_resize_report_fcn rpt_fcn = */ NULL, +#else + /* H5C_auto_resize_report_fcn rpt_fcn = */ H5C_def_auto_resize_rpt_fcn, +#endif + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (2 * 1024 * 1024), - HDassert( entry_ptr->index == idx ); - HDassert( entry_ptr->type == type ); - HDassert( entry_ptr == entry_ptr->self ); - HDassert( !(entry_ptr->is_protected) ); + /* double min_clean_fraction = */ 0.1, - entry_ptr->is_dirty = TRUE; + /* size_t max_size = */ (32 * 1024 * 1025), + /* size_t min_size = */ (512 * 1024), - result = H5C_insert_entry(NULL, -1, -1, cache_ptr, &(types[type]), - entry_ptr->addr, (void *)entry_ptr, flags); + /* int64_t epoch_length = */ 50000, - if ( ( result < 0 ) || - ( entry_ptr->header.is_protected ) || - ( entry_ptr->header.type != &(types[type]) ) || - ( entry_ptr->size != entry_ptr->header.size ) || - ( entry_ptr->addr != entry_ptr->header.addr ) ) { - pass = FALSE; - failure_mssg = "error in H5C_insert()."; + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, -#if 0 - /* This is useful debugging code. Lets keep it around. */ + /* double lower_hr_threshold = */ 0.75, - HDfprintf(stdout, "result = %d\n", (int)result); - HDfprintf(stdout, "entry_ptr->header.is_protected = %d\n", - (int)(entry_ptr->header.is_protected)); - HDfprintf(stdout, "entry_ptr->header.type != &(types[type]) = %d\n", - (int)(entry_ptr->header.type != &(types[type]))); - HDfprintf(stdout, - "entry_ptr->size != entry_ptr->header.size = %d\n", - (int)(entry_ptr->size != entry_ptr->header.size)); - HDfprintf(stdout, - "entry_ptr->addr != entry_ptr->header.addr = %d\n", - (int)(entry_ptr->addr != entry_ptr->header.addr)); -#endif - } + /* double increment = */ 2.0, - HDassert( entry_ptr->header.is_dirty ); - HDassert( ((entry_ptr->header).type)->id == type ); - } + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), - return; -} /* insert_entry() */ + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, - -/*------------------------------------------------------------------------- - * Function: rename_entry() - * - * Purpose: Rename 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. - * - * Return: void - * - * Programmer: John Mainzer - * 6/21/04 - * - * Modifications: - * - * JRM -- 6/17/05 - * Updated code to reflect the fact that renames automatically - * dirty entries. - * - *------------------------------------------------------------------------- - */ + /* double upper_hr_threshold = */ 0.995, -static void -rename_entry(H5C_t * cache_ptr, - int32_t type, - int32_t idx, - hbool_t main_addr) -{ - herr_t result; - hbool_t done = TRUE; /* will set to FALSE if we have work to do */ - haddr_t old_addr = HADDR_UNDEF; - haddr_t new_addr = HADDR_UNDEF; - test_entry_t * base_addr; - test_entry_t * entry_ptr; + /* double decrement = */ 0.9, - HDassert( cache_ptr ); - HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); - HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), - base_addr = entries[type]; - entry_ptr = &(base_addr[idx]); + /* int32_t epochs_before_eviction = */ 3, - HDassert( entry_ptr->index == idx ); - HDassert( entry_ptr->type == type ); - HDassert( entry_ptr == entry_ptr->self ); - HDassert( !(entry_ptr->is_protected) ); - HDassert( !(entry_ptr->header.is_protected) ); + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.05 + }; - if ( entry_ptr->at_main_addr && !main_addr ) { + TESTING("smoke check #6 -- ~1/2 dirty, ins, prot, unprot, AR cache 1"); - /* rename to alt addr */ + pass = TRUE; - HDassert( entry_ptr->addr == entry_ptr->main_addr ); + if ( skip_long_tests ) { - done = FALSE; - old_addr = entry_ptr->addr; - new_addr = entry_ptr->alt_addr; + SKIPPED(); - } else if ( !(entry_ptr->at_main_addr) && main_addr ) { + HDfprintf(stdout, " Long tests disabled.\n"); - /* rename to main addr */ + return; + } - HDassert( entry_ptr->addr == entry_ptr->alt_addr ); + if ( run_full_test ) { - done = FALSE; - old_addr = entry_ptr->addr; - new_addr = entry_ptr->main_addr; + max_index = (10 * 1024) - 1; } - if ( ! done ) { + if ( show_progress ) /* 1 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - entry_ptr->is_dirty = TRUE; + reset_entries(); - result = H5C_rename_entry(cache_ptr, &(types[type]), - old_addr, new_addr); - } + if ( show_progress ) /* 2 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( ! done ) { + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); - if ( ( result < 0 ) || ( entry_ptr->header.addr != new_addr ) ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "error in H5C_rename_entry()."; + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - } else { + if ( result != SUCCEED ) { - entry_ptr->addr = new_addr; - entry_ptr->at_main_addr = main_addr; + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n"; } } - HDassert( ((entry_ptr->header).type)->id == type ); - - HDassert( entry_ptr->header.is_dirty ); - HDassert( entry_ptr->is_dirty ); - - return; + if ( show_progress ) /* 3 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -} /* rename_entry() */ + hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ FALSE, + /* dirty_inserts */ dirty_inserts); - -/*------------------------------------------------------------------------- - * Function: protect_entry() - * - * Purpose: Protect the entry indicated by the type and index. - * - * Do nothing if pass is FALSE on entry. - * - * Return: void - * - * Programmer: John Mainzer - * 6/11/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ + if ( show_progress ) /* 4 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -static void -protect_entry(H5C_t * cache_ptr, - int32_t type, - int32_t idx) -{ - /* const char * fcn_name = "protect_entry()"; */ - test_entry_t * base_addr; - test_entry_t * entry_ptr; - H5C_cache_entry_t * cache_entry_ptr; + hl_row_major_scan_backward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ FALSE, + /* dirty_inserts */ dirty_inserts); - if ( pass ) { + if ( show_progress ) /* 5 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - HDassert( cache_ptr ); - HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); - HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); + hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts); - base_addr = entries[type]; - entry_ptr = &(base_addr[idx]); + if ( show_progress ) /* 6 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - HDassert( entry_ptr->index == idx ); - HDassert( entry_ptr->type == type ); - HDassert( entry_ptr == entry_ptr->self ); - HDassert( !(entry_ptr->is_protected) ); + /* flush and destroy all entries in the cache: */ - cache_entry_ptr = H5C_protect(NULL, -1, -1, cache_ptr, &(types[type]), - entry_ptr->addr, NULL, NULL); + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ TRUE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); - if ( ( cache_entry_ptr != (void *)entry_ptr ) || - ( !(entry_ptr->header.is_protected) ) || - ( entry_ptr->header.type != &(types[type]) ) || - ( entry_ptr->size != entry_ptr->header.size ) || - ( entry_ptr->addr != entry_ptr->header.addr ) ) { + if ( show_progress ) /* 7 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); -#if 0 - /* I've written the following debugging code several times - * now. Lets keep it around so I don't have to write it - * again. - * - JRM - */ - HDfprintf(stdout, "( cache_entry_ptr != (void *)entry_ptr ) = %d\n", - (int)( cache_entry_ptr != (void *)entry_ptr )); - HDfprintf(stdout, "cache_entry_ptr = 0x%lx, entry_ptr = 0x%lx\n", - (long)cache_entry_ptr, (long)entry_ptr); - HDfprintf(stdout, "entry_ptr->header.is_protected = %d\n", - (int)(entry_ptr->header.is_protected)); - HDfprintf(stdout, - "( entry_ptr->header.type != &(types[type]) ) = %d\n", - (int)( entry_ptr->header.type != &(types[type]) )); - HDfprintf(stdout, - "entry_ptr->size = %d, entry_ptr->header.size = %d\n", - (int)(entry_ptr->size), (int)(entry_ptr->header.size)); - HDfprintf(stdout, - "entry_ptr->addr = %d, entry_ptr->header.addr = %d\n", - (int)(entry_ptr->addr), (int)(entry_ptr->header.addr)); -#endif - pass = FALSE; - failure_mssg = "error in H5C_protect()."; + hl_col_major_scan_forward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); - } else { + if ( show_progress ) /* 8 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - entry_ptr->is_protected = TRUE; + /* flush all entries in the cache: */ - } + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ FALSE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); - HDassert( ((entry_ptr->header).type)->id == type ); - } + if ( show_progress ) /* 9 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - return; - -} /* protect_entry() */ - - -/*------------------------------------------------------------------------- - * Function: unprotect_entry() - * - * Purpose: Unprotect the entry indicated by the type and index. - * - * Do nothing if pass is FALSE on entry. - * - * Return: void - * - * Programmer: John Mainzer - * 6/12/04 - * - * Modifications: - * - * JRM -- 1/7/05 - * Updated for the replacement of the deleted parameter in - * H5C_unprotect() with the new flags parameter. - * - * JRM - 6/17/05 - * Modified function to use the new dirtied parameter of - * H5C_unprotect(). - * - * JRM -- 9/8/05 - * Update for new entry size parameter in H5C_unprotect(). - * We don't use them here for now. - * - *------------------------------------------------------------------------- - */ - -#define NO_CHANGE -1 - -static void -unprotect_entry(H5C_t * cache_ptr, - int32_t type, - int32_t idx, - int dirty, - unsigned int flags) -{ - /* const char * fcn_name = "unprotect_entry()"; */ - herr_t result; - test_entry_t * base_addr; - test_entry_t * entry_ptr; - - if ( pass ) { - - HDassert( cache_ptr ); - HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); - HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); - - 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->header.is_protected ); - HDassert( entry_ptr->is_protected ); - - if ( ( dirty == TRUE ) || ( dirty == FALSE ) ) { - - flags |= (dirty ? H5AC__DIRTIED_FLAG : H5AC__NO_FLAGS_SET); - entry_ptr->is_dirty = (entry_ptr->is_dirty || dirty); - } - - result = H5C_unprotect(NULL, -1, -1, cache_ptr, &(types[type]), - entry_ptr->addr, (void *)entry_ptr, - flags, 0); - - if ( ( result < 0 ) || - ( entry_ptr->header.is_protected ) || - ( entry_ptr->header.type != &(types[type]) ) || - ( entry_ptr->size != entry_ptr->header.size ) || - ( entry_ptr->addr != entry_ptr->header.addr ) ) { + hl_col_major_scan_backward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); - pass = FALSE; - failure_mssg = "error in H5C_unprotect()."; + if ( show_progress ) /* 10 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - } - else - { - entry_ptr->is_protected = FALSE; - } + takedown_cache(cache_ptr, display_stats, TRUE); - HDassert( ((entry_ptr->header).type)->id == type ); + if ( show_progress ) /* 11 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( ( flags & H5AC__DIRTIED_FLAG ) != 0 - && ( (flags & H5C__DELETED_FLAG) == 0 ) ) { + verify_clean(); + verify_unprotected(); - HDassert( entry_ptr->header.is_dirty ); - HDassert( entry_ptr->is_dirty ); - } - } + if ( pass ) { PASSED(); } else { H5_FAILED(); } - return; + if ( ! pass ) + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); -} /* unprotect_entry() */ +} /* smoke_check_6() */ /*------------------------------------------------------------------------- - * Function: row_major_scan_forward() + * Function: smoke_check_7() * - * Purpose: Do a sequence of inserts, protects, unprotects, renames, - * destroys while scanning through the set of entries. If - * pass is false on entry, do nothing. + * Purpose: A basic functional test on a cache with automatic cache + * resizing enabled, with inserts in the mix, along with + * repeated protects and unprotects. All entries are marked + * as clean. * * Return: void * * Programmer: John Mainzer - * 6/12/04 + * 12/2/04 * * Modifications: * + * JRM -- 1/18/05 + * Added code to skip this test if the skip_long_tests global + * is true. + * *------------------------------------------------------------------------- */ static void -row_major_scan_forward(H5C_t * cache_ptr, - int32_t lag, - hbool_t verbose, - hbool_t reset_stats, - hbool_t display_stats, - hbool_t display_detailed_stats, - hbool_t do_inserts, - hbool_t dirty_inserts, - hbool_t do_renames, - hbool_t rename_to_main_addr, - hbool_t do_destroys, - int dirty_destroys, - int dirty_unprotects) +smoke_check_7(void) { - const char * fcn_name = "row_major_scan_forward"; - int32_t type; - int32_t idx; - - if ( verbose ) - HDfprintf(stdout, "%s(): entering.\n", fcn_name); - - HDassert( lag > 5 ); - - type = 0; - - if ( ( pass ) && ( reset_stats ) ) { - - H5C_stats__reset(cache_ptr); - } - - while ( ( pass ) && ( type < NUMBER_OF_ENTRY_TYPES ) ) + const char * fcn_name = "smoke_check_7"; + herr_t result; + hbool_t show_progress = FALSE; + hbool_t dirty_inserts = FALSE; + int dirty_unprotects = FALSE; + hbool_t display_stats = FALSE; + int mile_stone = 1; + int32_t max_index = 1024; + H5C_t * cache_ptr = NULL; + H5C_auto_size_ctl_t auto_size_ctl = { - idx = -lag; + /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, +#if 1 + /* H5C_auto_resize_report_fcn rpt_fcn = */ NULL, +#else + /* H5C_auto_resize_report_fcn rpt_fcn = */ H5C_def_auto_resize_rpt_fcn, +#endif + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (2 * 1024 * 1024), - while ( ( pass ) && ( idx <= (max_indices[type] + lag) ) ) - { - if ( ( pass ) && ( do_inserts ) && ( (idx + lag) >= 0 ) && - ( (idx + lag) <= max_indices[type] ) && - ( ((idx + lag) % 2) == 0 ) && - ( ! entry_in_cache(cache_ptr, type, (idx + lag)) ) ) { + /* double min_clean_fraction = */ 0.1, - if ( verbose ) - HDfprintf(stdout, "(i, %d, %d) ", type, (idx + lag)); + /* size_t max_size = */ (32 * 1024 * 1025), + /* size_t min_size = */ (512 * 1024), - insert_entry(cache_ptr, type, (idx + lag), dirty_inserts, - H5C__NO_FLAGS_SET); - } + /* int64_t epoch_length = */ 100000, - if ( ( pass ) && ( (idx + lag - 1) >= 0 ) && - ( (idx + lag - 1) <= max_indices[type] ) && - ( ( (idx + lag - 1) % 3 ) == 0 ) ) { + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - if ( verbose ) - HDfprintf(stdout, "(p, %d, %d) ", type, (idx + lag - 1)); + /* double lower_hr_threshold = */ 0.75, - protect_entry(cache_ptr, type, (idx + lag - 1)); - } + /* double increment = */ 2.0, - if ( ( pass ) && ( (idx + lag - 2) >= 0 ) && - ( (idx + lag - 2) <= max_indices[type] ) && - ( ( (idx + lag - 2) % 3 ) == 0 ) ) { + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (8 * 1024 * 1024), - if ( verbose ) - HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag - 2)); - unprotect_entry(cache_ptr, type, idx+lag-2, NO_CHANGE, - H5C__NO_FLAGS_SET); - } + /* enum H5C_cache_decr_mode decr_mode = */ + H5C_decr__age_out_with_threshold, + /* double upper_hr_threshold = */ 0.995, - if ( ( pass ) && ( do_renames ) && ( (idx + lag - 2) >= 0 ) && - ( (idx + lag - 2) <= max_indices[type] ) && - ( ( (idx + lag - 2) % 3 ) == 0 ) ) { + /* double decrement = */ 0.9, - rename_entry(cache_ptr, type, (idx + lag - 2), - rename_to_main_addr); - } + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), + /* int32_t epochs_before_eviction = */ 3, - if ( ( pass ) && ( (idx + lag - 3) >= 0 ) && - ( (idx + lag - 3) <= max_indices[type] ) && - ( ( (idx + lag - 3) % 5 ) == 0 ) ) { + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.1 + }; - if ( verbose ) - HDfprintf(stdout, "(p, %d, %d) ", type, (idx + lag - 3)); + TESTING("smoke check #7 -- all clean, ins, prot, unprot, AR cache 2"); - protect_entry(cache_ptr, type, (idx + lag - 3)); - } + if ( skip_long_tests ) { - if ( ( pass ) && ( (idx + lag - 5) >= 0 ) && - ( (idx + lag - 5) <= max_indices[type] ) && - ( ( (idx + lag - 5) % 5 ) == 0 ) ) { + SKIPPED(); - if ( verbose ) - HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag - 5)); + HDfprintf(stdout, " Long tests disabled.\n"); - unprotect_entry(cache_ptr, type, idx+lag-5, NO_CHANGE, - H5C__NO_FLAGS_SET); - } + return; + } + + if ( run_full_test ) { - if ( ( pass ) && ( idx >= 0 ) && ( idx <= max_indices[type] ) ) { + max_index = (10 * 1024) - 1; + } - if ( verbose ) - HDfprintf(stdout, "(p, %d, %d) ", type, idx); + pass = TRUE; - protect_entry(cache_ptr, type, idx); - } + if ( show_progress ) /* 1 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + reset_entries(); - if ( ( pass ) && ( (idx - lag + 2) >= 0 ) && - ( (idx - lag + 2) <= max_indices[type] ) && - ( ( (idx - lag + 2) % 7 ) == 0 ) ) { + if ( show_progress ) /* 2 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( verbose ) - HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag + 2)); + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); - unprotect_entry(cache_ptr, type, idx-lag+2, NO_CHANGE, - H5C__NO_FLAGS_SET); - } + if ( pass ) { - if ( ( pass ) && ( (idx - lag + 1) >= 0 ) && - ( (idx - lag + 1) <= max_indices[type] ) && - ( ( (idx - lag + 1) % 7 ) == 0 ) ) { + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - if ( verbose ) - HDfprintf(stdout, "(p, %d, %d) ", type, (idx - lag + 1)); + if ( result != SUCCEED ) { - protect_entry(cache_ptr, type, (idx - lag + 1)); - } + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n"; + } + } + if ( show_progress ) /* 3 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( do_destroys ) { + hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ FALSE, + /* dirty_inserts */ dirty_inserts); - if ( ( pass ) && ( (idx - lag) >= 0 ) && - ( ( idx - lag) <= max_indices[type] ) ) { + if ( show_progress ) /* 4 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - switch ( (idx - lag) %4 ) { + hl_row_major_scan_backward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ FALSE, + /* dirty_inserts */ dirty_inserts); - case 0: /* we just did an insert */ - unprotect_entry(cache_ptr, type, idx - lag, - NO_CHANGE, H5C__NO_FLAGS_SET); - break; + if ( show_progress ) /* 5 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - case 1: - if ( (entries[type])[idx-lag].is_dirty ) { + hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts); - unprotect_entry(cache_ptr, type, idx - lag, - NO_CHANGE, H5C__NO_FLAGS_SET); - } else { + if ( show_progress ) /* 6 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - unprotect_entry(cache_ptr, type, idx - lag, - dirty_unprotects, - H5C__NO_FLAGS_SET); - } - break; + /* flush and destroy all entries in the cache: */ - case 2: /* we just did an insrt */ - unprotect_entry(cache_ptr, type, idx - lag, - NO_CHANGE, H5C__DELETED_FLAG); - break; + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ TRUE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); - case 3: - if ( (entries[type])[idx-lag].is_dirty ) { + if ( show_progress ) /* 7 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - unprotect_entry(cache_ptr, type, idx - lag, - NO_CHANGE, H5C__DELETED_FLAG); - } else { + hl_col_major_scan_forward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); - unprotect_entry(cache_ptr, type, idx - lag, - dirty_destroys, - H5C__DELETED_FLAG); - } - break; + if ( show_progress ) /* 8 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - default: - HDassert(0); /* this can't happen... */ - break; - } - } + /* flush all entries in the cache: */ - } else { + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ FALSE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); - if ( ( pass ) && ( (idx - lag) >= 0 ) && - ( ( idx - lag) <= max_indices[type] ) ) { + if ( show_progress ) /* 9 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( verbose ) - HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag)); + hl_col_major_scan_backward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); - unprotect_entry(cache_ptr, type, idx - lag, - dirty_unprotects, H5C__NO_FLAGS_SET); - } - } + if ( show_progress ) /* 10 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( verbose ) - HDfprintf(stdout, "\n"); + takedown_cache(cache_ptr, display_stats, TRUE); - idx++; - } - type++; - } + if ( show_progress ) /* 11 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( ( pass ) && ( display_stats ) ) { + verify_clean(); + verify_unprotected(); - H5C_stats(cache_ptr, "test cache", display_detailed_stats); - } + if ( pass ) { PASSED(); } else { H5_FAILED(); } - return; + if ( ! pass ) + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); -} /* row_major_scan_forward() */ +} /* smoke_check_7() */ /*------------------------------------------------------------------------- - * Function: hl_row_major_scan_forward() - * - * Purpose: Do a high locality sequence of inserts, protects, and - * unprotects while scanning through the set of entries. - * If pass is false on entry, do nothing. - * - * Return: void + * Function: smoke_check_8() * - * Programmer: John Mainzer - * 10/21/04 - * - * Modifications: - * - * JRM -- 1/21/05 - * Added the max_index parameter to allow the caller to - * throttle the size of the inner loop, and thereby the - * execution time of the function. - * - *------------------------------------------------------------------------- - */ - -static void -hl_row_major_scan_forward(H5C_t * cache_ptr, - int32_t max_index, - hbool_t verbose, - hbool_t reset_stats, - hbool_t display_stats, - hbool_t display_detailed_stats, - hbool_t do_inserts, - hbool_t dirty_inserts) -{ - const char * fcn_name = "hl_row_major_scan_forward"; - int32_t type; - int32_t idx; - int32_t i; - int32_t lag = 100; - int32_t local_max_index; - - if ( verbose ) - HDfprintf(stdout, "%s(): entering.\n", fcn_name); - - HDassert( lag > 5 ); - HDassert( max_index >= 200 ); - HDassert( max_index <= MAX_ENTRIES ); - - type = 0; - - if ( ( pass ) && ( reset_stats ) ) { - - H5C_stats__reset(cache_ptr); - } - - while ( ( pass ) && ( type < NUMBER_OF_ENTRY_TYPES ) ) - { - idx = -lag; - - local_max_index = MIN(max_index, max_indices[type]); - - while ( ( pass ) && ( idx <= (local_max_index + lag) ) ) - { - if ( ( pass ) && ( do_inserts ) && ( (idx + lag) >= 0 ) && - ( (idx + lag) <= max_indices[type] ) && - ( ((idx + lag) % 2) == 0 ) && - ( ! entry_in_cache(cache_ptr, type, (idx + lag)) ) ) { - - if ( verbose ) - HDfprintf(stdout, "(i, %d, %d) ", type, (idx + lag)); - - insert_entry(cache_ptr, type, (idx + lag), dirty_inserts, - H5C__NO_FLAGS_SET); - } - - i = idx; - - while ( ( pass ) && ( i >= idx - lag ) && ( i >= 0 ) ) - { - if ( ( pass ) && ( i >= 0 ) && ( i <= local_max_index ) ) { - - if ( verbose ) - HDfprintf(stdout, "(p, %d, %d) ", type, i); - - protect_entry(cache_ptr, type, i); - - if ( verbose ) - HDfprintf(stdout, "(u, %d, %d) ", type, i); - - unprotect_entry(cache_ptr, type, i, NO_CHANGE, - H5C__NO_FLAGS_SET); - } - i--; - } - - if ( verbose ) - HDfprintf(stdout, "\n"); - - idx++; - } - type++; - } - - if ( ( pass ) && ( display_stats ) ) { - - H5C_stats(cache_ptr, "test cache", display_detailed_stats); - } - - return; - -} /* hl_row_major_scan_forward() */ - - -/*------------------------------------------------------------------------- - * Function: row_major_scan_backward() - * - * Purpose: Do a sequence of inserts, protects, unprotects, renames, - * destroys while scanning backwards through the set of - * entries. If pass is false on entry, do nothing. + * Purpose: A basic functional test on a cache with automatic cache + * resizing enabled, with inserts in the mix, along with + * repeated protects and unprotects. About one half of all + * entries are marked as dirty. * * Return: void * * Programmer: John Mainzer - * 6/12/04 + * 10/25/04 * * Modifications: * + * JRM -- 1/18/05 + * Added code to skip this test if the skip_long_tests global + * is true. + * *------------------------------------------------------------------------- */ static void -row_major_scan_backward(H5C_t * cache_ptr, - int32_t lag, - hbool_t verbose, - hbool_t reset_stats, - hbool_t display_stats, - hbool_t display_detailed_stats, - hbool_t do_inserts, - hbool_t dirty_inserts, - hbool_t do_renames, - hbool_t rename_to_main_addr, - hbool_t do_destroys, - int dirty_destroys, - int dirty_unprotects) +smoke_check_8(void) { - const char * fcn_name = "row_major_scan_backward"; - int32_t type; - int32_t idx; - - if ( verbose ) - HDfprintf(stdout, "%s(): Entering.\n", fcn_name); - - HDassert( lag > 5 ); - - type = NUMBER_OF_ENTRY_TYPES - 1; - - if ( ( pass ) && ( reset_stats ) ) { + const char * fcn_name = "smoke_check_8"; + herr_t result; + hbool_t show_progress = FALSE; + hbool_t dirty_inserts = TRUE; + int dirty_unprotects = FALSE; + hbool_t display_stats = FALSE; + int mile_stone = 1; + int32_t max_index = 1024; + H5C_t * cache_ptr = NULL; + H5C_auto_size_ctl_t auto_size_ctl = + { + /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, +#if 1 + /* H5C_auto_resize_report_fcn rpt_fcn = */ NULL, +#else + /* H5C_auto_resize_report_fcn rpt_fcn = */ H5C_def_auto_resize_rpt_fcn, +#endif + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (2 * 1024 * 1024), - H5C_stats__reset(cache_ptr); - } + /* double min_clean_fraction = */ 0.1, - while ( ( pass ) && ( type >= 0 ) ) - { - idx = max_indices[type] + lag; + /* size_t max_size = */ (32 * 1024 * 1025), + /* size_t min_size = */ (512 * 1024), - while ( ( pass ) && ( idx >= -lag ) ) - { - if ( ( pass ) && ( do_inserts ) && ( (idx - lag) >= 0 ) && - ( (idx - lag) <= max_indices[type] ) && - ( ((idx - lag) % 2) == 1 ) && - ( ! entry_in_cache(cache_ptr, type, (idx - lag)) ) ) { + /* int64_t epoch_length = */ 100000, - if ( verbose ) - HDfprintf(stdout, "(i, %d, %d) ", type, (idx - lag)); - insert_entry(cache_ptr, type, (idx - lag), dirty_inserts, - H5C__NO_FLAGS_SET); - } + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, + /* double lower_hr_threshold = */ 0.75, - if ( ( pass ) && ( (idx - lag + 1) >= 0 ) && - ( (idx - lag + 1) <= max_indices[type] ) && - ( ( (idx - lag + 1) % 3 ) == 0 ) ) { + /* double increment = */ 2.0, - if ( verbose ) - HDfprintf(stdout, "(p, %d, %d) ", type, (idx - lag + 1)); + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), - protect_entry(cache_ptr, type, (idx - lag + 1)); - } - if ( ( pass ) && ( (idx - lag + 2) >= 0 ) && - ( (idx - lag + 2) <= max_indices[type] ) && - ( ( (idx - lag + 2) % 3 ) == 0 ) ) { + /* enum H5C_cache_decr_mode decr_mode = */ + H5C_decr__age_out_with_threshold, - if ( verbose ) - HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag + 2)); + /* double upper_hr_threshold = */ 0.995, - unprotect_entry(cache_ptr, type, idx-lag+2, NO_CHANGE, - H5C__NO_FLAGS_SET); - } + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), - if ( ( pass ) && ( do_renames ) && ( (idx - lag + 2) >= 0 ) && - ( (idx - lag + 2) <= max_indices[type] ) && - ( ( (idx - lag + 2) % 3 ) == 0 ) ) { + /* int32_t epochs_before_eviction = */ 3, - rename_entry(cache_ptr, type, (idx - lag + 2), - rename_to_main_addr); - } + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.1 + }; + TESTING("smoke check #8 -- ~1/2 dirty, ins, prot, unprot, AR cache 2"); - if ( ( pass ) && ( (idx - lag + 3) >= 0 ) && - ( (idx - lag + 3) <= max_indices[type] ) && - ( ( (idx - lag + 3) % 5 ) == 0 ) ) { + if ( skip_long_tests ) { - if ( verbose ) - HDfprintf(stdout, "(p, %d, %d) ", type, (idx - lag + 3)); + SKIPPED(); - protect_entry(cache_ptr, type, (idx - lag + 3)); - } + HDfprintf(stdout, " Long tests disabled.\n"); - if ( ( pass ) && ( (idx - lag + 5) >= 0 ) && - ( (idx - lag + 5) <= max_indices[type] ) && - ( ( (idx - lag + 5) % 5 ) == 0 ) ) { + return; + } - if ( verbose ) - HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag + 5)); + if ( run_full_test ) { - unprotect_entry(cache_ptr, type, idx-lag+5, NO_CHANGE, - H5C__NO_FLAGS_SET); - } + max_index = (10 * 1024) - 1; + } - if ( ( pass ) && ( idx >= 0 ) && ( idx <= max_indices[type] ) ) { + pass = TRUE; - if ( verbose ) - HDfprintf(stdout, "(p, %d, %d) ", type, idx); + if ( show_progress ) /* 1 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - protect_entry(cache_ptr, type, idx); - } + reset_entries(); + if ( show_progress ) /* 2 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( ( pass ) && ( (idx + lag - 2) >= 0 ) && - ( (idx + lag - 2) <= max_indices[type] ) && - ( ( (idx + lag - 2) % 7 ) == 0 ) ) { + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); - if ( verbose ) - HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag - 2)); + if ( pass ) { - unprotect_entry(cache_ptr, type, idx+lag-2, NO_CHANGE, - H5C__NO_FLAGS_SET); - } + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - if ( ( pass ) && ( (idx + lag - 1) >= 0 ) && - ( (idx + lag - 1) <= max_indices[type] ) && - ( ( (idx + lag - 1) % 7 ) == 0 ) ) { + if ( result != SUCCEED ) { - if ( verbose ) - HDfprintf(stdout, "(p, %d, %d) ", type, (idx + lag - 1)); + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n"; + } + } - protect_entry(cache_ptr, type, (idx + lag - 1)); - } + if ( show_progress ) /* 3 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ FALSE, + /* dirty_inserts */ dirty_inserts); - if ( do_destroys ) { + if ( show_progress ) /* 4 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( ( pass ) && ( (idx + lag) >= 0 ) && - ( ( idx + lag) <= max_indices[type] ) ) { + hl_row_major_scan_backward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ FALSE, + /* dirty_inserts */ dirty_inserts); - switch ( (idx + lag) %4 ) { + if ( show_progress ) /* 5 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - case 0: - if ( (entries[type])[idx+lag].is_dirty ) { + hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts); - unprotect_entry(cache_ptr, type, idx + lag, - NO_CHANGE, H5C__NO_FLAGS_SET); - } else { + if ( show_progress ) /* 6 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - unprotect_entry(cache_ptr, type, idx + lag, - dirty_unprotects, - H5C__NO_FLAGS_SET); - } - break; + /* flush and destroy all entries in the cache: */ - case 1: /* we just did an insert */ - unprotect_entry(cache_ptr, type, idx + lag, - NO_CHANGE, H5C__NO_FLAGS_SET); - break; + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ TRUE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); - case 2: - if ( (entries[type])[idx + lag].is_dirty ) { + if ( show_progress ) /* 7 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - unprotect_entry(cache_ptr, type, idx + lag, - NO_CHANGE, H5C__DELETED_FLAG); - } else { + hl_col_major_scan_forward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); - unprotect_entry(cache_ptr, type, idx + lag, - dirty_destroys, - H5C__DELETED_FLAG); - } - break; + if ( show_progress ) /* 8 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - case 3: /* we just did an insrt */ - unprotect_entry(cache_ptr, type, idx + lag, - NO_CHANGE, H5C__DELETED_FLAG); - break; + /* flush all entries in the cache: */ - default: - HDassert(0); /* this can't happen... */ - break; - } - } - } else { + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ FALSE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); - if ( ( pass ) && ( (idx + lag) >= 0 ) && - ( ( idx + lag) <= max_indices[type] ) ) { + if ( show_progress ) /* 9 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( verbose ) - HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag)); + hl_col_major_scan_backward(/* cache_ptr */ cache_ptr, + /* max_index */ max_index, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ FALSE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); - unprotect_entry(cache_ptr, type, idx + lag, - dirty_unprotects, H5C__NO_FLAGS_SET); - } - } + if ( show_progress ) /* 10 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( verbose ) - HDfprintf(stdout, "\n"); + takedown_cache(cache_ptr, display_stats, TRUE); - idx--; - } - type--; - } + if ( show_progress ) /* 11 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( ( pass ) && ( display_stats ) ) { + verify_clean(); + verify_unprotected(); - H5C_stats(cache_ptr, "test cache", display_detailed_stats); - } + if ( pass ) { PASSED(); } else { H5_FAILED(); } - return; + if ( ! pass ) + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); -} /* row_major_scan_backward() */ +} /* smoke_check_8() */ /*------------------------------------------------------------------------- - * Function: hl_row_major_scan_backward() + * Function: write_permitted_check() * - * Purpose: Do a high locality sequence of inserts, protects, and - * unprotects while scanning through the set of entries. - * If pass is false on entry, do nothing. + * Purpose: A basic test of the write permitted function. In essence, + * we load the cache up with dirty entryies, set + * write_permitted to FALSE, and then protect a bunch of + * entries. If there are any writes while write_permitted is + * FALSE, the test will fail. * * Return: void * * Programmer: John Mainzer - * 10/21/04 + * 6/24/04 * * Modifications: * - * JRM -- 1/21/05 - * Added the max_index parameter to allow the caller to - * throttle the size of the inner loop, and thereby the - * execution time of the function. - * *------------------------------------------------------------------------- */ static void -hl_row_major_scan_backward(H5C_t * cache_ptr, - int32_t max_index, - hbool_t verbose, - hbool_t reset_stats, - hbool_t display_stats, - hbool_t display_detailed_stats, - hbool_t do_inserts, - hbool_t dirty_inserts) +write_permitted_check(void) { - const char * fcn_name = "hl_row_major_scan_backward"; - int32_t type; - int32_t idx; - int32_t i; - int32_t lag = 100; - int32_t local_max_index; - - if ( verbose ) - HDfprintf(stdout, "%s(): entering.\n", fcn_name); - HDassert( lag > 5 ); - HDassert( max_index >= 200 ); - HDassert( max_index <= MAX_ENTRIES ); +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - type = NUMBER_OF_ENTRY_TYPES - 1; + const char * fcn_name = "write_permitted_check"; + hbool_t show_progress = FALSE; + hbool_t display_stats = FALSE; + int32_t lag = 10; + int mile_stone = 1; + H5C_t * cache_ptr = NULL; - if ( ( pass ) && ( reset_stats ) ) { +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - H5C_stats__reset(cache_ptr); - } + TESTING("write permitted check -- 1/0 MB cache"); - while ( ( pass ) && ( type >= 0 ) ) - { - idx = max_indices[type] + lag; +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - local_max_index = MIN(max_index, max_indices[type]); + pass = TRUE; - while ( ( pass ) && ( idx >= -lag ) ) - { - if ( ( pass ) && ( do_inserts ) && ( (idx + lag) >= 0 ) && - ( (idx + lag) <= local_max_index ) && - ( ((idx + lag) % 2) == 0 ) && - ( ! entry_in_cache(cache_ptr, type, (idx + lag)) ) ) { + if ( show_progress ) /* 1 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( verbose ) - HDfprintf(stdout, "(i, %d, %d) ", type, (idx + lag)); + reset_entries(); - insert_entry(cache_ptr, type, (idx + lag), dirty_inserts, - H5C__NO_FLAGS_SET); - } + if ( show_progress ) /* 2 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - i = idx; + cache_ptr = setup_cache((size_t)(1 * 1024 * 1024), + (size_t)(0)); - while ( ( pass ) && ( i >= idx - lag ) && ( i >= 0 ) ) - { - if ( ( pass ) && ( i >= 0 ) && ( i <= local_max_index ) ) { + if ( show_progress ) /* 3 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( verbose ) - HDfprintf(stdout, "(p, %d, %d) ", type, i); + row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ TRUE, + /* do_renames */ TRUE, + /* rename_to_main_addr */ FALSE, + /* do_destroys */ TRUE, + /* dirty_destroys */ TRUE, + /* dirty_unprotects */ TRUE); - protect_entry(cache_ptr, type, i); + if ( show_progress ) /* 4 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( verbose ) - HDfprintf(stdout, "(u, %d, %d) ", type, i); + write_permitted = FALSE; - unprotect_entry(cache_ptr, type, i, NO_CHANGE, - H5C__NO_FLAGS_SET); - } - i--; - } + row_major_scan_backward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ FALSE, + /* dirty_inserts */ FALSE, + /* do_renames */ TRUE, + /* rename_to_main_addr */ TRUE, + /* do_destroys */ FALSE, + /* dirty_destroys */ FALSE, + /* dirty_unprotects */ NO_CHANGE); + + if ( show_progress ) /* 5 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( verbose ) - HDfprintf(stdout, "\n"); + write_permitted = TRUE; - idx--; - } - type--; - } + row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ TRUE, + /* do_renames */ TRUE, + /* rename_to_main_addr */ FALSE, + /* do_destroys */ FALSE, + /* dirty_destroys */ TRUE, + /* dirty_unprotects */ TRUE); + + if ( show_progress ) /* 6 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); - if ( ( pass ) && ( display_stats ) ) { + /* flush and destroy all entries in the cache: */ - H5C_stats(cache_ptr, "test cache", display_detailed_stats); - } + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ TRUE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); + + if ( show_progress ) /* 7 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + col_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ TRUE, + /* dirty_unprotects */ TRUE); + + if ( show_progress ) /* 8 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + write_permitted = FALSE; + + col_major_scan_backward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ FALSE, + /* dirty_inserts */ FALSE, + /* dirty_unprotects */ NO_CHANGE); + + write_permitted = TRUE; + + if ( show_progress ) /* 9 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + takedown_cache(cache_ptr, display_stats, TRUE); + + if ( show_progress ) /* 10 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + verify_clean(); + verify_unprotected(); + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); + +#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + + SKIPPED(); + + HDfprintf(stdout, " Clean and dirty LRU lists disabled.\n"); - return; +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ -} /* hl_row_major_scan_backward() */ +} /* write_permitted_check() */ /*------------------------------------------------------------------------- - * Function: col_major_scan_forward() + * Function: check_flush_cache() * - * Purpose: Do a sequence of inserts, protects, and unprotects - * while scanning through the set of entries. If - * pass is false on entry, do nothing. + * Purpose: Verify that flush_cache behaves as expected. In particular, + * test the behaviour with different flags. * * Return: void * * Programmer: John Mainzer - * 6/23/04 + * 1/10/05 * * Modifications: * @@ -2964,221 +1947,165 @@ hl_row_major_scan_backward(H5C_t * cache_ptr, */ static void -col_major_scan_forward(H5C_t * cache_ptr, - int32_t lag, - hbool_t verbose, - hbool_t reset_stats, - hbool_t display_stats, - hbool_t display_detailed_stats, - hbool_t do_inserts, - hbool_t dirty_inserts, - int dirty_unprotects) +check_flush_cache(void) { - const char * fcn_name = "col_major_scan_forward()"; - int32_t type; - int32_t idx; - - if ( verbose ) - HDfprintf(stdout, "%s: entering.\n", fcn_name); - - HDassert( lag > 5 ); - - type = 0; - - if ( ( pass ) && ( reset_stats ) ) { - - H5C_stats__reset(cache_ptr); - } + const char * fcn_name = "check_flush_cache"; + H5C_t * cache_ptr = NULL; - idx = -lag; + TESTING("H5C_flush_cache() functionality"); - while ( ( pass ) && ( (idx - lag) <= MAX_ENTRIES ) ) - { - type = 0; + pass = TRUE; - while ( ( pass ) && ( type < NUMBER_OF_ENTRY_TYPES ) ) - { - if ( ( pass ) && ( do_inserts ) && ( (idx + lag) >= 0 ) && - ( (idx + lag) <= max_indices[type] ) && - ( ((idx + lag) % 3) == 0 ) && - ( ! entry_in_cache(cache_ptr, type, (idx + lag)) ) ) { + /* allocate a cache, and flush it under various circumstances. + * To the extent possible, verify that the desired actions took + * place. + */ - if ( verbose ) - HDfprintf(stdout, "(i, %d, %d) ", type, (idx + lag)); + if ( pass ) { - insert_entry(cache_ptr, type, (idx + lag), dirty_inserts, - H5C__NO_FLAGS_SET); - } + reset_entries(); - if ( ( pass ) && ( idx >= 0 ) && ( idx <= max_indices[type] ) ) { + cache_ptr = setup_cache((size_t)(2 * 1024 * 1024), + (size_t)(1 * 1024 * 1024)); + } - if ( verbose ) - HDfprintf(stdout, "(p, %d, %d) ", type, idx); + /* first test behaviour on an empty cache. Can't do much sanity + * checking in this case, so simply check the return values. + */ - protect_entry(cache_ptr, type, idx); - } + if ( pass ) { - if ( ( pass ) && ( (idx - lag) >= 0 ) && - ( (idx - lag) <= max_indices[type] ) ) { + check_flush_cache__empty_cache(cache_ptr); + } - if ( verbose ) - HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag)); + /* now do a series of similar tests with a cache with a single entry. + * Start with a clean entry, with no flags set. + */ - unprotect_entry(cache_ptr, type, idx - lag, - dirty_unprotects, H5C__NO_FLAGS_SET); - } + if ( pass ) { - if ( verbose ) - HDfprintf(stdout, "\n"); + check_flush_cache__single_entry(cache_ptr); + } - type++; - } + if ( pass ) { - idx++; + check_flush_cache__multi_entry(cache_ptr); } - if ( ( pass ) && ( display_stats ) ) { + if ( pass ) { - H5C_stats(cache_ptr, "test cache", display_detailed_stats); + takedown_cache(cache_ptr, FALSE, FALSE); } - return; + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); -} /* col_major_scan_forward() */ +} /* check_flush_cache() */ /*------------------------------------------------------------------------- - * Function: hl_col_major_scan_forward() + * Function: check_flush_cache__empty_cache() * - * Purpose: Do a high locality sequence of inserts, protects, and - * unprotects while scanning through the set of entries. If - * pass is false on entry, do nothing. + * Purpose: Verify that flush_cache behaves as expected with an empty + * cache. * * Return: void * * Programmer: John Mainzer - * 19/25/04 + * 1/12/05 * * Modifications: * - * JRM -- 1/21/05 - * Added the max_index parameter to allow the caller to - * throttle the size of the inner loop, and thereby the - * execution time of the function. - * *------------------------------------------------------------------------- */ static void -hl_col_major_scan_forward(H5C_t * cache_ptr, - int32_t max_index, - hbool_t verbose, - hbool_t reset_stats, - hbool_t display_stats, - hbool_t display_detailed_stats, - hbool_t do_inserts, - hbool_t dirty_inserts, - int dirty_unprotects) +check_flush_cache__empty_cache(H5C_t * cache_ptr) { - const char * fcn_name = "hl_col_major_scan_forward()"; - int32_t type; - int32_t idx; - int32_t lag = 200; - int32_t i; - int32_t local_max_index; - - if ( verbose ) - HDfprintf(stdout, "%s: entering.\n", fcn_name); - - HDassert( lag > 5 ); - HDassert( max_index >= 500 ); - HDassert( max_index <= MAX_ENTRIES ); - - type = 0; + /* const char * fcn_name = "check_flush_cache__empty_cache"; */ + herr_t result; - if ( ( pass ) && ( reset_stats ) ) { + if ( cache_ptr == NULL ) { - H5C_stats__reset(cache_ptr); + pass = FALSE; + failure_mssg = "cache_ptr NULL on entry to empty cache case."; } + else if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) { - idx = 0; - - local_max_index = MIN(max_index, MAX_ENTRIES); + pass = FALSE; + failure_mssg = "cache not empty at beginning of empty cache case."; + } - while ( ( pass ) && ( idx <= local_max_index ) ) - { - i = idx; + /* Test behaviour on an empty cache. Can't do much sanity + * checking in this case, so simply check the return values. + */ - while ( ( pass ) && ( i >= 0 ) && ( i >= (idx - lag) ) ) { + if ( pass ) { - type = 0; + result = H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET); - while ( ( pass ) && ( type < NUMBER_OF_ENTRY_TYPES ) ) - { - if ( ( pass ) && ( do_inserts ) && ( i == idx ) && - ( i <= local_max_index ) && - ( (i % 3) == 0 ) && - ( ! entry_in_cache(cache_ptr, type, i) ) ) { + if ( result < 0 ) { - if ( verbose ) - HDfprintf(stdout, "(i, %d, %d) ", type, i); + pass = FALSE; + failure_mssg = "flush with flags = 0x00 failed on empty cache.\n"; + } + } - insert_entry(cache_ptr, type, i, dirty_inserts, - H5C__NO_FLAGS_SET); - } + if ( pass ) { - if ( ( pass ) && ( i >= 0 ) && ( i <= local_max_index ) ) { + result = H5C_flush_cache(NULL, -1, -1, cache_ptr, + H5C__FLUSH_INVALIDATE_FLAG); - if ( verbose ) - HDfprintf(stdout, "(p, %d, %d) ", type, i); + if ( result < 0 ) { - protect_entry(cache_ptr, type, i); - } + pass = FALSE; + failure_mssg = "flush with flags = 0x04 failed on empty cache.\n"; + } + } - if ( ( pass ) && ( i >= 0 ) && - ( i <= max_indices[type] ) ) { + if ( pass ) { - if ( verbose ) - HDfprintf(stdout, "(u, %d, %d) ", type, i); + result = H5C_flush_cache(NULL, -1, -1, cache_ptr, + H5C__FLUSH_CLEAR_ONLY_FLAG); - unprotect_entry(cache_ptr, type, i, - dirty_unprotects, H5C__NO_FLAGS_SET); - } + if ( result < 0 ) { - if ( verbose ) - HDfprintf(stdout, "\n"); + pass = FALSE; + failure_mssg = "flush with flags = 0x08 failed on empty cache.\n"; + } + } - type++; - } - i--; - } + if ( pass ) { - idx++; - } + result = H5C_flush_cache(NULL, -1, -1, cache_ptr, + H5C__FLUSH_MARKED_ENTRIES_FLAG); - if ( ( pass ) && ( display_stats ) ) { + if ( result < 0 ) { - H5C_stats(cache_ptr, "test cache", display_detailed_stats); + pass = FALSE; + failure_mssg = "flush with flags = 0x10 failed on empty cache.\n"; + } } - return; - -} /* hl_col_major_scan_forward() */ +} /* check_flush_cache__empty_cache() */ /*------------------------------------------------------------------------- - * Function: col_major_scan_backward() + * Function: check_flush_cache__multi_entry() * - * Purpose: Do a sequence of inserts, protects, and unprotects - * while scanning backwards through the set of - * entries. If pass is false on entry, do nothing. + * Purpose: Verify that flush_cache behaves as expected when the cache + * contains multiple elements. * * Return: void * * Programmer: John Mainzer - * 6/23/04 + * 1/14/05 * * Modifications: * @@ -3186,7754 +2113,3577 @@ hl_col_major_scan_forward(H5C_t * cache_ptr, */ static void -col_major_scan_backward(H5C_t * cache_ptr, - int32_t lag, - hbool_t verbose, - hbool_t reset_stats, - hbool_t display_stats, - hbool_t display_detailed_stats, - hbool_t do_inserts, - hbool_t dirty_inserts, - int dirty_unprotects) +check_flush_cache__multi_entry(H5C_t * cache_ptr) { - const char * fcn_name = "col_major_scan_backward()"; - int mile_stone = 1; - int32_t type; - int32_t idx; - - if ( verbose ) - HDfprintf(stdout, "%s: entering.\n", fcn_name); - - HDassert( lag > 5 ); + /* const char * fcn_name = "check_flush_cache__multi_entry"; */ - if ( ( pass ) && ( reset_stats ) ) { + if ( cache_ptr == NULL ) { - H5C_stats__reset(cache_ptr); + pass = FALSE; + failure_mssg = "cache_ptr NULL on entry to multi entry case."; } + else if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) { - idx = MAX_ENTRIES + lag; - - if ( verbose ) /* 1 */ - HDfprintf(stdout, "%s: point %d.\n", fcn_name, mile_stone++); - + pass = FALSE; + failure_mssg = "cache not empty at beginning of multi entry case."; + } - while ( ( pass ) && ( (idx + lag) >= 0 ) ) + if ( pass ) { - type = NUMBER_OF_ENTRY_TYPES - 1; - - while ( ( pass ) && ( type >= 0 ) ) + int test_num = 1; + unsigned int flush_flags = H5C__NO_FLAGS_SET; + int spec_size = 8; + struct flush_cache_test_spec spec[8] = { - if ( ( pass ) && ( do_inserts) && ( (idx - lag) >= 0 ) && - ( (idx - lag) <= max_indices[type] ) && - ( ((idx - lag) % 3) == 0 ) && - ( ! entry_in_cache(cache_ptr, type, (idx - lag)) ) ) { - - if ( verbose ) - HDfprintf(stdout, "(i, %d, %d) ", type, (idx - lag)); - - insert_entry(cache_ptr, type, (idx - lag), dirty_inserts, - H5C__NO_FLAGS_SET); - } - - if ( ( pass ) && ( idx >= 0 ) && ( idx <= max_indices[type] ) ) { - - if ( verbose ) - HDfprintf(stdout, "(p, %d, %d) ", type, idx); - - protect_entry(cache_ptr, type, idx); - } - - if ( ( pass ) && ( (idx + lag) >= 0 ) && - ( (idx + lag) <= max_indices[type] ) ) { - - if ( verbose ) - HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag)); - - unprotect_entry(cache_ptr, type, idx + lag, - dirty_unprotects, H5C__NO_FLAGS_SET); - } - - if ( verbose ) - HDfprintf(stdout, "\n"); - - type--; - } + { + /* entry_num = */ 0, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 100, + /* insert_flag = */ FALSE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 1, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 75, + /* insert_flag = */ FALSE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 2, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 25, + /* insert_flag = */ TRUE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 3, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 50, + /* insert_flag = */ TRUE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 4, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 10, + /* insert_flag = */ FALSE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 5, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 20, + /* insert_flag = */ FALSE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 6, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 30, + /* insert_flag = */ TRUE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 7, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 40, + /* insert_flag = */ TRUE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ FALSE + } + }; - idx--; + check_flush_cache__multi_entry_test(cache_ptr, test_num, + flush_flags, spec_size, spec); } - if ( verbose ) /* 2 */ - HDfprintf(stdout, "%s: point %d.\n", fcn_name, mile_stone++); - if ( ( pass ) && ( display_stats ) ) { + if ( pass ) + { + int test_num = 2; + unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; + int spec_size = 8; + struct flush_cache_test_spec spec[8] = + { + { + /* entry_num = */ 0, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 100, + /* insert_flag = */ FALSE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 1, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 75, + /* insert_flag = */ FALSE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 2, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 25, + /* insert_flag = */ TRUE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 3, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 50, + /* insert_flag = */ TRUE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 4, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 10, + /* insert_flag = */ FALSE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 5, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 20, + /* insert_flag = */ FALSE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 6, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 30, + /* insert_flag = */ TRUE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 7, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 40, + /* insert_flag = */ TRUE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ TRUE + } + }; - H5C_stats(cache_ptr, "test cache", display_detailed_stats); + check_flush_cache__multi_entry_test(cache_ptr, test_num, + flush_flags, spec_size, spec); } - if ( verbose ) - HDfprintf(stdout, "%s: exiting.\n", fcn_name); - - return; - -} /* col_major_scan_backward() */ - - -/*------------------------------------------------------------------------- - * Function: hl_col_major_scan_backward() - * - * Purpose: Do a high locality sequence of inserts, protects, and - * unprotects while scanning backwards through the set of - * entries. If pass is false on entry, do nothing. - * - * Return: void - * - * Programmer: John Mainzer - * 10/25/04 - * - * Modifications: - * - * JRM -- 1/21/05 - * Added the max_index parameter to allow the caller to - * throttle the size of the inner loop, and thereby the - * execution time of the function. - * - *------------------------------------------------------------------------- - */ -static void -hl_col_major_scan_backward(H5C_t * cache_ptr, - int32_t max_index, - hbool_t verbose, - hbool_t reset_stats, - hbool_t display_stats, - hbool_t display_detailed_stats, - hbool_t do_inserts, - hbool_t dirty_inserts, - int dirty_unprotects) -{ - const char * fcn_name = "hl_col_major_scan_backward()"; - int32_t type; - int32_t idx; - int32_t lag = 50; - int32_t i; - int32_t local_max_index; - - if ( verbose ) - HDfprintf(stdout, "%s: entering.\n", fcn_name); - - HDassert( lag > 5 ); - HDassert( max_index >= 500 ); - HDassert( max_index <= MAX_ENTRIES ); - - type = 0; - - local_max_index = MIN(max_index, MAX_ENTRIES); - - if ( ( pass ) && ( reset_stats ) ) { + if ( pass ) + { + int test_num = 3; + unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG; + int spec_size = 8; + struct flush_cache_test_spec spec[8] = + { + { + /* entry_num = */ 0, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 100, + /* insert_flag = */ FALSE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 1, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 75, + /* insert_flag = */ FALSE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 2, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 25, + /* insert_flag = */ TRUE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 3, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 50, + /* insert_flag = */ TRUE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 4, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 10, + /* insert_flag = */ FALSE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 5, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 20, + /* insert_flag = */ FALSE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 6, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 30, + /* insert_flag = */ TRUE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 7, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 40, + /* insert_flag = */ TRUE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + } + }; - H5C_stats__reset(cache_ptr); + check_flush_cache__multi_entry_test(cache_ptr, test_num, + flush_flags, spec_size, spec); } - idx = local_max_index; - while ( ( pass ) && ( idx >= 0 ) ) + if ( pass ) { + int test_num = 4; + unsigned int flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG; + int spec_size = 8; + struct flush_cache_test_spec spec[8] = + { + { + /* entry_num = */ 0, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 100, + /* insert_flag = */ FALSE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 1, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 75, + /* insert_flag = */ FALSE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 2, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 25, + /* insert_flag = */ TRUE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 3, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 50, + /* insert_flag = */ TRUE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 4, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 10, + /* insert_flag = */ FALSE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 5, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 20, + /* insert_flag = */ FALSE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 6, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 30, + /* insert_flag = */ TRUE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 7, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 40, + /* insert_flag = */ TRUE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ FALSE + } + }; - i = idx; - - while ( ( pass ) && ( i <= local_max_index ) && ( i <= (idx + lag) ) ) { - - type = 0; - - while ( ( pass ) && ( type < NUMBER_OF_ENTRY_TYPES ) ) - { - if ( ( pass ) && ( do_inserts ) && ( i == idx ) && - ( i <= local_max_index ) && - ( ! entry_in_cache(cache_ptr, type, i) ) ) { - - if ( verbose ) - HDfprintf(stdout, "(i, %d, %d) ", type, i); - - insert_entry(cache_ptr, type, i, dirty_inserts, - H5C__NO_FLAGS_SET); - } - - if ( ( pass ) && ( i >= 0 ) && ( i <= local_max_index ) ) { - - if ( verbose ) - HDfprintf(stdout, "(p, %d, %d) ", type, i); - - protect_entry(cache_ptr, type, i); - } - - if ( ( pass ) && ( i >= 0 ) && - ( i <= local_max_index ) ) { - - if ( verbose ) - HDfprintf(stdout, "(u, %d, %d) ", type, i); - - unprotect_entry(cache_ptr, type, i, - dirty_unprotects, H5C__NO_FLAGS_SET); - } - - if ( verbose ) - HDfprintf(stdout, "\n"); - - type++; - } - - i++; - } - - idx--; - } - - if ( ( pass ) && ( display_stats ) ) { - - H5C_stats(cache_ptr, "test cache", display_detailed_stats); + check_flush_cache__multi_entry_test(cache_ptr, test_num, + flush_flags, spec_size, spec); } - return; - -} /* hl_col_major_scan_backward() */ - - -/**************************************************************************/ -/**************************************************************************/ -/********************************* tests: *********************************/ -/**************************************************************************/ -/**************************************************************************/ -/*------------------------------------------------------------------------- - * Function: smoke_check_1() - * - * Purpose: A basic functional test, inserts, destroys, and renames in - * the mix, along with repeated protects and unprotects. - * All entries are marked as clean. - * - * Return: void - * - * Programmer: John Mainzer - * 6/16/04 - * - * Modifications: - * - * JRM -- 1/18/05 - * Added code to skip this test if the skip_long_tests global - * is true. - * - *------------------------------------------------------------------------- - */ - -static void -smoke_check_1(void) -{ - const char * fcn_name = "smoke_check_1"; - hbool_t show_progress = FALSE; - hbool_t dirty_inserts = FALSE; - int dirty_unprotects = FALSE; - int dirty_destroys = FALSE; - hbool_t display_stats = FALSE; - int32_t lag = 10; - int mile_stone = 1; - H5C_t * cache_ptr = NULL; - - TESTING("smoke check #1 -- all clean, ins, dest, ren, 4/2 MB cache"); - - if ( skip_long_tests ) { - - SKIPPED(); - - HDfprintf(stdout, " Long tests disabled.\n"); - - return; - } - - pass = TRUE; - - if ( show_progress ) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - reset_entries(); - - if ( show_progress ) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - cache_ptr = setup_cache((size_t)(4 * 1024 * 1024), - (size_t)(2 * 1024 * 1024)); - - if ( show_progress ) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - row_major_scan_forward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* do_renames */ TRUE, - /* rename_to_main_addr */ FALSE, - /* do_destroys */ TRUE, - /* dirty_destroys */ dirty_destroys, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - row_major_scan_backward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ FALSE, - /* dirty_inserts */ dirty_inserts, - /* do_renames */ TRUE, - /* rename_to_main_addr */ TRUE, - /* do_destroys */ FALSE, - /* dirty_destroys */ dirty_destroys, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - row_major_scan_forward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* do_renames */ TRUE, - /* rename_to_main_addr */ FALSE, - /* do_destroys */ FALSE, - /* dirty_destroys */ dirty_destroys, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - /* flush and destroy all entries in the cache: */ - - flush_cache(/* cache_ptr */ cache_ptr, - /* destroy_entries */ TRUE, - /* dump_stats */ FALSE, - /* dump_detailed_stats */ FALSE); - - if ( show_progress ) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - col_major_scan_forward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - /* flush all entries in the cache: */ - - flush_cache(/* cache_ptr */ cache_ptr, - /* destroy_entries */ FALSE, - /* dump_stats */ FALSE, - /* dump_detailed_stats */ FALSE); - - if ( show_progress ) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - col_major_scan_backward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - takedown_cache(cache_ptr, display_stats, TRUE); - - if ( show_progress ) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - verify_clean(); - verify_unprotected(); - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -} /* smoke_check_1() */ - - -/*------------------------------------------------------------------------- - * Function: smoke_check_2() - * - * Purpose: A basic functional test, with inserts, destroys, and - * renames in the mix, along with some repeated protects - * and unprotects. About half the entries are marked as - * dirty. - * - * Return: void - * - * Programmer: John Mainzer - * 6/24/04 - * - * Modifications: - * - * JRM -- 1/18/05 - * Added code to skip this test if the skip_long_tests global - * is true. - * - *------------------------------------------------------------------------- - */ - -static void -smoke_check_2(void) -{ - const char * fcn_name = "smoke_check_2"; - hbool_t show_progress = FALSE; - hbool_t dirty_inserts = TRUE; - int dirty_unprotects = TRUE; - int dirty_destroys = TRUE; - hbool_t display_stats = FALSE; - int32_t lag = 10; - int mile_stone = 1; - H5C_t * cache_ptr = NULL; - - TESTING("smoke check #2 -- ~1/2 dirty, ins, dest, ren, 4/2 MB cache"); - - if ( skip_long_tests ) { - - SKIPPED(); - - HDfprintf(stdout, " Long tests disabled.\n"); - - return; - } - - pass = TRUE; - - if ( show_progress ) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - reset_entries(); - - if ( show_progress ) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - cache_ptr = setup_cache((size_t)(4 * 1024 * 1024), - (size_t)(2 * 1024 * 1024)); - - if ( show_progress ) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - row_major_scan_forward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* do_renames */ TRUE, - /* rename_to_main_addr */ FALSE, - /* do_destroys */ TRUE, - /* dirty_destroys */ dirty_destroys, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - row_major_scan_backward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ FALSE, - /* dirty_inserts */ dirty_inserts, - /* do_renames */ TRUE, - /* rename_to_main_addr */ TRUE, - /* do_destroys */ FALSE, - /* dirty_destroys */ dirty_destroys, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - row_major_scan_forward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* do_renames */ TRUE, - /* rename_to_main_addr */ FALSE, - /* do_destroys */ FALSE, - /* dirty_destroys */ dirty_destroys, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - /* flush and destroy all entries in the cache: */ - - flush_cache(/* cache_ptr */ cache_ptr, - /* destroy_entries */ TRUE, - /* dump_stats */ FALSE, - /* dump_detailed_stats */ FALSE); - - if ( show_progress ) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - col_major_scan_forward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - /* flush all entries in the cache: */ - - flush_cache(/* cache_ptr */ cache_ptr, - /* destroy_entries */ FALSE, - /* dump_stats */ FALSE, - /* dump_detailed_stats */ FALSE); - - if ( show_progress ) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - col_major_scan_backward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - takedown_cache(cache_ptr, display_stats, TRUE); - - if ( show_progress ) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - verify_clean(); - verify_unprotected(); - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -} /* smoke_check_2() */ - - -/*------------------------------------------------------------------------- - * Function: smoke_check_3() - * - * Purpose: A basic functional test on a tiny cache, with inserts, - * destroys, and renames in the mix, along with repeated - * protects and unprotects. All entries are marked as clean. - * - * Return: void - * - * Programmer: John Mainzer - * 6/16/04 - * - * Modifications: - * - * JRM -- 1/18/05 - * Added code to skip this test if the skip_long_tests global - * is true. - * - *------------------------------------------------------------------------- - */ - -static void -smoke_check_3(void) -{ - const char * fcn_name = "smoke_check_3"; - hbool_t show_progress = FALSE; - hbool_t dirty_inserts = FALSE; - int dirty_unprotects = FALSE; - int dirty_destroys = FALSE; - hbool_t display_stats = FALSE; - int32_t lag = 10; - int mile_stone = 1; - H5C_t * cache_ptr = NULL; - - TESTING("smoke check #3 -- all clean, ins, dest, ren, 2/1 KB cache"); - - if ( skip_long_tests ) { - - SKIPPED(); - - HDfprintf(stdout, " Long tests disabled.\n"); - - return; - } - - pass = TRUE; - - if ( show_progress ) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - reset_entries(); - - if ( show_progress ) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); - - if ( show_progress ) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - row_major_scan_forward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* do_renames */ TRUE, - /* rename_to_main_addr */ FALSE, - /* do_destroys */ TRUE, - /* dirty_destroys */ dirty_destroys, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - row_major_scan_backward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ FALSE, - /* dirty_inserts */ dirty_inserts, - /* do_renames */ TRUE, - /* rename_to_main_addr */ TRUE, - /* do_destroys */ FALSE, - /* dirty_destroys */ dirty_destroys, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - row_major_scan_forward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* do_renames */ TRUE, - /* rename_to_main_addr */ FALSE, - /* do_destroys */ FALSE, - /* dirty_destroys */ dirty_destroys, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - /* flush and destroy all entries in the cache: */ - - flush_cache(/* cache_ptr */ cache_ptr, - /* destroy_entries */ TRUE, - /* dump_stats */ FALSE, - /* dump_detailed_stats */ FALSE); - - if ( show_progress ) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - col_major_scan_forward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - /* flush all entries in the cache: */ - - flush_cache(/* cache_ptr */ cache_ptr, - /* destroy_entries */ FALSE, - /* dump_stats */ FALSE, - /* dump_detailed_stats */ FALSE); - - if ( show_progress ) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - col_major_scan_backward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - takedown_cache(cache_ptr, display_stats, TRUE); - - if ( show_progress ) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - verify_clean(); - verify_unprotected(); - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -} /* smoke_check_3() */ - - -/*------------------------------------------------------------------------- - * Function: smoke_check_4() - * - * Purpose: A basic functional test on a tiny cache, with inserts, - * destroys, and renames in the mix, along with repeated - * protects and unprotects. About half the entries are - * marked as dirty. - * - * Return: void - * - * Programmer: John Mainzer - * 6/24/04 - * - * Modifications: - * - * JRM -- 1/18/05 - * Added code to skip this test if the skip_long_tests global - * is true. - * - *------------------------------------------------------------------------- - */ - -static void -smoke_check_4(void) -{ - const char * fcn_name = "smoke_check_4"; - hbool_t show_progress = FALSE; - hbool_t dirty_inserts = TRUE; - int dirty_unprotects = TRUE; - int dirty_destroys = TRUE; - hbool_t display_stats = FALSE; - int32_t lag = 10; - int mile_stone = 1; - H5C_t * cache_ptr = NULL; - - TESTING("smoke check #4 -- ~1/2 dirty, ins, dest, ren, 2/1 KB cache"); - - if ( skip_long_tests ) { - - SKIPPED(); - - HDfprintf(stdout, " Long tests disabled.\n"); - - return; - } - - pass = TRUE; - - if ( show_progress ) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - reset_entries(); - - if ( show_progress ) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); - - if ( show_progress ) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - row_major_scan_forward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* do_renames */ TRUE, - /* rename_to_main_addr */ FALSE, - /* do_destroys */ TRUE, - /* dirty_destroys */ dirty_destroys, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - row_major_scan_backward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ FALSE, - /* dirty_inserts */ dirty_inserts, - /* do_renames */ TRUE, - /* rename_to_main_addr */ TRUE, - /* do_destroys */ FALSE, - /* dirty_destroys */ dirty_destroys, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - row_major_scan_forward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* do_renames */ TRUE, - /* rename_to_main_addr */ FALSE, - /* do_destroys */ FALSE, - /* dirty_destroys */ dirty_destroys, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - /* flush and destroy all entries in the cache: */ - - flush_cache(/* cache_ptr */ cache_ptr, - /* destroy_entries */ TRUE, - /* dump_stats */ FALSE, - /* dump_detailed_stats */ FALSE); - - if ( show_progress ) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - col_major_scan_forward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - /* flush all entries in the cache: */ - - flush_cache(/* cache_ptr */ cache_ptr, - /* destroy_entries */ FALSE, - /* dump_stats */ FALSE, - /* dump_detailed_stats */ FALSE); - - if ( show_progress ) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - col_major_scan_backward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - takedown_cache(cache_ptr, display_stats, TRUE); - - if ( show_progress ) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - verify_clean(); - verify_unprotected(); - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -} /* smoke_check_4() */ - - -/*------------------------------------------------------------------------- - * Function: smoke_check_5() - * - * Purpose: A basic functional test on a cache with automatic cache - * resizing enabled, with inserts in the mix, along with - * repeated protects and unprotects. All entries are marked - * as clean. - * - * Return: void - * - * Programmer: John Mainzer - * 10/14/04 - * - * Modifications: - * - * JRM -- 1/18/05 - * Added code to skip this test if the skip_long_tests global - * is true. - * - *------------------------------------------------------------------------- - */ - -static void -smoke_check_5(void) -{ - const char * fcn_name = "smoke_check_5"; - herr_t result; - hbool_t show_progress = FALSE; - hbool_t dirty_inserts = FALSE; - int dirty_unprotects = FALSE; - hbool_t display_stats = FALSE; - int32_t max_index = 1024; - int mile_stone = 1; - H5C_t * cache_ptr = NULL; - H5C_auto_size_ctl_t auto_size_ctl = - { - /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, -#if 1 - /* H5C_auto_resize_report_fcn rpt_fcn = */ NULL, -#else - /* H5C_auto_resize_report_fcn rpt_fcn = */ H5C_def_auto_resize_rpt_fcn, -#endif - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (2 * 1024 * 1024), - - /* double min_clean_fraction = */ 0.1, - - /* size_t max_size = */ (32 * 1024 * 1025), - /* size_t min_size = */ (512 * 1024), - - /* int64_t epoch_length = */ 50000, - - - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - - /* double lower_hr_threshold = */ 0.75, - - /* double increment = */ 2.0, - - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - - - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, - - /* double upper_hr_threshold = */ 0.995, - - /* double decrement = */ 0.9, - - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - - /* int32_t epochs_before_eviction = */ 3, - - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.5 - }; - - TESTING("smoke check #5 -- all clean, ins, prot, unprot, AR cache 1"); - - if ( skip_long_tests ) { - - SKIPPED(); - - HDfprintf(stdout, " Long tests disabled.\n"); - - return; - } - - if ( run_full_test ) { - - max_index = (10 * 1024) - 1; - } - - pass = TRUE; - - if ( show_progress ) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - reset_entries(); - - if ( show_progress ) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); - - if ( pass ) { - - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - - if ( result != SUCCEED ) { - - pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n"; - } - } - - if ( show_progress ) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ FALSE, - /* dirty_inserts */ dirty_inserts); - - if ( show_progress ) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_row_major_scan_backward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ FALSE, - /* dirty_inserts */ dirty_inserts); - - if ( show_progress ) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts); - - if ( show_progress ) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - /* flush and destroy all entries in the cache: */ - - flush_cache(/* cache_ptr */ cache_ptr, - /* destroy_entries */ TRUE, - /* dump_stats */ FALSE, - /* dump_detailed_stats */ FALSE); - - if ( show_progress ) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_col_major_scan_forward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - /* flush all entries in the cache: */ - - flush_cache(/* cache_ptr */ cache_ptr, - /* destroy_entries */ FALSE, - /* dump_stats */ FALSE, - /* dump_detailed_stats */ FALSE); - - if ( show_progress ) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_col_major_scan_backward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - takedown_cache(cache_ptr, display_stats, TRUE); - - if ( show_progress ) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - verify_clean(); - verify_unprotected(); - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -} /* smoke_check_5() */ - - -/*------------------------------------------------------------------------- - * Function: smoke_check_6() - * - * Purpose: A basic functional test on a cache with automatic cache - * resizing enabled, with inserts in the mix, along with - * repeated protects and unprotects. About one half of all - * entries are marked as dirty. - * - * Return: void - * - * Programmer: John Mainzer - * 10/25/04 - * - * Modifications: - * - * JRM -- 1/18/05 - * Added code to skip this test if the skip_long_tests global - * is true. - * - *------------------------------------------------------------------------- - */ - -static void -smoke_check_6(void) -{ - const char * fcn_name = "smoke_check_6"; - herr_t result; - hbool_t show_progress = FALSE; - hbool_t dirty_inserts = TRUE; - int dirty_unprotects = FALSE; - hbool_t display_stats = FALSE; - int mile_stone = 1; - int32_t max_index = 1024; - H5C_t * cache_ptr = NULL; - H5C_auto_size_ctl_t auto_size_ctl = - { - /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, -#if 1 - /* H5C_auto_resize_report_fcn rpt_fcn = */ NULL, -#else - /* H5C_auto_resize_report_fcn rpt_fcn = */ H5C_def_auto_resize_rpt_fcn, -#endif - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (2 * 1024 * 1024), - - /* double min_clean_fraction = */ 0.1, - - /* size_t max_size = */ (32 * 1024 * 1025), - /* size_t min_size = */ (512 * 1024), - - /* int64_t epoch_length = */ 50000, - - - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - - /* double lower_hr_threshold = */ 0.75, - - /* double increment = */ 2.0, - - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - - - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, - - /* double upper_hr_threshold = */ 0.995, - - /* double decrement = */ 0.9, - - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - - /* int32_t epochs_before_eviction = */ 3, - - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05 - }; - - TESTING("smoke check #6 -- ~1/2 dirty, ins, prot, unprot, AR cache 1"); - - pass = TRUE; - - if ( skip_long_tests ) { - - SKIPPED(); - - HDfprintf(stdout, " Long tests disabled.\n"); - - return; - } - - if ( run_full_test ) { - - max_index = (10 * 1024) - 1; - } - - if ( show_progress ) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - reset_entries(); - - if ( show_progress ) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); - - if ( pass ) { - - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - - if ( result != SUCCEED ) { - - pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n"; - } - } - - if ( show_progress ) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ FALSE, - /* dirty_inserts */ dirty_inserts); - - if ( show_progress ) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_row_major_scan_backward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ FALSE, - /* dirty_inserts */ dirty_inserts); - - if ( show_progress ) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts); - - if ( show_progress ) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - /* flush and destroy all entries in the cache: */ - - flush_cache(/* cache_ptr */ cache_ptr, - /* destroy_entries */ TRUE, - /* dump_stats */ FALSE, - /* dump_detailed_stats */ FALSE); - - if ( show_progress ) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_col_major_scan_forward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - /* flush all entries in the cache: */ - - flush_cache(/* cache_ptr */ cache_ptr, - /* destroy_entries */ FALSE, - /* dump_stats */ FALSE, - /* dump_detailed_stats */ FALSE); - - if ( show_progress ) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_col_major_scan_backward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - takedown_cache(cache_ptr, display_stats, TRUE); - - if ( show_progress ) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - verify_clean(); - verify_unprotected(); - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -} /* smoke_check_6() */ - - -/*------------------------------------------------------------------------- - * Function: smoke_check_7() - * - * Purpose: A basic functional test on a cache with automatic cache - * resizing enabled, with inserts in the mix, along with - * repeated protects and unprotects. All entries are marked - * as clean. - * - * Return: void - * - * Programmer: John Mainzer - * 12/2/04 - * - * Modifications: - * - * JRM -- 1/18/05 - * Added code to skip this test if the skip_long_tests global - * is true. - * - *------------------------------------------------------------------------- - */ - -static void -smoke_check_7(void) -{ - const char * fcn_name = "smoke_check_7"; - herr_t result; - hbool_t show_progress = FALSE; - hbool_t dirty_inserts = FALSE; - int dirty_unprotects = FALSE; - hbool_t display_stats = FALSE; - int mile_stone = 1; - int32_t max_index = 1024; - H5C_t * cache_ptr = NULL; - H5C_auto_size_ctl_t auto_size_ctl = - { - /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, -#if 1 - /* H5C_auto_resize_report_fcn rpt_fcn = */ NULL, -#else - /* H5C_auto_resize_report_fcn rpt_fcn = */ H5C_def_auto_resize_rpt_fcn, -#endif - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (2 * 1024 * 1024), - - /* double min_clean_fraction = */ 0.1, - - /* size_t max_size = */ (32 * 1024 * 1025), - /* size_t min_size = */ (512 * 1024), - - /* int64_t epoch_length = */ 100000, - - - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - - /* double lower_hr_threshold = */ 0.75, - - /* double increment = */ 2.0, - - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (8 * 1024 * 1024), - - - /* enum H5C_cache_decr_mode decr_mode = */ - H5C_decr__age_out_with_threshold, - - /* double upper_hr_threshold = */ 0.995, - - /* double decrement = */ 0.9, - - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - - /* int32_t epochs_before_eviction = */ 3, - - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }; - - TESTING("smoke check #7 -- all clean, ins, prot, unprot, AR cache 2"); - - if ( skip_long_tests ) { - - SKIPPED(); - - HDfprintf(stdout, " Long tests disabled.\n"); - - return; - } - - if ( run_full_test ) { - - max_index = (10 * 1024) - 1; - } - - pass = TRUE; - - if ( show_progress ) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - reset_entries(); - - if ( show_progress ) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); - - if ( pass ) { - - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - - if ( result != SUCCEED ) { - - pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n"; - } - } - - if ( show_progress ) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ FALSE, - /* dirty_inserts */ dirty_inserts); - - if ( show_progress ) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_row_major_scan_backward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ FALSE, - /* dirty_inserts */ dirty_inserts); - - if ( show_progress ) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts); - - if ( show_progress ) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - /* flush and destroy all entries in the cache: */ - - flush_cache(/* cache_ptr */ cache_ptr, - /* destroy_entries */ TRUE, - /* dump_stats */ FALSE, - /* dump_detailed_stats */ FALSE); - - if ( show_progress ) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_col_major_scan_forward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - /* flush all entries in the cache: */ - - flush_cache(/* cache_ptr */ cache_ptr, - /* destroy_entries */ FALSE, - /* dump_stats */ FALSE, - /* dump_detailed_stats */ FALSE); - - if ( show_progress ) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_col_major_scan_backward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - takedown_cache(cache_ptr, display_stats, TRUE); - - if ( show_progress ) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - verify_clean(); - verify_unprotected(); - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -} /* smoke_check_7() */ - - -/*------------------------------------------------------------------------- - * Function: smoke_check_8() - * - * Purpose: A basic functional test on a cache with automatic cache - * resizing enabled, with inserts in the mix, along with - * repeated protects and unprotects. About one half of all - * entries are marked as dirty. - * - * Return: void - * - * Programmer: John Mainzer - * 10/25/04 - * - * Modifications: - * - * JRM -- 1/18/05 - * Added code to skip this test if the skip_long_tests global - * is true. - * - *------------------------------------------------------------------------- - */ - -static void -smoke_check_8(void) -{ - const char * fcn_name = "smoke_check_8"; - herr_t result; - hbool_t show_progress = FALSE; - hbool_t dirty_inserts = TRUE; - int dirty_unprotects = FALSE; - hbool_t display_stats = FALSE; - int mile_stone = 1; - int32_t max_index = 1024; - H5C_t * cache_ptr = NULL; - H5C_auto_size_ctl_t auto_size_ctl = - { - /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, -#if 1 - /* H5C_auto_resize_report_fcn rpt_fcn = */ NULL, -#else - /* H5C_auto_resize_report_fcn rpt_fcn = */ H5C_def_auto_resize_rpt_fcn, -#endif - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (2 * 1024 * 1024), - - /* double min_clean_fraction = */ 0.1, - - /* size_t max_size = */ (32 * 1024 * 1025), - /* size_t min_size = */ (512 * 1024), - - /* int64_t epoch_length = */ 100000, - - - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - - /* double lower_hr_threshold = */ 0.75, - - /* double increment = */ 2.0, - - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - - - /* enum H5C_cache_decr_mode decr_mode = */ - H5C_decr__age_out_with_threshold, - - /* double upper_hr_threshold = */ 0.995, - - /* double decrement = */ 0.9, - - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - - /* int32_t epochs_before_eviction = */ 3, - - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }; - - TESTING("smoke check #8 -- ~1/2 dirty, ins, prot, unprot, AR cache 2"); - - if ( skip_long_tests ) { - - SKIPPED(); - - HDfprintf(stdout, " Long tests disabled.\n"); - - return; - } - - if ( run_full_test ) { - - max_index = (10 * 1024) - 1; - } - - pass = TRUE; - - if ( show_progress ) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - reset_entries(); - - if ( show_progress ) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); - - if ( pass ) { - - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - - if ( result != SUCCEED ) { - - pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n"; - } - } - - if ( show_progress ) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ FALSE, - /* dirty_inserts */ dirty_inserts); - - if ( show_progress ) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_row_major_scan_backward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ FALSE, - /* dirty_inserts */ dirty_inserts); - - if ( show_progress ) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_row_major_scan_forward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts); - - if ( show_progress ) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - /* flush and destroy all entries in the cache: */ - - flush_cache(/* cache_ptr */ cache_ptr, - /* destroy_entries */ TRUE, - /* dump_stats */ FALSE, - /* dump_detailed_stats */ FALSE); - - if ( show_progress ) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_col_major_scan_forward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - /* flush all entries in the cache: */ - - flush_cache(/* cache_ptr */ cache_ptr, - /* destroy_entries */ FALSE, - /* dump_stats */ FALSE, - /* dump_detailed_stats */ FALSE); - - if ( show_progress ) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - hl_col_major_scan_backward(/* cache_ptr */ cache_ptr, - /* max_index */ max_index, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ FALSE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* dirty_unprotects */ dirty_unprotects); - - if ( show_progress ) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - takedown_cache(cache_ptr, display_stats, TRUE); - - if ( show_progress ) /* 11 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - verify_clean(); - verify_unprotected(); - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -} /* smoke_check_8() */ - - -/*------------------------------------------------------------------------- - * Function: write_permitted_check() - * - * Purpose: A basic test of the write permitted function. In essence, - * we load the cache up with dirty entryies, set - * write_permitted to FALSE, and then protect a bunch of - * entries. If there are any writes while write_permitted is - * FALSE, the test will fail. - * - * Return: void - * - * Programmer: John Mainzer - * 6/24/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static void -write_permitted_check(void) -{ - -#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - - const char * fcn_name = "write_permitted_check"; - hbool_t show_progress = FALSE; - hbool_t display_stats = FALSE; - int32_t lag = 10; - int mile_stone = 1; - H5C_t * cache_ptr = NULL; - -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - - TESTING("write permitted check -- 1/0 MB cache"); - -#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - - pass = TRUE; - - if ( show_progress ) /* 1 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - reset_entries(); - - if ( show_progress ) /* 2 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - cache_ptr = setup_cache((size_t)(1 * 1024 * 1024), - (size_t)(0)); - - if ( show_progress ) /* 3 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - row_major_scan_forward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ TRUE, - /* do_renames */ TRUE, - /* rename_to_main_addr */ FALSE, - /* do_destroys */ TRUE, - /* dirty_destroys */ TRUE, - /* dirty_unprotects */ TRUE); - - if ( show_progress ) /* 4 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - write_permitted = FALSE; - - row_major_scan_backward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ FALSE, - /* dirty_inserts */ FALSE, - /* do_renames */ TRUE, - /* rename_to_main_addr */ TRUE, - /* do_destroys */ FALSE, - /* dirty_destroys */ FALSE, - /* dirty_unprotects */ NO_CHANGE); - - if ( show_progress ) /* 5 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - write_permitted = TRUE; - - row_major_scan_forward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ TRUE, - /* do_renames */ TRUE, - /* rename_to_main_addr */ FALSE, - /* do_destroys */ FALSE, - /* dirty_destroys */ TRUE, - /* dirty_unprotects */ TRUE); - - if ( show_progress ) /* 6 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - /* flush and destroy all entries in the cache: */ - - flush_cache(/* cache_ptr */ cache_ptr, - /* destroy_entries */ TRUE, - /* dump_stats */ FALSE, - /* dump_detailed_stats */ FALSE); - - if ( show_progress ) /* 7 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - col_major_scan_forward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ TRUE, - /* dirty_unprotects */ TRUE); - - if ( show_progress ) /* 8 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - write_permitted = FALSE; - - col_major_scan_backward(/* cache_ptr */ cache_ptr, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ FALSE, - /* dirty_inserts */ FALSE, - /* dirty_unprotects */ NO_CHANGE); - - write_permitted = TRUE; - - if ( show_progress ) /* 9 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - takedown_cache(cache_ptr, display_stats, TRUE); - - if ( show_progress ) /* 10 */ - HDfprintf(stdout, "%s() - %0d -- pass = %d\n", - fcn_name, mile_stone++, (int)pass); - - verify_clean(); - verify_unprotected(); - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - - SKIPPED(); - - HDfprintf(stdout, " Clean and dirty LRU lists disabled.\n"); - -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - -} /* write_permitted_check() */ - - -/*------------------------------------------------------------------------- - * Function: check_flush_cache() - * - * Purpose: Verify that flush_cache behaves as expected. In particular, - * test the behaviour with different flags. - * - * Return: void - * - * Programmer: John Mainzer - * 1/10/05 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static void -check_flush_cache(void) -{ - const char * fcn_name = "check_flush_cache"; - H5C_t * cache_ptr = NULL; - - TESTING("H5C_flush_cache() functionality"); - - pass = TRUE; - - /* allocate a cache, and flush it under various circumstances. - * To the extent possible, verify that the desired actions took - * place. - */ - - if ( pass ) { - - reset_entries(); - - cache_ptr = setup_cache((size_t)(2 * 1024 * 1024), - (size_t)(1 * 1024 * 1024)); - } - - /* first test behaviour on an empty cache. Can't do much sanity - * checking in this case, so simply check the return values. - */ - - if ( pass ) { - - check_flush_cache__empty_cache(cache_ptr); - } - - /* now do a series of similar tests with a cache with a single entry. - * Start with a clean entry, with no flags set. - */ - - if ( pass ) { - - check_flush_cache__single_entry(cache_ptr); - } - - if ( pass ) { - - check_flush_cache__multi_entry(cache_ptr); - } - - if ( pass ) { - - takedown_cache(cache_ptr, FALSE, FALSE); - } - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -} /* check_flush_cache() */ - - -/*------------------------------------------------------------------------- - * Function: check_flush_cache__empty_cache() - * - * Purpose: Verify that flush_cache behaves as expected with an empty - * cache. - * - * Return: void - * - * Programmer: John Mainzer - * 1/12/05 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static void -check_flush_cache__empty_cache(H5C_t * cache_ptr) -{ - /* const char * fcn_name = "check_flush_cache__empty_cache"; */ - herr_t result; - - if ( cache_ptr == NULL ) { - - pass = FALSE; - failure_mssg = "cache_ptr NULL on entry to empty cache case."; - } - else if ( ( cache_ptr->index_len != 0 ) || - ( cache_ptr->index_size != 0 ) ) { - - pass = FALSE; - failure_mssg = "cache not empty at beginning of empty cache case."; - } - - - /* Test behaviour on an empty cache. Can't do much sanity - * checking in this case, so simply check the return values. - */ - - if ( pass ) { - - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET); - - if ( result < 0 ) { - - pass = FALSE; - failure_mssg = "flush with flags = 0x00 failed on empty cache.\n"; - } - } - - if ( pass ) { - - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, - H5C__FLUSH_INVALIDATE_FLAG); - - if ( result < 0 ) { - - pass = FALSE; - failure_mssg = "flush with flags = 0x04 failed on empty cache.\n"; - } - } - - if ( pass ) { - - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, - H5C__FLUSH_CLEAR_ONLY_FLAG); - - if ( result < 0 ) { - - pass = FALSE; - failure_mssg = "flush with flags = 0x08 failed on empty cache.\n"; - } - } - - - if ( pass ) { - - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, - H5C__FLUSH_MARKED_ENTRIES_FLAG); - - if ( result < 0 ) { - - pass = FALSE; - failure_mssg = "flush with flags = 0x10 failed on empty cache.\n"; - } - } - -} /* check_flush_cache__empty_cache() */ - - -/*------------------------------------------------------------------------- - * Function: check_flush_cache__multi_entry() - * - * Purpose: Verify that flush_cache behaves as expected when the cache - * contains multiple elements. - * - * Return: void - * - * Programmer: John Mainzer - * 1/14/05 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static void -check_flush_cache__multi_entry(H5C_t * cache_ptr) -{ - /* const char * fcn_name = "check_flush_cache__multi_entry"; */ - - if ( cache_ptr == NULL ) { - - pass = FALSE; - failure_mssg = "cache_ptr NULL on entry to multi entry case."; - } - else if ( ( cache_ptr->index_len != 0 ) || - ( cache_ptr->index_size != 0 ) ) { - - pass = FALSE; - failure_mssg = "cache not empty at beginning of multi entry case."; - } - - if ( pass ) - { - int test_num = 1; - unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 8; - struct flush_cache_test_spec spec[8] = - { - { - /* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ FALSE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ FALSE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ TRUE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ TRUE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ FALSE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ FALSE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ TRUE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ TRUE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ FALSE - } - }; - - check_flush_cache__multi_entry_test(cache_ptr, test_num, - flush_flags, spec_size, spec); - } - - - if ( pass ) - { - int test_num = 2; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - int spec_size = 8; - struct flush_cache_test_spec spec[8] = - { - { - /* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ FALSE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ FALSE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ TRUE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ TRUE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ FALSE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ FALSE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ TRUE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ TRUE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ TRUE - } - }; - - check_flush_cache__multi_entry_test(cache_ptr, test_num, - flush_flags, spec_size, spec); - } - - - if ( pass ) - { - int test_num = 3; - unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG; - int spec_size = 8; - struct flush_cache_test_spec spec[8] = - { - { - /* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ FALSE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ FALSE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ TRUE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ TRUE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ FALSE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ FALSE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ TRUE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ TRUE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - } - }; - - check_flush_cache__multi_entry_test(cache_ptr, test_num, - flush_flags, spec_size, spec); - } - - - if ( pass ) - { - int test_num = 4; - unsigned int flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG; - int spec_size = 8; - struct flush_cache_test_spec spec[8] = - { - { - /* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ FALSE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ FALSE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ TRUE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ TRUE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ FALSE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ FALSE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ TRUE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ TRUE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ FALSE - } - }; - - check_flush_cache__multi_entry_test(cache_ptr, test_num, - flush_flags, spec_size, spec); - } - - - if ( pass ) - { - int test_num = 5; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG; - int spec_size = 8; - struct flush_cache_test_spec spec[8] = - { - { - /* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ FALSE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ FALSE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ TRUE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ TRUE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ FALSE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ FALSE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ TRUE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ TRUE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ TRUE - } - }; - - check_flush_cache__multi_entry_test(cache_ptr, test_num, - flush_flags, spec_size, spec); - } - - - if ( pass ) - { - int test_num = 6; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG; - int spec_size = 8; - struct flush_cache_test_spec spec[8] = - { - { - /* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ FALSE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ FALSE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ TRUE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ TRUE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ FALSE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ FALSE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ TRUE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ TRUE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ TRUE - } - }; - - check_flush_cache__multi_entry_test(cache_ptr, test_num, - flush_flags, spec_size, spec); - } - - - if ( pass ) - { - int test_num = 7; - unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG; - int spec_size = 8; - struct flush_cache_test_spec spec[8] = - { - { - /* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ FALSE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ FALSE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ TRUE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ TRUE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ FALSE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ FALSE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ TRUE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ TRUE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - } - }; - - check_flush_cache__multi_entry_test(cache_ptr, test_num, - flush_flags, spec_size, spec); - } - - - if ( pass ) - { - int test_num = 8; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG; - int spec_size = 8; - struct flush_cache_test_spec spec[8] = - { - { - /* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ FALSE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ FALSE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ TRUE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ TRUE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ FALSE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ FALSE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ TRUE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ TRUE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ TRUE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ TRUE - } - }; - - check_flush_cache__multi_entry_test(cache_ptr, test_num, - flush_flags, spec_size, spec); - } - - - /* verify that all other flags are ignored */ - if ( pass ) - { - int test_num = 9; - unsigned int flush_flags = (unsigned) - ~(H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG); - int spec_size = 8; - struct flush_cache_test_spec spec[8] = - { - { - /* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ FALSE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ FALSE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ TRUE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ TRUE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ FALSE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ FALSE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ TRUE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ TRUE, - /* dirty_flag = */ FALSE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ TRUE, - /* dirty_flag = */ TRUE, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_loaded = */ FALSE, - /* expected_cleared = */ FALSE, - /* expected_flushed = */ TRUE, - /* expected_destroyed = */ FALSE - } - }; - - check_flush_cache__multi_entry_test(cache_ptr, test_num, - flush_flags, spec_size, spec); - } - -} /* check_flush_cache__multi_entry() */ - - -/*------------------------------------------------------------------------- - * Function: check_flush_cache__multi_entry_test() - * - * Purpose: Run a multi entry flush cache test. - * - * Return: void - * - * Programmer: John Mainzer - * 1/13/05 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static void -check_flush_cache__multi_entry_test(H5C_t * cache_ptr, - int test_num, - unsigned int flush_flags, - int spec_size, - struct flush_cache_test_spec spec[]) -{ - /* const char * fcn_name = "check_flush_cache__multi_entry_test"; */ - static char msg[128]; - herr_t result; - int i; - size_t total_entry_size = 0; - test_entry_t * base_addr; - test_entry_t * entry_ptr; - - if ( cache_ptr == NULL ) { - - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "cache_ptr NULL on entry to single entry test #%d.", - test_num); - failure_mssg = msg; - } - else if ( ( cache_ptr->index_len != 0 ) || - ( cache_ptr->index_size != 0 ) ) { - - pass = FALSE; - - HDsnprintf(msg, (size_t)128, - "cache not empty at beginning of multi entry test #%d.", - test_num); - failure_mssg = msg; - } - else if ( ( spec_size < 1 ) || ( spec == NULL ) ) { - - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "missing/bad test spec on entry to multi entry test #%d.", - test_num); - failure_mssg = msg; - } - - i = 0; - while ( ( pass ) && ( i < spec_size ) ) - { - if ( ( spec[i].entry_num != i ) || - ( spec[i].entry_type < 0 ) || - ( spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES ) || - ( spec[i].entry_index < 0 ) || - ( spec[i].entry_index > max_indices[spec[i].entry_type] ) ) { - - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "bad data in spec[%d] on entry to multi entry test #%d.", - i, test_num); - failure_mssg = msg; - } - i++; - } - - i = 0; - while ( ( pass ) && ( i < spec_size ) ) - { - if ( spec[i].insert_flag ) { - - insert_entry(cache_ptr, spec[i].entry_type, spec[i].entry_index, - spec[i].dirty_flag, spec[i].flags); - - } else { - - protect_entry(cache_ptr, spec[i].entry_type, spec[i].entry_index); - - unprotect_entry(cache_ptr, spec[i].entry_type, spec[i].entry_index, - (int)(spec[i].dirty_flag), spec[i].flags); - } - - total_entry_size += entry_sizes[spec[i].entry_type]; - - i++; - } - - if ( pass ) { - - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, flush_flags); - - if ( result < 0 ) { - - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "flush with flags 0x%x failed in multi entry test #%d.", - flush_flags, test_num); - failure_mssg = msg; - } - } - - i = 0; - while ( ( pass ) && ( i < spec_size ) ) - { - base_addr = entries[spec[i].entry_type]; - entry_ptr = &(base_addr[spec[i].entry_index]); - - if ( ( entry_ptr->loaded != spec[i].expected_loaded ) || - ( entry_ptr->cleared != spec[i].expected_cleared ) || - ( entry_ptr->flushed != spec[i].expected_flushed ) || - ( entry_ptr->destroyed != spec[i].expected_destroyed ) ) { - -#if 0 /* This is useful debugging code. Lets keep it around. */ - - HDfprintf(stdout, - "loaded = %d(%d), clrd = %d(%d), flshd = %d(%d), dest = %d(%d)\n", - (int)(entry_ptr->loaded), - (int)(spec[i].expected_loaded), - (int)(entry_ptr->cleared), - (int)(spec[i].expected_cleared), - (int)(entry_ptr->flushed), - (int)(spec[i].expected_flushed), - (int)(entry_ptr->destroyed), - (int)(spec[i].expected_destroyed)); - -#endif - - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "Bad status on entry %d after flush in multi entry test #%d.", - i, test_num); - failure_mssg = msg; - } - i++; - } - - if ( pass ) { - - if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0 ) - && - ( ( cache_ptr->index_len != spec_size ) - || - ( cache_ptr->index_size != total_entry_size ) - ) - ) - || - ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 ) - && - ( ( cache_ptr->index_len != 0 ) - || - ( cache_ptr->index_size != 0 ) - ) - ) - ) { - - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "Unexpected cache len/size after flush in multi entry test #%d.", - test_num); - failure_mssg = msg; - } - } - - /* clean up the cache to prep for the next test */ - if ( pass ) { - - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, - H5C__FLUSH_INVALIDATE_FLAG); - - if ( result < 0 ) { - - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "Flush failed on cleanup in multi entry test #%d.", - test_num); - failure_mssg = msg; - } - else if ( ( cache_ptr->index_len != 0 ) || - ( cache_ptr->index_size != 0 ) ) { - - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "Unexpected cache len/size after cleanup in multi entry test #%d.", - test_num); - failure_mssg = msg; - - } - } - - i = 0; - while ( ( pass ) && ( i < spec_size ) ) - { - base_addr = entries[spec[i].entry_type]; - entry_ptr = &(base_addr[spec[i].entry_index]); - - entry_ptr->loaded = FALSE; - entry_ptr->cleared = FALSE; - entry_ptr->flushed = FALSE; - entry_ptr->destroyed = FALSE; - - i++; - } - -} /* check_flush_cache__multi_entry_test() */ - - -/*------------------------------------------------------------------------- - * Function: check_flush_cache__single_entry() - * - * Purpose: Verify that flush_cache behaves as expected when the cache - * contains only one element. - * - * Return: void - * - * Programmer: John Mainzer - * 1/12/05 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static void -check_flush_cache__single_entry(H5C_t * cache_ptr) -{ - /* const char * fcn_name = "check_flush_cache__single_entry"; */ - - if ( cache_ptr == NULL ) { - - pass = FALSE; - failure_mssg = "cache_ptr NULL on entry to single entry case."; - } - else if ( ( cache_ptr->index_len != 0 ) || - ( cache_ptr->index_size != 0 ) ) { - - pass = FALSE; - failure_mssg = "cache not empty at beginning of single entry case."; - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 1, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ FALSE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__NO_FLAGS_SET, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 2, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ TRUE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__NO_FLAGS_SET, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 3, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ FALSE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 4, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ TRUE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 5, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ FALSE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 6, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ TRUE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 7, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ FALSE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 8, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ TRUE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 9, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ FALSE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 10, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ TRUE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 11, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ FALSE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 12, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ TRUE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 13, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ FALSE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | - H5C__FLUSH_INVALIDATE_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 14, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ TRUE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | - H5C__FLUSH_INVALIDATE_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 15, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ FALSE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 16, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ TRUE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 17, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ FALSE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__NO_FLAGS_SET, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 18, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ TRUE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__NO_FLAGS_SET, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 19, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ FALSE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 20, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ TRUE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 21, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ FALSE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 22, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ TRUE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 23, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ FALSE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 24, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ TRUE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 25, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ FALSE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 26, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ TRUE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 27, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ FALSE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 28, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ TRUE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 29, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ FALSE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | - H5C__FLUSH_INVALIDATE_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 30, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ TRUE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | - H5C__FLUSH_INVALIDATE_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 31, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ FALSE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 32, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ FALSE, - /* dirty_flag */ TRUE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_loaded */ TRUE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 33, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ FALSE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__NO_FLAGS_SET, - /* expected_loaded */ FALSE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 34, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ TRUE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__NO_FLAGS_SET, - /* expected_loaded */ FALSE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 35, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ FALSE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 36, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ TRUE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 37, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ FALSE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 38, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ TRUE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 39, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ FALSE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ FALSE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 40, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ TRUE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ FALSE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 41, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ FALSE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 42, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ TRUE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 43, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ FALSE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ FALSE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 44, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ TRUE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ FALSE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 45, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ FALSE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | - H5C__FLUSH_INVALIDATE_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 46, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ TRUE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | - H5C__FLUSH_INVALIDATE_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 47, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ FALSE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 48, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ TRUE, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 49, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ FALSE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__NO_FLAGS_SET, - /* expected_loaded */ FALSE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 50, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ TRUE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__NO_FLAGS_SET, - /* expected_loaded */ FALSE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 51, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ FALSE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 52, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ TRUE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 53, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ FALSE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 54, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ TRUE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 55, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ FALSE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 56, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ TRUE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 57, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ FALSE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 58, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ TRUE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 59, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ FALSE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 60, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ TRUE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ FALSE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 61, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ FALSE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | - H5C__FLUSH_INVALIDATE_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 62, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ TRUE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | - H5C__FLUSH_INVALIDATE_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ FALSE, - /* expected_flushed */ TRUE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 63, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ FALSE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ TRUE - ); - } - - if ( pass ) { - - check_flush_cache__single_entry_test - ( - /* cache_ptr */ cache_ptr, - /* test_num */ 64, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ TRUE, - /* dirty_flag */ TRUE, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_loaded */ FALSE, - /* expected_cleared */ TRUE, - /* expected_flushed */ FALSE, - /* expected_destroyed */ TRUE - ); - } - -} /* check_flush_cache__single_entry() */ - - -/*------------------------------------------------------------------------- - * Function: check_flush_cache__single_entry_test() - * - * Purpose: Run a single entry flush cache test. - * - * Return: void - * - * Programmer: John Mainzer - * 1/12/05 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static void -check_flush_cache__single_entry_test(H5C_t * cache_ptr, - int test_num, - int entry_type, - int entry_idx, - hbool_t insert_flag, - hbool_t dirty_flag, - unsigned int flags, - unsigned int flush_flags, - hbool_t expected_loaded, - hbool_t expected_cleared, - hbool_t expected_flushed, - hbool_t expected_destroyed) -{ - /* const char * fcn_name = "check_flush_cache__single_entry_test"; */ - static char msg[128]; - herr_t result; - test_entry_t * base_addr; - test_entry_t * entry_ptr; - - if ( cache_ptr == NULL ) { - - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "cache_ptr NULL on entry to single entry test #%d.", - test_num); - failure_mssg = msg; - } - else if ( ( cache_ptr->index_len != 0 ) || - ( cache_ptr->index_size != 0 ) ) { - - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "cache not empty at beginning of single entry test #%d.", - test_num); - failure_mssg = msg; - } - else if ( ( entry_type < 0 ) || ( entry_type >= NUMBER_OF_ENTRY_TYPES ) || - ( entry_idx < 0 ) || ( entry_idx > max_indices[entry_type] ) ) { - - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "Bad parameters on entry to single entry test #%d.", - test_num); - failure_mssg = msg; - } - - if ( pass ) { - - base_addr = entries[entry_type]; - entry_ptr = &(base_addr[entry_idx]); - - if ( insert_flag ) { - - insert_entry(cache_ptr, entry_type, entry_idx, dirty_flag, flags); - - } else { - - protect_entry(cache_ptr, entry_type, entry_idx); - - unprotect_entry(cache_ptr, entry_type, entry_idx, - (int)dirty_flag, flags); - } - } - - if ( pass ) { - - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, flush_flags); - - if ( result < 0 ) { - - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "flush with flags 0x%x failed in single entry test #%d.", - flush_flags, test_num); - failure_mssg = msg; - } - else if ( ( entry_ptr->loaded != expected_loaded ) || - ( entry_ptr->cleared != expected_cleared ) || - ( entry_ptr->flushed != expected_flushed ) || - ( entry_ptr->destroyed != expected_destroyed ) ) { - - HDfprintf(stdout, - "loaded = %d(%d), clrd = %d(%d), flshd = %d(%d), dest = %d(%d)\n", - (int)(entry_ptr->loaded), - (int)expected_loaded, - (int)(entry_ptr->cleared), - (int)expected_cleared, - (int)(entry_ptr->flushed), - (int)expected_flushed, - (int)(entry_ptr->destroyed), - (int)expected_destroyed); - - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "Unexpected entry status after flush in single entry test #%d.", - test_num); - failure_mssg = msg; - } - else if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0 ) - && - ( ( cache_ptr->index_len != 1 ) - || - ( cache_ptr->index_size != entry_sizes[entry_type] ) - ) - ) - || - ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 ) - && - ( ( cache_ptr->index_len != 0 ) - || - ( cache_ptr->index_size != 0 ) - ) - ) - ) { - - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "Unexpected cache len/size after flush in single entry test #%d.", - test_num); - failure_mssg = msg; - } - } - - - /* clean up the cache to prep for the next test */ - if ( pass ) { - - result = H5C_flush_cache(NULL, -1, -1, cache_ptr, - H5C__FLUSH_INVALIDATE_FLAG); - - if ( result < 0 ) { - - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "Flush failed on cleanup in single entry test #%d.", - test_num); - failure_mssg = msg; - } - else if ( ( cache_ptr->index_len != 0 ) || - ( cache_ptr->index_size != 0 ) ) { - - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "Unexpected cache len/size after cleanup in single entry test #%d.", - test_num); - failure_mssg = msg; - - } else { - - entry_ptr->loaded = FALSE; - entry_ptr->cleared = FALSE; - entry_ptr->flushed = FALSE; - entry_ptr->destroyed = FALSE; - } - } -} /* check_flush_cache__single_entry_test() */ - - -/*------------------------------------------------------------------------- - * Function: check_flush_protected_err() - * - * Purpose: Verify that an attempt to flush the cache when it contains - * a protected entry will generate an error. - * - * Return: void - * - * Programmer: John Mainzer - * 6/24/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static void -check_flush_protected_err(void) -{ - const char * fcn_name = "check_flush_protected_err"; - H5C_t * cache_ptr = NULL; - - TESTING("flush cache with protected entry error"); - - pass = TRUE; - - /* allocate a cache, protect an entry, and try to flush. This - * should fail. Unprotect the entry and flush again -- should - * succeed. - */ - - if ( pass ) { - - reset_entries(); - - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); - - protect_entry(cache_ptr, 0, 0); - - if ( H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET) - >= 0 ) { - - pass = FALSE; - failure_mssg = "flush succeeded on cache with protected entry.\n"; - - } else { - - unprotect_entry(cache_ptr, 0, 0, TRUE, H5C__NO_FLAGS_SET); - - if ( H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET) - < 0 ) { - - pass = FALSE; - failure_mssg = "flush failed after unprotect.\n"; - - } else { - - takedown_cache(cache_ptr, FALSE, FALSE); - } - } - } - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -} /* check_flush_protected_err() */ - - -/*------------------------------------------------------------------------- - * Function: check_destroy_protected_err() - * - * Purpose: Verify that an attempt to destroy the cache when it contains - * a protected entry will generate an error. - * - * Return: void - * - * Programmer: John Mainzer - * 6/24/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static void -check_destroy_protected_err(void) -{ - const char * fcn_name = "check_destroy_protected_err"; - H5C_t * cache_ptr = NULL; - - TESTING("destroy cache with protected entry error"); - - pass = TRUE; - - /* allocate a cache, protect an entry, and try to flush. This - * should fail. Unprotect the entry and flush again -- should - * succeed. - */ - - if ( pass ) { - - reset_entries(); - - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); - - protect_entry(cache_ptr, 0, 0); - - if ( H5C_dest(NULL, -1, -1, cache_ptr) >= 0 ) { - - pass = FALSE; - failure_mssg = "destroy succeeded on cache with protected entry.\n"; - - } else { - - unprotect_entry(cache_ptr, 0, 0, TRUE, H5C__NO_FLAGS_SET); - - if ( H5C_dest(NULL, -1, -1, cache_ptr) < 0 ) { - - pass = FALSE; - failure_mssg = "destroy failed after unprotect.\n"; - - } - } - } - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -} /* check_destroy_protected_err() */ - - -/*------------------------------------------------------------------------- - * Function: check_duplicate_insert_err() - * - * Purpose: Verify that an attempt to insert and entry that is - * alread in the cache will generate an error. - * - * Return: void - * - * Programmer: John Mainzer - * 6/24/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static void -check_duplicate_insert_err(void) -{ - const char * fcn_name = "check_duplicate_insert_err"; - herr_t result; - H5C_t * cache_ptr = NULL; - test_entry_t * base_addr; - test_entry_t * entry_ptr; - - TESTING("duplicate entry insertion error"); - - pass = TRUE; - - /* allocate a cache, protect an entry, and then try to insert - * the entry again. This should fail. Unprotect the entry and - * destroy the cache -- should succeed. - */ - - if ( pass ) { - - reset_entries(); - - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); - - protect_entry(cache_ptr, 0, 0); - - if ( pass ) { - - base_addr = entries[0]; - entry_ptr = &(base_addr[0]); - - result = H5C_insert_entry(NULL, -1, -1, cache_ptr, - &(types[0]), entry_ptr->addr, - (void *)entry_ptr, H5C__NO_FLAGS_SET); - - if ( result >= 0 ) { - - pass = FALSE; - failure_mssg = "insert of duplicate entry succeeded.\n"; - - } else { - - unprotect_entry(cache_ptr, 0, 0, TRUE, H5C__NO_FLAGS_SET); - - takedown_cache(cache_ptr, FALSE, FALSE); - } - } - } - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -} /* check_duplicate_insert_err() */ - - -/*------------------------------------------------------------------------- - * Function: check_rename_err() - * - * Purpose: Verify that an attempt to rename an entry to the address - * of an existing entry will generate an error. - * - * Return: void - * - * Programmer: John Mainzer - * 6/24/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static void -check_rename_err(void) -{ - const char * fcn_name = "check_rename_err()"; - herr_t result; - H5C_t * cache_ptr = NULL; - test_entry_t * entry_0_0_ptr; - test_entry_t * entry_0_1_ptr; - test_entry_t * entry_1_0_ptr; - - TESTING("rename to existing entry errors"); - - pass = TRUE; - - /* allocate a cache, and insert several entries. Try to rename - * entries to other entries resident in the cache. This should - * fail. Destroy the cache -- should succeed. - */ - - if ( pass ) { - - reset_entries(); - - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); - - insert_entry(cache_ptr, 0, 0, TRUE, H5C__NO_FLAGS_SET); - insert_entry(cache_ptr, 0, 1, TRUE, H5C__NO_FLAGS_SET); - insert_entry(cache_ptr, 1, 0, TRUE, H5C__NO_FLAGS_SET); - - entry_0_0_ptr = &((entries[0])[0]); - entry_0_1_ptr = &((entries[0])[1]); - entry_1_0_ptr = &((entries[1])[0]); - } - - if ( pass ) { - - result = H5C_rename_entry(cache_ptr, &(types[0]), - entry_0_0_ptr->addr, entry_0_1_ptr->addr); - - if ( result >= 0 ) { - - pass = FALSE; - failure_mssg = "rename to addr of same type succeeded.\n"; - } - } - - if ( pass ) { - - result = H5C_rename_entry(cache_ptr, &(types[0]), - entry_0_0_ptr->addr, entry_1_0_ptr->addr); - - if ( result >= 0 ) { - - pass = FALSE; - failure_mssg = "rename to addr of different type succeeded.\n"; - } - } - - if ( pass ) { - - takedown_cache(cache_ptr, FALSE, FALSE); - } - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -} /* check_rename_err() */ - - -/*------------------------------------------------------------------------- - * Function: check_double_protect_err() - * - * Purpose: Verify that an attempt to protect an entry that is already - * protected will generate an error. - * - * Return: void - * - * Programmer: John Mainzer - * 6/24/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static void -check_double_protect_err(void) -{ - const char * fcn_name = "check_double_protect_err()"; - H5C_t * cache_ptr = NULL; - test_entry_t * entry_ptr; - H5C_cache_entry_t * cache_entry_ptr; - - TESTING("protect a protected entry error"); - - pass = TRUE; - - /* allocate a cache, protect an entry, and then try to protect - * the entry again. This should fail. Unprotect the entry and - * destroy the cache -- should succeed. - */ - - if ( pass ) { - - reset_entries(); - - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); - - protect_entry(cache_ptr, 0, 0); - - entry_ptr = &((entries[0])[0]); - } - - if ( pass ) { - - cache_entry_ptr = H5C_protect(NULL, -1, -1, cache_ptr, &(types[0]), - entry_ptr->addr, NULL, NULL); - - if ( cache_entry_ptr != NULL ) { - - pass = FALSE; - failure_mssg = "attempt to protect a protected entry succeeded.\n"; - } - } - - if ( pass ) { - - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); - } - - if ( pass ) { - - takedown_cache(cache_ptr, FALSE, FALSE); - } - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -} /* check_double_protect_err() */ - - -/*------------------------------------------------------------------------- - * Function: check_double_unprotect_err() - * - * Purpose: Verify that an attempt to unprotect an entry that is already - * unprotected will generate an error. - * - * Return: 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. - * - *------------------------------------------------------------------------- - */ - -static void -check_double_unprotect_err(void) -{ - const char * fcn_name = "check_double_unprotect_err()"; - herr_t result; - H5C_t * cache_ptr = NULL; - test_entry_t * entry_ptr; - - TESTING("unprotect an unprotected entry error"); - - pass = TRUE; - - /* allocate a cache, protect an entry, unprotect it, and then try to - * unprotect the entry again. This should fail. Destroy the cache - * -- should succeed. - */ - - if ( pass ) { - - reset_entries(); - - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); - - protect_entry(cache_ptr, 0, 0); - - unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); - - entry_ptr = &((entries[0])[0]); - } - - if ( pass ) { - - result = H5C_unprotect(NULL, -1, -1, cache_ptr, &(types[0]), - entry_ptr->addr, (void *)entry_ptr, - H5C__NO_FLAGS_SET, 0); - - if ( result > 0 ) { - - pass = FALSE; - failure_mssg = - "attempt to unprotect an unprotected entry succeeded 1.\n"; - } - } - - if ( pass ) { - - takedown_cache(cache_ptr, FALSE, FALSE); - } - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -} /* check_double_unprotect_err() */ - - -/*------------------------------------------------------------------------- - * Function: check_auto_cache_resize() - * - * Purpose: Exercise the automatic cache resizing functionality. - * The objective is to operate the auto-resize code in - * all possible modes. Unfortunately, there are quite - * a few of them. - * - * Return: void - * - * Programmer: John Mainzer - * 10/29/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -hbool_t rpt_fcn_called = FALSE; -enum H5C_resize_status rpt_status; - -void test_rpt_fcn(UNUSED H5C_t * cache_ptr, - UNUSED int32_t version, - UNUSED double hit_rate, - UNUSED enum H5C_resize_status status, - UNUSED size_t old_max_cache_size, - UNUSED size_t new_max_cache_size, - UNUSED size_t old_min_clean_size, - UNUSED size_t new_min_clean_size); - -void test_rpt_fcn(UNUSED H5C_t * cache_ptr, - UNUSED int32_t version, - UNUSED double hit_rate, - UNUSED enum H5C_resize_status status, - UNUSED size_t old_max_cache_size, - UNUSED size_t new_max_cache_size, - UNUSED size_t old_min_clean_size, - UNUSED size_t new_min_clean_size) -{ - rpt_fcn_called = TRUE; - rpt_status = status; -} - -static void -check_auto_cache_resize(void) -{ - const char * fcn_name = "check_auto_cache_resize()"; - hbool_t show_progress = FALSE; - herr_t result; - int32_t i; - int32_t checkpoint = 0; - H5C_t * cache_ptr = NULL; - H5C_auto_size_ctl_t auto_size_ctl = + if ( pass ) { - /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* H5C_auto_resize_report_fcn rpt_fcn = */ test_rpt_fcn, - - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (512 * 1024), - - /* double min_clean_fraction = */ 0.5, - - /* size_t max_size = */ (14 * 1024 * 1024), - /* size_t min_size = */ (512 * 1024), - - /* int64_t epoch_length = */ 1000, - - - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - - /* double lower_hr_threshold = */ 0.75, - - /* double increment = */ 2.0, - - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - - - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, - - /* double upper_hr_threshold = */ 0.995, - - /* double decrement = */ 0.1, - - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - - /* int32_t epochs_before_eviction = */ 3, - - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05 - }; - - TESTING("automatic cache resizing"); - - pass = TRUE; - - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* allocate a cache, enable automatic cache resizing, and then force - * the cache through all its operational modes. Verify that all - * performs as expected. - */ - - if ( pass ) { - - reset_entries(); + int test_num = 5; + unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG; + int spec_size = 8; + struct flush_cache_test_spec spec[8] = + { + { + /* entry_num = */ 0, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 100, + /* insert_flag = */ FALSE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 1, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 75, + /* insert_flag = */ FALSE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 2, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 25, + /* insert_flag = */ TRUE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 3, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 50, + /* insert_flag = */ TRUE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 4, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 10, + /* insert_flag = */ FALSE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 5, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 20, + /* insert_flag = */ FALSE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 6, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 30, + /* insert_flag = */ TRUE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 7, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 40, + /* insert_flag = */ TRUE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ TRUE + } + }; - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); + check_flush_cache__multi_entry_test(cache_ptr, test_num, + flush_flags, spec_size, spec); } - if ( pass ) { - - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - if ( result != SUCCEED ) { + if ( pass ) + { + int test_num = 6; + unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_MARKED_ENTRIES_FLAG; + int spec_size = 8; + struct flush_cache_test_spec spec[8] = + { + { + /* entry_num = */ 0, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 100, + /* insert_flag = */ FALSE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 1, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 75, + /* insert_flag = */ FALSE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 2, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 25, + /* insert_flag = */ TRUE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 3, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 50, + /* insert_flag = */ TRUE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 4, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 10, + /* insert_flag = */ FALSE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 5, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 20, + /* insert_flag = */ FALSE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 6, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 30, + /* insert_flag = */ TRUE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 7, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 40, + /* insert_flag = */ TRUE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ TRUE + } + }; - pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n"; - } + check_flush_cache__multi_entry_test(cache_ptr, test_num, + flush_flags, spec_size, spec); } - if ( pass ) { - if ( ( cache_ptr->max_cache_size != (512 * 1024) ) || - ( cache_ptr->min_clean_size != (256 * 1024) ) ) { + if ( pass ) + { + int test_num = 7; + unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG | + H5C__FLUSH_MARKED_ENTRIES_FLAG; + int spec_size = 8; + struct flush_cache_test_spec spec[8] = + { + { + /* entry_num = */ 0, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 100, + /* insert_flag = */ FALSE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 1, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 75, + /* insert_flag = */ FALSE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 2, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 25, + /* insert_flag = */ TRUE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 3, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 50, + /* insert_flag = */ TRUE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 4, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 10, + /* insert_flag = */ FALSE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 5, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 20, + /* insert_flag = */ FALSE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 6, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 30, + /* insert_flag = */ TRUE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 7, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 40, + /* insert_flag = */ TRUE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + } + }; - pass = FALSE; - failure_mssg = "bad cache size after initialization.\n"; - } + check_flush_cache__multi_entry_test(cache_ptr, test_num, + flush_flags, spec_size, spec); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force low hit rate with cache not full -- should result in not - * full status. - */ - if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + if ( pass ) + { + int test_num = 8; + unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG | + H5C__FLUSH_MARKED_ENTRIES_FLAG; + int spec_size = 8; + struct flush_cache_test_spec spec[8] = { - protect_entry(cache_ptr, PICO_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, PICO_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } - - if ( ( ! rpt_fcn_called ) || - ( rpt_status != not_full ) || - ( cache_ptr->max_cache_size != (512 * 1024) ) || - ( cache_ptr->min_clean_size != (256 * 1024) ) ) { + { + /* entry_num = */ 0, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 100, + /* insert_flag = */ FALSE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 1, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 75, + /* insert_flag = */ FALSE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 2, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 25, + /* insert_flag = */ TRUE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 3, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 50, + /* insert_flag = */ TRUE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 4, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 10, + /* insert_flag = */ FALSE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 5, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 20, + /* insert_flag = */ FALSE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 6, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 30, + /* insert_flag = */ TRUE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 7, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 40, + /* insert_flag = */ TRUE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ TRUE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ TRUE + } + }; - pass = FALSE; - failure_mssg = "Unexpected cache size change results 1.\n"; - } + check_flush_cache__multi_entry_test(cache_ptr, test_num, + flush_flags, spec_size, spec); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force low hit rate with cache full -- should result in increase - * of cache size from .5 to 1 meg. - */ - if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + /* verify that all other flags are ignored */ + if ( pass ) + { + int test_num = 9; + unsigned int flush_flags = (unsigned) + ~(H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG | + H5C__FLUSH_MARKED_ENTRIES_FLAG); + int spec_size = 8; + struct flush_cache_test_spec spec[8] = { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } - - if ( ( ! rpt_fcn_called ) || - ( rpt_status != increase ) || - ( cache_ptr->max_cache_size != (1 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (512 * 1024) ) ) { + { + /* entry_num = */ 0, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 100, + /* insert_flag = */ FALSE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 1, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 75, + /* insert_flag = */ FALSE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 2, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 25, + /* insert_flag = */ TRUE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 3, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 50, + /* insert_flag = */ TRUE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 4, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 10, + /* insert_flag = */ FALSE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 5, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 20, + /* insert_flag = */ FALSE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ TRUE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 6, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 30, + /* insert_flag = */ TRUE, + /* dirty_flag = */ FALSE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 7, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 40, + /* insert_flag = */ TRUE, + /* dirty_flag = */ TRUE, + /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* expected_loaded = */ FALSE, + /* expected_cleared = */ FALSE, + /* expected_flushed = */ TRUE, + /* expected_destroyed = */ FALSE + } + }; - pass = FALSE; - failure_mssg = "Unexpected cache size change results 2.\n"; - } + check_flush_cache__multi_entry_test(cache_ptr, test_num, + flush_flags, spec_size, spec); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force low hit rate with cache not full -- should result in not - * full status. - */ - if ( pass ) { +} /* check_flush_cache__multi_entry() */ - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, PICO_ENTRY_TYPE, i); + +/*------------------------------------------------------------------------- + * Function: check_flush_cache__multi_entry_test() + * + * Purpose: Run a multi entry flush cache test. + * + * Return: void + * + * Programmer: John Mainzer + * 1/13/05 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ - if ( pass ) { - unprotect_entry(cache_ptr, PICO_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } +static void +check_flush_cache__multi_entry_test(H5C_t * cache_ptr, + int test_num, + unsigned int flush_flags, + int spec_size, + struct flush_cache_test_spec spec[]) +{ + /* const char * fcn_name = "check_flush_cache__multi_entry_test"; */ + static char msg[128]; + herr_t result; + int i; + size_t total_entry_size = 0; + test_entry_t * base_addr; + test_entry_t * entry_ptr; - if ( ( ! rpt_fcn_called ) || - ( rpt_status != not_full ) || - ( cache_ptr->max_cache_size != (1 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (512 * 1024) ) ) { + if ( cache_ptr == NULL ) { - pass = FALSE; - failure_mssg = "Unexpected cache size change results 3.\n"; - } + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "cache_ptr NULL on entry to single entry test #%d.", + test_num); + failure_mssg = msg; } + else if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) { - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force low hit rate with cache full again -- should result in increase - * of cache size from 1 to 2 meg. - */ - if ( pass ) { - - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } - - if ( ( ! rpt_fcn_called ) || - ( rpt_status != increase ) || - ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + pass = FALSE; - pass = FALSE; - failure_mssg = "Unexpected cache size change results 4.\n"; - } + HDsnprintf(msg, (size_t)128, + "cache not empty at beginning of multi entry test #%d.", + test_num); + failure_mssg = msg; } + else if ( ( spec_size < 1 ) || ( spec == NULL ) ) { - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force low hit rate with cache full again -- should result in increase - * of cache size from 2 to 4 meg. - */ - if ( pass ) { - - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "missing/bad test spec on entry to multi entry test #%d.", + test_num); + failure_mssg = msg; + } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != increase ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + i = 0; + while ( ( pass ) && ( i < spec_size ) ) + { + if ( ( spec[i].entry_num != i ) || + ( spec[i].entry_type < 0 ) || + ( spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES ) || + ( spec[i].entry_index < 0 ) || + ( spec[i].entry_index > max_indices[spec[i].entry_type] ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 5.\n"; + HDsnprintf(msg, (size_t)128, + "bad data in spec[%d] on entry to multi entry test #%d.", + i, test_num); + failure_mssg = msg; } + i++; } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + i = 0; + while ( ( pass ) && ( i < spec_size ) ) + { + if ( spec[i].insert_flag ) { - /* force low hit rate with cache full again -- should result in increase - * of cache size from 4 to 8 meg. - */ - if ( pass ) { + insert_entry(cache_ptr, spec[i].entry_type, spec[i].entry_index, + spec[i].dirty_flag, spec[i].flags); - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + } else { - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; + protect_entry(cache_ptr, spec[i].entry_type, spec[i].entry_index); + + unprotect_entry(cache_ptr, spec[i].entry_type, spec[i].entry_index, + (int)(spec[i].dirty_flag), spec[i].flags); } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != increase ) || - ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + total_entry_size += entry_sizes[spec[i].entry_type]; - pass = FALSE; - failure_mssg = "Unexpected cache size change results 6.\n"; - } + i++; } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force low hit rate with cache full again -- should result in increase - * of cache size from 8 to 12 meg. Note that max increase reduced the - * size of the increase. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + result = H5C_flush_cache(NULL, -1, -1, cache_ptr, flush_flags); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != increase ) || - ( cache_ptr->max_cache_size != (12 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (6 * 1024 * 1024) ) ) { + if ( result < 0 ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 7.\n"; + HDsnprintf(msg, (size_t)128, + "flush with flags 0x%x failed in multi entry test #%d.", + flush_flags, test_num); + failure_mssg = msg; } } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + i = 0; + while ( ( pass ) && ( i < spec_size ) ) + { + base_addr = entries[spec[i].entry_type]; + entry_ptr = &(base_addr[spec[i].entry_index]); - /* force low hit rate with cache full again -- should result in increase - * of cache size from 12 to 14 meg. - */ - if ( pass ) { + if ( ( entry_ptr->loaded != spec[i].expected_loaded ) || + ( entry_ptr->cleared != spec[i].expected_cleared ) || + ( entry_ptr->flushed != spec[i].expected_flushed ) || + ( entry_ptr->destroyed != spec[i].expected_destroyed ) ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); +#if 0 /* This is useful debugging code. Lets keep it around. */ - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + HDfprintf(stdout, + "loaded = %d(%d), clrd = %d(%d), flshd = %d(%d), dest = %d(%d)\n", + (int)(entry_ptr->loaded), + (int)(spec[i].expected_loaded), + (int)(entry_ptr->cleared), + (int)(spec[i].expected_cleared), + (int)(entry_ptr->flushed), + (int)(spec[i].expected_flushed), + (int)(entry_ptr->destroyed), + (int)(spec[i].expected_destroyed)); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != increase ) || - ( cache_ptr->max_cache_size != (14 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (7 * 1024 * 1024) ) ) { +#endif pass = FALSE; - failure_mssg = "Unexpected cache size change results 8.\n"; + HDsnprintf(msg, (size_t)128, + "Bad status on entry %d after flush in multi entry test #%d.", + i, test_num); + failure_mssg = msg; } + i++; } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force low hit rate with cache full and at maximum size -- should - * in no change in size and a result of at_max_size. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } - - if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_max_size ) || - ( cache_ptr->max_cache_size != (14 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (7 * 1024 * 1024) ) ) { + if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0 ) + && + ( ( cache_ptr->index_len != spec_size ) + || + ( cache_ptr->index_size != total_entry_size ) + ) + ) + || + ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 ) + && + ( ( cache_ptr->index_len != 0 ) + || + ( cache_ptr->index_size != 0 ) + ) + ) + ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 9.\n"; + HDsnprintf(msg, (size_t)128, + "Unexpected cache len/size after flush in multi entry test #%d.", + test_num); + failure_mssg = msg; } } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force high hit rate with cache full and at maximum size -- should - * result in a decrease from 14 to 13 Meg -- note that max decrease - * reduced the size of the reduction - */ + /* clean up the cache to prep for the next test */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + result = H5C_flush_cache(NULL, -1, -1, cache_ptr, + H5C__FLUSH_INVALIDATE_FLAG); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (13 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (6 * 1024 * 1024 + 512 * 1024) ) ) { + if ( result < 0 ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 10.\n"; + HDsnprintf(msg, (size_t)128, + "Flush failed on cleanup in multi entry test #%d.", + test_num); + failure_mssg = msg; } - } + else if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) { - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "Unexpected cache len/size after cleanup in multi entry test #%d.", + test_num); + failure_mssg = msg; - /* the current cache configuration is unconvenient for testing cache - * size reduction, so lets change it some something easier to work - * with. - */ + } + } - if ( pass ) { + i = 0; + while ( ( pass ) && ( i < spec_size ) ) + { + base_addr = entries[spec[i].entry_type]; + entry_ptr = &(base_addr[spec[i].entry_index]); - auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - auto_size_ctl.rpt_fcn = test_rpt_fcn; + entry_ptr->loaded = FALSE; + entry_ptr->cleared = FALSE; + entry_ptr->flushed = FALSE; + entry_ptr->destroyed = FALSE; - auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 4 * 1000 * 1000 + 10; + i++; + } - auto_size_ctl.min_clean_fraction = 0.1; +} /* check_flush_cache__multi_entry_test() */ - auto_size_ctl.max_size = 8 * 1000 * 1000; - auto_size_ctl.min_size = 500 * 1000; + +/*------------------------------------------------------------------------- + * Function: check_flush_cache__single_entry() + * + * Purpose: Verify that flush_cache behaves as expected when the cache + * contains only one element. + * + * Return: void + * + * Programmer: John Mainzer + * 1/12/05 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ - auto_size_ctl.epoch_length = 1000; +static void +check_flush_cache__single_entry(H5C_t * cache_ptr) +{ + /* const char * fcn_name = "check_flush_cache__single_entry"; */ + if ( cache_ptr == NULL ) { - auto_size_ctl.incr_mode = H5C_incr__threshold; + pass = FALSE; + failure_mssg = "cache_ptr NULL on entry to single entry case."; + } + else if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) { - auto_size_ctl.lower_hr_threshold = 0.75; + pass = FALSE; + failure_mssg = "cache not empty at beginning of single entry case."; + } - auto_size_ctl.increment = 2.0; + if ( pass ) { - auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (4 * 1000 * 1000); + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 1, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ FALSE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__NO_FLAGS_SET, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); + } + if ( pass ) { - auto_size_ctl.decr_mode = H5C_decr__threshold; + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 2, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ TRUE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__NO_FLAGS_SET, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ FALSE + ); + } - auto_size_ctl.upper_hr_threshold = 0.995; + if ( pass ) { - auto_size_ctl.decrement = 0.5; + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 3, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ FALSE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); + } - auto_size_ctl.apply_max_decrement = TRUE; - auto_size_ctl.max_decrement = (1 * 1000 * 1000); + if ( pass ) { - auto_size_ctl.epochs_before_eviction = 3; + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 4, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ TRUE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); + } - auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05; + if ( pass ) { - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 5, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ FALSE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ TRUE + ); + } - if ( result != SUCCEED ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 2.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 6, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ TRUE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ TRUE + ); } if ( pass ) { - if ( ( cache_ptr->max_cache_size != (4 * 1000 * 1000 + 10) ) || - ( cache_ptr->min_clean_size != (400 * 1000 + 1) ) ) { - - pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 1.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 7, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ FALSE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force high hit rate -- should result in a decrease from ~4 to ~3 - * M -- note that max decrease reduces the size of the reduction - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } - - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (3 * 1000 * 1000 + 10) ) || - ( cache_ptr->min_clean_size != (300 * 1000 + 1) ) ) { - - pass = FALSE; - failure_mssg = "Unexpected cache size change results 11.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 8, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ TRUE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force high hit rate again -- should result in a decrease from ~3 - * to ~2 M -- again note that max decrease reduces the size of the - * reduction. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } - - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (2 * 1000 * 1000 + 10) ) || - ( cache_ptr->min_clean_size != (200 * 1000 + 1) ) ) { - - pass = FALSE; - failure_mssg = "Unexpected cache size change results 12.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 9, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ FALSE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ TRUE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force high hit rate again -- should result in a decrease from ~2 - * to ~1 M -- again note that max decrease reduces the size of the - * reduction, but only by five bites. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } - - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (1 * 1000 * 1000 + 10) ) || - ( cache_ptr->min_clean_size != (100 * 1000 + 1) ) ) { - - pass = FALSE; - failure_mssg = "Unexpected cache size change results 13.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 10, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ TRUE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ TRUE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force high hit rate again -- should result in a decrease from ~1 - * to ~0.5 M -- max decrease is no longer a factor. New size is five - * bytes above the minimum. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 11, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ FALSE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); + } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (500 * 1000 + 5) ) || - ( cache_ptr->min_clean_size != (50 * 1000) ) ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "Unexpected cache size change results 14.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 12, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ TRUE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force high hit rate again -- should result in a decrease of five - * bytes to the minimum cache size. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 13, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ FALSE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_INVALIDATE_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ TRUE + ); + } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (500 * 1000) ) || - ( cache_ptr->min_clean_size != (50 * 1000) ) ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "Unexpected cache size change results 15.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 14, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ TRUE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_INVALIDATE_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ TRUE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force high hit rate again -- Already at minimum size so no change in - * cache size and result should be at_min_size. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 15, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ FALSE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG | + H5C__FLUSH_MARKED_ENTRIES_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ TRUE + ); + } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_min_size ) || - ( cache_ptr->max_cache_size != (500 * 1000) ) || - ( cache_ptr->min_clean_size != (50 * 1000) ) ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "Unexpected cache size change results 16.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 16, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ TRUE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG | + H5C__FLUSH_MARKED_ENTRIES_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ TRUE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force in range hit rate -- should be no change in cache size, - * and result should be in_spec. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 900 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 17, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ FALSE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__NO_FLAGS_SET, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); + } - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i + 1000); + if ( pass ) { - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i + 1000, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 18, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ TRUE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__NO_FLAGS_SET, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ FALSE + ); + } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (500 * 1000) ) || - ( cache_ptr->min_clean_size != (50 * 1000) ) ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "Unexpected cache size change results 17.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 19, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ FALSE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force low hit rate with cache full -- should - * increase cache size from .5 to 1 M. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 20, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ TRUE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); + } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != increase ) || - ( cache_ptr->max_cache_size != (1 * 1000 * 1000) ) || - ( cache_ptr->min_clean_size != (100 * 1000) ) ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "Unexpected cache size change results 18.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 21, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ FALSE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ TRUE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force high hit rate -- should result in a decrease to the - * minimum cache size. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 22, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ TRUE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ TRUE + ); + } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (500 * 1000) ) || - ( cache_ptr->min_clean_size != (50 * 1000) ) ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "Unexpected cache size change results 19.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 23, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ FALSE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( pass ) { - /****************************************************************** - * now do some tests with the maximum increase and decrease sizes - * disabled. - ******************************************************************/ + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 24, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ TRUE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ FALSE + ); + } if ( pass ) { - auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - auto_size_ctl.rpt_fcn = test_rpt_fcn; - - auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 4 * 1024 * 1024; + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 25, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ FALSE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ TRUE + ); + } - auto_size_ctl.min_clean_fraction = 0.5; + if ( pass ) { - auto_size_ctl.max_size = 16 * 1024 * 1024; - auto_size_ctl.min_size = 1 * 1024 * 1024; + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 26, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ TRUE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ TRUE + ); + } - auto_size_ctl.epoch_length = 1000; + if ( pass ) { + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 27, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ FALSE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); + } - auto_size_ctl.incr_mode = H5C_incr__threshold; + if ( pass ) { - auto_size_ctl.lower_hr_threshold = 0.75; + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 28, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ TRUE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); + } - auto_size_ctl.increment = 4.0; + if ( pass ) { - auto_size_ctl.apply_max_increment = FALSE; - auto_size_ctl.max_increment = (4 * 1024 * 1024); + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 29, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ FALSE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_INVALIDATE_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ TRUE + ); + } + if ( pass ) { - auto_size_ctl.decr_mode = H5C_decr__threshold; + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 30, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ TRUE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_INVALIDATE_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ TRUE + ); + } - auto_size_ctl.upper_hr_threshold = 0.995; + if ( pass ) { - auto_size_ctl.decrement = 0.25; + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 31, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ FALSE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG | + H5C__FLUSH_MARKED_ENTRIES_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ TRUE + ); + } - auto_size_ctl.apply_max_decrement = FALSE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); + if ( pass ) { - auto_size_ctl.epochs_before_eviction = 3; + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 32, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ FALSE, + /* dirty_flag */ TRUE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG | + H5C__FLUSH_MARKED_ENTRIES_FLAG, + /* expected_loaded */ TRUE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ TRUE + ); + } - auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05; + if ( pass ) { - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 33, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ FALSE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__NO_FLAGS_SET, + /* expected_loaded */ FALSE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ FALSE + ); + } - if ( result != SUCCEED ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 3.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 34, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ TRUE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__NO_FLAGS_SET, + /* expected_loaded */ FALSE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ FALSE + ); } if ( pass ) { - if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { - - pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 2.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 35, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ FALSE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force high hit rate -- should result in a decrease to the - * minimum cache size. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 36, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ TRUE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); + } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (1 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (512 * 1024) ) ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "Unexpected cache size change results 20.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 37, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ FALSE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ TRUE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force low hit rate with cache full -- should increase cache size - * from 1 to 4 Meg. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 38, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ TRUE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ TRUE + ); + } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != increase ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "Unexpected cache size change results 21.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 39, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ FALSE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ FALSE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force low hit rate again with cache full -- should increase cache - * size from 4 to 16 Meg. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 40, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ TRUE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ FALSE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); + } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != increase ) || - ( cache_ptr->max_cache_size != (16 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != ( 8 * 1024 * 1024) ) ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "Unexpected cache size change results 22.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 41, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ FALSE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ TRUE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force high hit rate -- should result in a decrease cache size from - * 16 to 4 Meg. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 42, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ TRUE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ TRUE + ); + } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "Unexpected cache size change results 23.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 43, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ FALSE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ FALSE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( pass ) { - /****************************************************************** - * We have tested the threshold increment and decrement modes. - * must now test the ageout decrement mode. - * - * Reconfigure the cache for this testing. - ******************************************************************/ + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 44, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ TRUE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ FALSE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); + } if ( pass ) { - auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - auto_size_ctl.rpt_fcn = test_rpt_fcn; - - auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 8 * 1024 * 1024; - - auto_size_ctl.min_clean_fraction = 0.5; - - auto_size_ctl.max_size = 8 * 1024 * 1024; - auto_size_ctl.min_size = 512 * 1024; - - auto_size_ctl.epoch_length = 1000; - - - auto_size_ctl.incr_mode = H5C_incr__threshold; - - auto_size_ctl.lower_hr_threshold = 0.75; + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 45, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ FALSE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_INVALIDATE_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ TRUE + ); + } - auto_size_ctl.increment = 2.0; + if ( pass ) { - auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (4 * 1024 * 1024); + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 46, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ TRUE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_INVALIDATE_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ TRUE + ); + } + if ( pass ) { - auto_size_ctl.decr_mode = H5C_decr__age_out; + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 47, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ FALSE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG | + H5C__FLUSH_MARKED_ENTRIES_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ TRUE + ); + } - auto_size_ctl.upper_hr_threshold = 0.995; + if ( pass ) { - auto_size_ctl.decrement = 0.5; + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 48, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ TRUE, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG | + H5C__FLUSH_MARKED_ENTRIES_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ TRUE + ); + } - auto_size_ctl.apply_max_decrement = FALSE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); + if ( pass ) { - auto_size_ctl.epochs_before_eviction = 3; + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 49, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ FALSE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__NO_FLAGS_SET, + /* expected_loaded */ FALSE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ FALSE + ); + } - auto_size_ctl.apply_empty_reserve = FALSE; - auto_size_ctl.empty_reserve = 0.05; + if ( pass ) { - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 50, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ TRUE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__NO_FLAGS_SET, + /* expected_loaded */ FALSE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ FALSE + ); + } - if ( result != SUCCEED ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 4.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 51, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ FALSE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); } if ( pass ) { - if ( ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { - - pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 3.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 52, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ TRUE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( pass ) { + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 53, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ FALSE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ TRUE + ); + } - /* fill the cache with 1024 byte entries -- nothing should happen - * for three epochs while the markers are inserted into the cache - * - * Note that hit rate will be zero, so the cache will attempt to - * increase its size. Since we are already at max size, it will - * not be able to. - */ - if ( pass ) { /* first epoch */ + if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 54, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ TRUE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ TRUE + ); + } - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + if ( pass ) { - if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_max_size ) || - ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 55, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ FALSE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ FALSE + ); + } - pass = FALSE; - failure_mssg = "Unexpected cache size change results 24.\n"; - } + if ( pass ) { + + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 56, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ TRUE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ FALSE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( pass ) { - if ( pass ) { /* second epoch */ + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 57, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ FALSE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ TRUE + ); + } - rpt_fcn_called = FALSE; - i = 1000; - while ( ( pass ) && ( i < 2000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + if ( pass ) { - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 58, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ TRUE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ TRUE + ); + } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_max_size ) || - ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "Unexpected cache size change results 25.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 59, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ FALSE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( pass ) { - if ( pass ) { /* third epoch */ + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 60, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ TRUE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ FALSE + ); + } - rpt_fcn_called = FALSE; - i = 2000; - while ( ( pass ) && ( i < 3000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + if ( pass ) { - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 61, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ FALSE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_INVALIDATE_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ TRUE + ); + } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_max_size ) || - ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "Unexpected cache size change results 26.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 62, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ TRUE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_INVALIDATE_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ FALSE, + /* expected_flushed */ TRUE, + /* expected_destroyed */ TRUE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* fourth epoch -- If the hit rate were above the lower threshold, - * we would see cache size reduction now. However, nothing will - * happen until we get the hit rate above the lower threshold. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 3000; - while ( ( pass ) && ( i < 4000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 63, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ FALSE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG | + H5C__FLUSH_MARKED_ENTRIES_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ TRUE + ); + } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_max_size ) || - ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "Unexpected cache size change results 27.\n"; - } + check_flush_cache__single_entry_test + ( + /* cache_ptr */ cache_ptr, + /* test_num */ 64, + /* entry_type */ PICO_ENTRY_TYPE, + /* entry_idx */ 0, + /* insert_flag */ TRUE, + /* dirty_flag */ TRUE, + /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | + H5C__FLUSH_CLEAR_ONLY_FLAG | + H5C__FLUSH_MARKED_ENTRIES_FLAG, + /* expected_loaded */ FALSE, + /* expected_cleared */ TRUE, + /* expected_flushed */ FALSE, + /* expected_destroyed */ TRUE + ); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); +} /* check_flush_cache__single_entry() */ - /* fifth epoch -- force the hit rate to 100%. We should see cache size - * reduction now. - */ - if ( pass ) { + +/*------------------------------------------------------------------------- + * Function: check_flush_cache__single_entry_test() + * + * Purpose: Run a single entry flush cache test. + * + * Return: void + * + * Programmer: John Mainzer + * 1/12/05 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ - rpt_fcn_called = FALSE; - i = 3000; - while ( ( pass ) && ( i < 4000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); +static void +check_flush_cache__single_entry_test(H5C_t * cache_ptr, + int test_num, + int entry_type, + int entry_idx, + hbool_t insert_flag, + hbool_t dirty_flag, + unsigned int flags, + unsigned int flush_flags, + hbool_t expected_loaded, + hbool_t expected_cleared, + hbool_t expected_flushed, + hbool_t expected_destroyed) +{ + /* const char * fcn_name = "check_flush_cache__single_entry_test"; */ + static char msg[128]; + herr_t result; + test_entry_t * base_addr; + test_entry_t * entry_ptr; - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + if ( cache_ptr == NULL ) { - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (2001 * 1024) ) || - ( cache_ptr->min_clean_size != (int)(2001 * 512) ) ) { + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "cache_ptr NULL on entry to single entry test #%d.", + test_num); + failure_mssg = msg; + } + else if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) { - pass = FALSE; - failure_mssg = "Unexpected cache size change results 28.\n"; - } + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "cache not empty at beginning of single entry test #%d.", + test_num); + failure_mssg = msg; } + else if ( ( entry_type < 0 ) || ( entry_type >= NUMBER_OF_ENTRY_TYPES ) || + ( entry_idx < 0 ) || ( entry_idx > max_indices[entry_type] ) ) { - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "Bad parameters on entry to single entry test #%d.", + test_num); + failure_mssg = msg; + } - /* sixth epoch -- force the hit rate to 100% again. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 3000; - while ( ( pass ) && ( i < 4000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } - - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (1001 * 1024) ) || - ( cache_ptr->min_clean_size != (int)(1001 * 512) ) ) { - - pass = FALSE; - failure_mssg = "Unexpected cache size change results 29.\n"; - } - } - - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + base_addr = entries[entry_type]; + entry_ptr = &(base_addr[entry_idx]); - /* seventh epoch -- force the hit rate to 100% again. - */ - if ( pass ) { + if ( insert_flag ) { - rpt_fcn_called = FALSE; - i = 3000; - while ( ( pass ) && ( i < 4000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + insert_entry(cache_ptr, entry_type, entry_idx, dirty_flag, flags); - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + } else { - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (1000 * 1024) ) || - ( cache_ptr->min_clean_size != (int)(1000 * 512) ) ) { + protect_entry(cache_ptr, entry_type, entry_idx); - pass = FALSE; - failure_mssg = "Unexpected cache size change results 30.\n"; + unprotect_entry(cache_ptr, entry_type, entry_idx, + (int)dirty_flag, flags); } } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* eigth epoch -- force the hit rate to 100% again -- should be steady - * state. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 3000; - while ( ( pass ) && ( i < 4000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + result = H5C_flush_cache(NULL, -1, -1, cache_ptr, flush_flags); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (1000 * 1024) ) || - ( cache_ptr->min_clean_size != (int)(1000 * 512) ) ) { + if ( result < 0 ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 31.\n"; + HDsnprintf(msg, (size_t)128, + "flush with flags 0x%x failed in single entry test #%d.", + flush_flags, test_num); + failure_mssg = msg; } - } - - if ( show_progress ) HDfprintf(stderr, "*check point %d\n", checkpoint++); - - /* now just bang on one entry -- after three epochs, this should - * get all entries other than the one evicted, and the cache size - * should be decreased to the minimum. - */ - if ( pass ) { /* ninth epoch */ + else if ( ( entry_ptr->loaded != expected_loaded ) || + ( entry_ptr->cleared != expected_cleared ) || + ( entry_ptr->flushed != expected_flushed ) || + ( entry_ptr->destroyed != expected_destroyed ) ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + HDfprintf(stdout, + "loaded = %d(%d), clrd = %d(%d), flshd = %d(%d), dest = %d(%d)\n", + (int)(entry_ptr->loaded), + (int)expected_loaded, + (int)(entry_ptr->cleared), + (int)expected_cleared, + (int)(entry_ptr->flushed), + (int)expected_flushed, + (int)(entry_ptr->destroyed), + (int)expected_destroyed); - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "Unexpected entry status after flush in single entry test #%d.", + test_num); + failure_mssg = msg; } - - if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (1000 * 1024) ) || - ( cache_ptr->min_clean_size != (int)(1000 * 512) ) ) { + else if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0 ) + && + ( ( cache_ptr->index_len != 1 ) + || + ( cache_ptr->index_size != entry_sizes[entry_type] ) + ) + ) + || + ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 ) + && + ( ( cache_ptr->index_len != 0 ) + || + ( cache_ptr->index_size != 0 ) + ) + ) + ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 32.\n"; + HDsnprintf(msg, (size_t)128, + "Unexpected cache len/size after flush in single entry test #%d.", + test_num); + failure_mssg = msg; } } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - if ( pass ) { /* tenth epoch */ - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + /* clean up the cache to prep for the next test */ + if ( pass ) { - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + result = H5C_flush_cache(NULL, -1, -1, cache_ptr, + H5C__FLUSH_INVALIDATE_FLAG); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (1000 * 1024) ) || - ( cache_ptr->min_clean_size != (int)(1000 * 512) ) ) { + if ( result < 0 ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 33.\n"; + HDsnprintf(msg, (size_t)128, + "Flush failed on cleanup in single entry test #%d.", + test_num); + failure_mssg = msg; } - } - - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - if ( pass ) { /* eleventh epoch -- cache size reduction */ - - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + else if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) { - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "Unexpected cache len/size after cleanup in single entry test #%d.", + test_num); + failure_mssg = msg; - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (512 * 1024) ) || - ( cache_ptr->min_clean_size != (256 * 1024) ) || - ( cache_ptr->index_len != 2 ) || - ( cache_ptr->index_size != - MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE ) ) { + } else { - pass = FALSE; - failure_mssg = "Unexpected cache size change results 34.\n"; + entry_ptr->loaded = FALSE; + entry_ptr->cleared = FALSE; + entry_ptr->flushed = FALSE; + entry_ptr->destroyed = FALSE; } } +} /* check_flush_cache__single_entry_test() */ - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + +/*------------------------------------------------------------------------- + * Function: check_flush_protected_err() + * + * Purpose: Verify that an attempt to flush the cache when it contains + * a protected entry will generate an error. + * + * Return: void + * + * Programmer: John Mainzer + * 6/24/04 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ - if ( pass ) { /* twelth epoch -- at minimum size so no more ageouts */ +static void +check_flush_protected_err(void) +{ + const char * fcn_name = "check_flush_protected_err"; + H5C_t * cache_ptr = NULL; - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + TESTING("flush cache with protected entry error"); - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + pass = TRUE; - if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_min_size ) || - ( cache_ptr->max_cache_size != (512 * 1024) ) || - ( cache_ptr->min_clean_size != (256 * 1024) ) || - ( cache_ptr->index_len != 2 ) || - ( cache_ptr->index_size != - MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE ) ) { + /* allocate a cache, protect an entry, and try to flush. This + * should fail. Unprotect the entry and flush again -- should + * succeed. + */ - pass = FALSE; - failure_mssg = "Unexpected cache size change results 35.\n"; - } - } + if ( pass ) { - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + reset_entries(); + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); - /* repeat the above test, but with max_decrement enabled to see - * if that features works as it should. Note that this will change - * the structure of the test a bit. - */ + protect_entry(cache_ptr, 0, 0); - if ( pass ) { + if ( H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET) + >= 0 ) { - auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - auto_size_ctl.rpt_fcn = test_rpt_fcn; + pass = FALSE; + failure_mssg = "flush succeeded on cache with protected entry.\n"; - auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 8 * 1024 * 1024; + } else { - auto_size_ctl.min_clean_fraction = 0.5; + unprotect_entry(cache_ptr, 0, 0, TRUE, H5C__NO_FLAGS_SET); - auto_size_ctl.max_size = 8 * 1024 * 1024; - auto_size_ctl.min_size = 512 * 1024; + if ( H5C_flush_cache(NULL, -1, -1, cache_ptr, H5C__NO_FLAGS_SET) + < 0 ) { - auto_size_ctl.epoch_length = 1000; + pass = FALSE; + failure_mssg = "flush failed after unprotect.\n"; + } else { - auto_size_ctl.incr_mode = H5C_incr__threshold; + takedown_cache(cache_ptr, FALSE, FALSE); + } + } + } - auto_size_ctl.lower_hr_threshold = 0.75; + if ( pass ) { PASSED(); } else { H5_FAILED(); } - auto_size_ctl.increment = 2.0; + if ( ! pass ) + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); - auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (4 * 1024 * 1024); +} /* check_flush_protected_err() */ + +/*------------------------------------------------------------------------- + * Function: check_destroy_protected_err() + * + * Purpose: Verify that an attempt to destroy the cache when it contains + * a protected entry will generate an error. + * + * Return: void + * + * Programmer: John Mainzer + * 6/24/04 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ - auto_size_ctl.decr_mode = H5C_decr__age_out; +static void +check_destroy_protected_err(void) +{ + const char * fcn_name = "check_destroy_protected_err"; + H5C_t * cache_ptr = NULL; - auto_size_ctl.upper_hr_threshold = 0.995; + TESTING("destroy cache with protected entry error"); - auto_size_ctl.decrement = 0.5; + pass = TRUE; - auto_size_ctl.apply_max_decrement = TRUE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); + /* allocate a cache, protect an entry, and try to flush. This + * should fail. Unprotect the entry and flush again -- should + * succeed. + */ - auto_size_ctl.epochs_before_eviction = 3; + if ( pass ) { - auto_size_ctl.apply_empty_reserve = FALSE; - auto_size_ctl.empty_reserve = 0.05; + reset_entries(); - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); - if ( result != SUCCEED ) { + protect_entry(cache_ptr, 0, 0); + + if ( H5C_dest(NULL, -1, -1, cache_ptr) >= 0 ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 5.\n"; - } - } + failure_mssg = "destroy succeeded on cache with protected entry.\n"; - if ( pass ) { + } else { - if ( ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + unprotect_entry(cache_ptr, 0, 0, TRUE, H5C__NO_FLAGS_SET); - pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 4.\n"; + if ( H5C_dest(NULL, -1, -1, cache_ptr) < 0 ) { + + pass = FALSE; + failure_mssg = "destroy failed after unprotect.\n"; + + } } } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( pass ) { PASSED(); } else { H5_FAILED(); } + if ( ! pass ) + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); - /* fill the cache with 1024 byte entries -- nothing should happen - * for three epochs while the markers are inserted into the cache - * - * Note that hit rate will be zero, so the cache will attempt to - * increase its size. Since we are already at max size, it will - * not be able to. - */ - if ( pass ) { /* first epoch */ +} /* check_destroy_protected_err() */ - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + +/*------------------------------------------------------------------------- + * Function: check_duplicate_insert_err() + * + * Purpose: Verify that an attempt to insert and entry that is + * alread in the cache will generate an error. + * + * Return: void + * + * Programmer: John Mainzer + * 6/24/04 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } +static void +check_duplicate_insert_err(void) +{ + const char * fcn_name = "check_duplicate_insert_err"; + herr_t result; + H5C_t * cache_ptr = NULL; + test_entry_t * base_addr; + test_entry_t * entry_ptr; - if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_max_size ) || - ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + TESTING("duplicate entry insertion error"); - pass = FALSE; - failure_mssg = "Unexpected cache size change results 36.\n"; - } - } + pass = TRUE; - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* allocate a cache, protect an entry, and then try to insert + * the entry again. This should fail. Unprotect the entry and + * destroy the cache -- should succeed. + */ - if ( pass ) { /* second epoch */ + if ( pass ) { - rpt_fcn_called = FALSE; - i = 1000; - while ( ( pass ) && ( i < 2000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + reset_entries(); - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_max_size ) || - ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + protect_entry(cache_ptr, 0, 0); - pass = FALSE; - failure_mssg = "Unexpected cache size change results 37.\n"; - } - } + if ( pass ) { - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + base_addr = entries[0]; + entry_ptr = &(base_addr[0]); + + result = H5C_insert_entry(NULL, -1, -1, cache_ptr, + &(types[0]), entry_ptr->addr, + (void *)entry_ptr, H5C__NO_FLAGS_SET); - if ( pass ) { /* third epoch */ + if ( result >= 0 ) { - rpt_fcn_called = FALSE; - i = 2000; - while ( ( pass ) && ( i < 3000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + pass = FALSE; + failure_mssg = "insert of duplicate entry succeeded.\n"; - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + } else { - if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_max_size ) || - ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + unprotect_entry(cache_ptr, 0, 0, TRUE, H5C__NO_FLAGS_SET); - pass = FALSE; - failure_mssg = "Unexpected cache size change results 38.\n"; + takedown_cache(cache_ptr, FALSE, FALSE); + } } } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( pass ) { PASSED(); } else { H5_FAILED(); } - /* fourth epoch -- If the hit rate were above the lower threshold, - * we would see cache size reduction now. However, nothing will - * happen until we get the hit rate above the lower threshold. - */ - if ( pass ) { + if ( ! pass ) + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); - rpt_fcn_called = FALSE; - i = 3000; - while ( ( pass ) && ( i < 4000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); +} /* check_duplicate_insert_err() */ - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + +/*------------------------------------------------------------------------- + * Function: check_rename_err() + * + * Purpose: Verify that an attempt to rename an entry to the address + * of an existing entry will generate an error. + * + * Return: void + * + * Programmer: John Mainzer + * 6/24/04 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ - if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_max_size ) || - ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { +static void +check_rename_err(void) +{ + const char * fcn_name = "check_rename_err()"; + herr_t result; + H5C_t * cache_ptr = NULL; + test_entry_t * entry_0_0_ptr; + test_entry_t * entry_0_1_ptr; + test_entry_t * entry_1_0_ptr; - pass = FALSE; - failure_mssg = "Unexpected cache size change results 39.\n"; - } - } + TESTING("rename to existing entry errors"); - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + pass = TRUE; - /* fifth epoch -- force the hit rate to 100%. We should see cache size - * reduction now. + /* allocate a cache, and insert several entries. Try to rename + * entries to other entries resident in the cache. This should + * fail. Destroy the cache -- should succeed. */ + if ( pass ) { - rpt_fcn_called = FALSE; - i = 3000; - while ( ( pass ) && ( i < 4000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + reset_entries(); - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (7 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (7 * 512 * 1024) ) ) { + insert_entry(cache_ptr, 0, 0, TRUE, H5C__NO_FLAGS_SET); + insert_entry(cache_ptr, 0, 1, TRUE, H5C__NO_FLAGS_SET); + insert_entry(cache_ptr, 1, 0, TRUE, H5C__NO_FLAGS_SET); - pass = FALSE; - failure_mssg = "Unexpected cache size change results 40.\n"; - } + entry_0_0_ptr = &((entries[0])[0]); + entry_0_1_ptr = &((entries[0])[1]); + entry_1_0_ptr = &((entries[1])[0]); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* sixth epoch -- force the hit rate to 100% again. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 2000; - while ( ( pass ) && ( i < 3000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + result = H5C_rename_entry(cache_ptr, &(types[0]), + entry_0_0_ptr->addr, entry_0_1_ptr->addr); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (6 * 512 * 1024) ) ) { + if ( result >= 0 ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 41.\n"; + failure_mssg = "rename to addr of same type succeeded.\n"; } } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* seventh epoch -- keep hit rate at 100%, and keep 2K entries active. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 3000; - while ( ( pass ) && ( i < 4000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + result = H5C_rename_entry(cache_ptr, &(types[0]), + entry_0_0_ptr->addr, entry_1_0_ptr->addr); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (5 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (5 * 512 * 1024) ) ) { + if ( result >= 0 ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 42.\n"; + failure_mssg = "rename to addr of different type succeeded.\n"; } } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* eigth epoch -- still 100% hit rate - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 2000; - while ( ( pass ) && ( i < 3000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + takedown_cache(cache_ptr, FALSE, FALSE); + } - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + if ( pass ) { PASSED(); } else { H5_FAILED(); } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 512 * 1024) ) ) { + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); - pass = FALSE; - failure_mssg = "Unexpected cache size change results 43.\n"; - } - } +} /* check_rename_err() */ - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + +/*------------------------------------------------------------------------- + * Function: check_double_protect_err() + * + * Purpose: Verify that an attempt to protect an entry that is already + * protected will generate an error. + * + * Return: void + * + * Programmer: John Mainzer + * 6/24/04 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ - /* ninth epoch --hit rate at 100%. +static void +check_double_protect_err(void) +{ + const char * fcn_name = "check_double_protect_err()"; + H5C_t * cache_ptr = NULL; + test_entry_t * entry_ptr; + H5C_cache_entry_t * cache_entry_ptr; + + TESTING("protect a protected entry error"); + + pass = TRUE; + + /* allocate a cache, protect an entry, and then try to protect + * the entry again. This should fail. Unprotect the entry and + * destroy the cache -- should succeed. */ - if ( pass ) { - rpt_fcn_called = FALSE; - i = 3000; - while ( ( pass ) && ( i < 4000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + if ( pass ) { - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + reset_entries(); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (3 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 512 * 1024) ) ) { + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); - pass = FALSE; - failure_mssg = "Unexpected cache size change results 44.\n"; - } - } + protect_entry(cache_ptr, 0, 0); - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + entry_ptr = &((entries[0])[0]); + } - /* tenth epoch -- still 100% hit rate - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 2000; - while ( ( pass ) && ( i < 3000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + cache_entry_ptr = H5C_protect(NULL, -1, -1, cache_ptr, &(types[0]), + entry_ptr->addr, NULL, NULL); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 512 * 1024) ) ) { + if ( cache_entry_ptr != NULL ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 45.\n"; + failure_mssg = "attempt to protect a protected entry succeeded.\n"; } } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* eleventh epoch -- hit rate at 100% -- starting to stableize - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 3000; - while ( ( pass ) && ( i < 4000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); + } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (2000 * 1024) ) || - ( cache_ptr->min_clean_size != (int)(2000 * 512) ) ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "Unexpected cache size change results 46.\n"; - } + takedown_cache(cache_ptr, FALSE, FALSE); } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( pass ) { PASSED(); } else { H5_FAILED(); } - /* twelth epoch -- force the hit rate to 100% again -- should be steady - * state. - */ - if ( pass ) { + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); - rpt_fcn_called = FALSE; - i = 2000; - while ( ( pass ) && ( i < 3000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); +} /* check_double_protect_err() */ - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + +/*------------------------------------------------------------------------- + * Function: check_double_unprotect_err() + * + * Purpose: Verify that an attempt to unprotect an entry that is already + * unprotected will generate an error. + * + * Return: 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. + * + *------------------------------------------------------------------------- + */ - if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (2000 * 1024) ) || - ( cache_ptr->min_clean_size != (int)(2000 * 512) ) ) { +static void +check_double_unprotect_err(void) +{ + const char * fcn_name = "check_double_unprotect_err()"; + herr_t result; + H5C_t * cache_ptr = NULL; + test_entry_t * entry_ptr; - pass = FALSE; - failure_mssg = "Unexpected cache size change results 47.\n"; - } - } + TESTING("unprotect an unprotected entry error"); - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + pass = TRUE; - /* now just bang on one entry -- after three epochs, this should - * get all entries other than the one evicted, and the cache size - * should be decreased to the minimum. + /* allocate a cache, protect an entry, unprotect it, and then try to + * unprotect the entry again. This should fail. Destroy the cache + * -- should succeed. */ - if ( pass ) { /* thirteenth epoch */ - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + if ( pass ) { - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + reset_entries(); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (2000 * 1024) ) || - ( cache_ptr->min_clean_size != (int)(2000 * 512) ) ) { + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); - pass = FALSE; - failure_mssg = "Unexpected cache size change results 48.\n"; - } - } + protect_entry(cache_ptr, 0, 0); - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); - if ( pass ) { /* fourteenth epoch */ + entry_ptr = &((entries[0])[0]); + } - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + if ( pass ) { - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + result = H5C_unprotect(NULL, -1, -1, cache_ptr, &(types[0]), + entry_ptr->addr, (void *)entry_ptr, + H5C__NO_FLAGS_SET, 0); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != - (1001 * 1024 + MONSTER_ENTRY_SIZE) ) || - ( cache_ptr->min_clean_size != - (1001 * 512 + MONSTER_ENTRY_SIZE / 2) ) ) { + if ( result > 0 ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 49.\n"; + failure_mssg = + "attempt to unprotect an unprotected entry succeeded 1.\n"; } } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( pass ) { - if ( pass ) { /* fifteenth epoch -- cache size reduction */ + takedown_cache(cache_ptr, FALSE, FALSE); + } - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + if ( pass ) { PASSED(); } else { H5_FAILED(); } - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (512 * 1024) ) || - ( cache_ptr->min_clean_size != (256 * 1024) ) || - ( cache_ptr->index_len != 2 ) || - ( cache_ptr->index_size != - MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE ) ) { +} /* check_double_unprotect_err() */ - pass = FALSE; - failure_mssg = "Unexpected cache size change results 50.\n"; - } - } + +/*------------------------------------------------------------------------- + * Function: check_auto_cache_resize() + * + * Purpose: Exercise the automatic cache resizing functionality. + * The objective is to operate the auto-resize code in + * all possible modes. Unfortunately, there are quite + * a few of them. + * + * Return: void + * + * Programmer: John Mainzer + * 10/29/04 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); +hbool_t rpt_fcn_called = FALSE; +enum H5C_resize_status rpt_status; - if ( pass ) { /* sixteenth epoch -- at minimum size so no more ageouts */ +void test_rpt_fcn(UNUSED H5C_t * cache_ptr, + UNUSED int32_t version, + UNUSED double hit_rate, + UNUSED enum H5C_resize_status status, + UNUSED size_t old_max_cache_size, + UNUSED size_t new_max_cache_size, + UNUSED size_t old_min_clean_size, + UNUSED size_t new_min_clean_size); - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); +void test_rpt_fcn(UNUSED H5C_t * cache_ptr, + UNUSED int32_t version, + UNUSED double hit_rate, + UNUSED enum H5C_resize_status status, + UNUSED size_t old_max_cache_size, + UNUSED size_t new_max_cache_size, + UNUSED size_t old_min_clean_size, + UNUSED size_t new_min_clean_size) +{ + rpt_fcn_called = TRUE; + rpt_status = status; +} - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } +static void +check_auto_cache_resize(void) +{ + const char * fcn_name = "check_auto_cache_resize()"; + hbool_t show_progress = FALSE; + herr_t result; + int32_t i; + int32_t checkpoint = 0; + H5C_t * cache_ptr = NULL; + H5C_auto_size_ctl_t auto_size_ctl = + { + /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* H5C_auto_resize_report_fcn rpt_fcn = */ test_rpt_fcn, - if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_min_size ) || - ( cache_ptr->max_cache_size != (512 * 1024) ) || - ( cache_ptr->min_clean_size != (256 * 1024) ) || - ( cache_ptr->index_len != 2 ) || - ( cache_ptr->index_size != - MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE ) ) { + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (512 * 1024), - pass = FALSE; - failure_mssg = "Unexpected cache size change results 51.\n"; - } - } + /* double min_clean_fraction = */ 0.5, - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* size_t max_size = */ (14 * 1024 * 1024), + /* size_t min_size = */ (512 * 1024), + /* int64_t epoch_length = */ 1000, - /* repeat the test yet again, this time with empty reserve enabled. - * Again, some structural changes in the test are necessary. - */ - if ( pass ) { + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - auto_size_ctl.rpt_fcn = test_rpt_fcn; + /* double lower_hr_threshold = */ 0.75, - auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 8 * 1024 * 1024; + /* double increment = */ 2.0, - auto_size_ctl.min_clean_fraction = 0.5; + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), - auto_size_ctl.max_size = 8 * 1024 * 1024; - auto_size_ctl.min_size = 512 * 1024; - auto_size_ctl.epoch_length = 1000; + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, + /* double upper_hr_threshold = */ 0.995, - auto_size_ctl.incr_mode = H5C_incr__threshold; + /* double decrement = */ 0.1, - auto_size_ctl.lower_hr_threshold = 0.75; + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), - auto_size_ctl.increment = 2.0; + /* int32_t epochs_before_eviction = */ 3, - auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (4 * 1024 * 1024); + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.05 + }; + TESTING("automatic cache resizing"); - auto_size_ctl.decr_mode = H5C_decr__age_out; + pass = TRUE; - auto_size_ctl.upper_hr_threshold = 0.995; + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - auto_size_ctl.decrement = 0.5; + /* allocate a cache, enable automatic cache resizing, and then force + * the cache through all its operational modes. Verify that all + * performs as expected. + */ - auto_size_ctl.apply_max_decrement = FALSE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); + if ( pass ) { - auto_size_ctl.epochs_before_eviction = 3; + reset_entries(); - auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.5; /* for ease of testing */ + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); + } + + if ( pass ) { result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 6.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n"; } } if ( pass ) { - if ( ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + if ( ( cache_ptr->max_cache_size != (512 * 1024) ) || + ( cache_ptr->min_clean_size != (256 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 5.\n"; + failure_mssg = "bad cache size after initialization.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* fill the cache with 1024 byte entries -- nothing should happen - * for three epochs while the markers are inserted into the cache - * - * Note that hit rate will be zero, so the cache will attempt to - * increase its size. Since we are already at max size, it will - * not be able to. + /* force low hit rate with cache not full -- should result in not + * full status. */ - if ( pass ) { /* first epoch */ + if ( pass ) { rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } - - if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_max_size ) || - ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { - - pass = FALSE; - failure_mssg = "Unexpected cache size change results 52.\n"; - } - } - - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - if ( pass ) { /* second epoch */ - - rpt_fcn_called = FALSE; - i = 1000; - while ( ( pass ) && ( i < 2000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } - - if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_max_size ) || - ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { - - pass = FALSE; - failure_mssg = "Unexpected cache size change results 53.\n"; - } - } - - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - if ( pass ) { /* third epoch */ - - rpt_fcn_called = FALSE; - i = 2000; - while ( ( pass ) && ( i < 3000 ) ) - { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(cache_ptr, PICO_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, PICO_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_max_size ) || - ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + ( rpt_status != not_full ) || + ( cache_ptr->max_cache_size != (512 * 1024) ) || + ( cache_ptr->min_clean_size != (256 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 54.\n"; + failure_mssg = "Unexpected cache size change results 1.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* fourth epoch -- If the hit rate were above the lower threshold, - * we would see cache size reduction now. However, nothing will - * happen until we get the hit rate above the lower threshold. + /* force low hit rate with cache full -- should result in increase + * of cache size from .5 to 1 meg. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 3000; - while ( ( pass ) && ( i < 4000 ) ) + i = 0; + while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_max_size ) || - ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + ( rpt_status != increase ) || + ( cache_ptr->max_cache_size != (1 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (512 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 55.\n"; + failure_mssg = "Unexpected cache size change results 2.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* fifth epoch -- force the hit rate to 100%. We should see cache size - * reduction now. + /* force low hit rate with cache not full -- should result in not + * full status. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 3000; - while ( ( pass ) && ( i < 4000 ) ) + i = 0; + while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(cache_ptr, PICO_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, PICO_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (4002 * 1024) ) || - ( cache_ptr->min_clean_size != (int)(4002 * 512) ) ) { + ( rpt_status != not_full ) || + ( cache_ptr->max_cache_size != (1 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (512 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 56.\n"; + failure_mssg = "Unexpected cache size change results 3.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* sixth epoch -- force the hit rate to 100% again. + /* force low hit rate with cache full again -- should result in increase + * of cache size from 1 to 2 meg. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 3000; - while ( ( pass ) && ( i < 4000 ) ) + i = 0; + while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (2002 * 1024) ) || - ( cache_ptr->min_clean_size != (int)(2002 * 512) ) ) { + ( rpt_status != increase ) || + ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 57.\n"; + failure_mssg = "Unexpected cache size change results 4.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* seventh epoch -- force the hit rate to 100% again. + /* force low hit rate with cache full again -- should result in increase + * of cache size from 2 to 4 meg. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 3000; - while ( ( pass ) && ( i < 4000 ) ) + i = 0; + while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (2000 * 1024) ) || - ( cache_ptr->min_clean_size != (int)(2000 * 512) ) ) { + ( rpt_status != increase ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 58.\n"; + failure_mssg = "Unexpected cache size change results 5.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* eigth epoch -- force the hit rate to 100% again -- should be steady - * state. + /* force low hit rate with cache full again -- should result in increase + * of cache size from 4 to 8 meg. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 3000; - while ( ( pass ) && ( i < 4000 ) ) + i = 0; + while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (2000 * 1024) ) || - ( cache_ptr->min_clean_size != (int)(2000 * 512) ) ) { + ( rpt_status != increase ) || + ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 59.\n"; + failure_mssg = "Unexpected cache size change results 6.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* now just bang on one entry -- after three epochs, this should - * get all entries other than the one evicted, and the cache size - * should be decreased to the minimum. + /* force low hit rate with cache full again -- should result in increase + * of cache size from 8 to 12 meg. Note that max increase reduced the + * size of the increase. */ - if ( pass ) { /* ninth epoch */ + if ( pass ) { rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (2000 * 1024) ) || - ( cache_ptr->min_clean_size != (int)(2000 * 512) ) ) { + ( rpt_status != increase ) || + ( cache_ptr->max_cache_size != (12 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (6 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 60.\n"; + failure_mssg = "Unexpected cache size change results 7.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - if ( pass ) { /* tenth epoch */ + /* force low hit rate with cache full again -- should result in increase + * of cache size from 12 to 14 meg. + */ + if ( pass ) { rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (2000 * 1024) ) || - ( cache_ptr->min_clean_size != (2000 * 512) ) ) { + ( rpt_status != increase ) || + ( cache_ptr->max_cache_size != (14 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (7 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 61.\n"; + failure_mssg = "Unexpected cache size change results 8.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - if ( pass ) { /* eleventh epoch -- cache size reduction */ + /* force low hit rate with cache full and at maximum size -- should + * in no change in size and a result of at_max_size. + */ + if ( pass ) { rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (512 * 1024) ) || - ( cache_ptr->min_clean_size != (256 * 1024) ) || - ( cache_ptr->index_len != 2 ) || - ( cache_ptr->index_size != - MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE ) ) { + ( rpt_status != at_max_size ) || + ( cache_ptr->max_cache_size != (14 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (7 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 62.\n"; + failure_mssg = "Unexpected cache size change results 9.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - if ( pass ) { /* twelth epoch -- at minimum size so no more ageouts */ + /* force high hit rate with cache full and at maximum size -- should + * result in a decrease from 14 to 13 Meg -- note that max decrease + * reduced the size of the reduction + */ + if ( pass ) { rpt_fcn_called = FALSE; i = 0; @@ -10949,25 +5699,20 @@ check_auto_cache_resize(void) } if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_min_size ) || - ( cache_ptr->max_cache_size != (512 * 1024) ) || - ( cache_ptr->min_clean_size != (256 * 1024) ) || - ( cache_ptr->index_len != 2 ) || - ( cache_ptr->index_size != - MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE ) ) { + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (13 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (6 * 1024 * 1024 + 512 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 63.\n"; + failure_mssg = "Unexpected cache size change results 10.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* Repeat the test again, this time using the age out with threshold - * mode. To simplify the testing, set epochs to eviction to 1. - * - * Again, there are some minor structural changes in the test. + /* the current cache configuration is unconvenient for testing cache + * size reduction, so lets change it some something easier to work + * with. */ if ( pass ) { @@ -10976,38 +5721,38 @@ check_auto_cache_resize(void) auto_size_ctl.rpt_fcn = test_rpt_fcn; auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 8 * 1024 * 1024; + auto_size_ctl.initial_size = 4 * 1000 * 1000 + 10; - auto_size_ctl.min_clean_fraction = 0.5; + auto_size_ctl.min_clean_fraction = 0.1; - auto_size_ctl.max_size = 8 * 1024 * 1024; - auto_size_ctl.min_size = 512 * 1024; + auto_size_ctl.max_size = 8 * 1000 * 1000; + auto_size_ctl.min_size = 500 * 1000; auto_size_ctl.epoch_length = 1000; - auto_size_ctl.incr_mode = H5C_incr__off; + auto_size_ctl.incr_mode = H5C_incr__threshold; auto_size_ctl.lower_hr_threshold = 0.75; auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.max_increment = (4 * 1000 * 1000); - auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; + auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */ + auto_size_ctl.upper_hr_threshold = 0.995; auto_size_ctl.decrement = 0.5; - auto_size_ctl.apply_max_decrement = FALSE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); + auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.max_decrement = (1 * 1000 * 1000); - auto_size_ctl.epochs_before_eviction = 1; /* for ease of testing */ + auto_size_ctl.epochs_before_eviction = 3; - auto_size_ctl.apply_empty_reserve = FALSE; + auto_size_ctl.apply_empty_reserve = TRUE; auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -11015,91 +5760,128 @@ check_auto_cache_resize(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 7.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 2.\n"; } } if ( pass ) { - if ( ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + if ( ( cache_ptr->max_cache_size != (4 * 1000 * 1000 + 10) ) || + ( cache_ptr->min_clean_size != (400 * 1000 + 1) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 6.\n"; + failure_mssg = "bad cache size after set resize re-config 1.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* force high hit rate -- should result in a decrease from ~4 to ~3 + * M -- note that max decrease reduces the size of the reduction + */ + if ( pass ) { - /* fill the cache with 4K byte entries -- increment mode is off, - * so cache size reduction should kick in as soon as we get the - * hit rate above .999. + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (3 * 1000 * 1000 + 10) ) || + ( cache_ptr->min_clean_size != (300 * 1000 + 1) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 11.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* force high hit rate again -- should result in a decrease from ~3 + * to ~2 M -- again note that max decrease reduces the size of the + * reduction. */ - if ( pass ) { /* first epoch -- hit rate 0 */ + if ( pass ) { rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (2 * 1000 * 1000 + 10) ) || + ( cache_ptr->min_clean_size != (200 * 1000 + 1) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 64.\n"; + failure_mssg = "Unexpected cache size change results 12.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - if ( pass ) { /* second epoch -- hit rate 0 */ + /* force high hit rate again -- should result in a decrease from ~2 + * to ~1 M -- again note that max decrease reduces the size of the + * reduction, but only by five bites. + */ + if ( pass ) { rpt_fcn_called = FALSE; - i = 1000; - while ( ( pass ) && ( i < 2000 ) ) + i = 0; + while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (1 * 1000 * 1000 + 10) ) || + ( cache_ptr->min_clean_size != (100 * 1000 + 1) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 65.\n"; + failure_mssg = "Unexpected cache size change results 13.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - if ( pass ) { /* third epoch -- hit rate 1.0 -- should see decrease */ + /* force high hit rate again -- should result in a decrease from ~1 + * to ~0.5 M -- max decrease is no longer a factor. New size is five + * bytes above the minimum. + */ + if ( pass ) { rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -11107,55 +5889,100 @@ check_auto_cache_resize(void) if ( ( ! rpt_fcn_called ) || ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (1001 * LARGE_ENTRY_SIZE) ) || - ( cache_ptr->min_clean_size != (1001 * LARGE_ENTRY_SIZE / 2) ) ) { + ( cache_ptr->max_cache_size != (500 * 1000 + 5) ) || + ( cache_ptr->min_clean_size != (50 * 1000) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 66.\n"; + failure_mssg = "Unexpected cache size change results 14.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* fourth epoch -- load up the cache again -- hit rate 0 */ + /* force high hit rate again -- should result in a decrease of five + * bytes to the minimum cache size. + */ if ( pass ) { rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (500 * 1000) ) || + ( cache_ptr->min_clean_size != (50 * 1000) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 15.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* force high hit rate again -- Already at minimum size so no change in + * cache size and result should be at_min_size. + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (1001 * LARGE_ENTRY_SIZE) ) || - ( cache_ptr->min_clean_size != (1001 * LARGE_ENTRY_SIZE / 2) ) ) { + ( rpt_status != at_min_size ) || + ( cache_ptr->max_cache_size != (500 * 1000) ) || + ( cache_ptr->min_clean_size != (50 * 1000) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 67.\n"; + failure_mssg = "Unexpected cache size change results 16.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* fifth epoch -- still loading up the cache -- hit rate 0 */ + /* force in range hit rate -- should be no change in cache size, + * and result should be in_spec. + */ if ( pass ) { rpt_fcn_called = FALSE; - i = 1000; - while ( ( pass ) && ( i < 2000 ) ) + i = 0; + while ( ( pass ) && ( i < 900 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i + 1000); + + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i + 1000, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -11163,56 +5990,59 @@ check_auto_cache_resize(void) if ( ( ! rpt_fcn_called ) || ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (1001 * LARGE_ENTRY_SIZE) ) || - ( cache_ptr->min_clean_size != (1001 * LARGE_ENTRY_SIZE / 2) ) ) { + ( cache_ptr->max_cache_size != (500 * 1000) ) || + ( cache_ptr->min_clean_size != (50 * 1000) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 68.\n"; + failure_mssg = "Unexpected cache size change results 17.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* sixth epoch -- force hit rate to .998 -- should be no reduction */ + /* force low hit rate with cache full -- should + * increase cache size from .5 to 1 M. + */ if ( pass ) { rpt_fcn_called = FALSE; - i = 1002; - while ( ( pass ) && ( i < 2002 ) ) + i = 0; + while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (1001 * LARGE_ENTRY_SIZE) ) || - ( cache_ptr->min_clean_size != (1001 * LARGE_ENTRY_SIZE / 2) ) ) { + ( rpt_status != increase ) || + ( cache_ptr->max_cache_size != (1 * 1000 * 1000) ) || + ( cache_ptr->min_clean_size != (100 * 1000) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 69.\n"; + failure_mssg = "Unexpected cache size change results 18.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* seventh epoch -- force hit rate to .999 -- should see reduction + /* force high hit rate -- should result in a decrease to the + * minimum cache size. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 1003; - while ( ( pass ) && ( i < 2003 ) ) + i = 0; + while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -11220,21 +6050,20 @@ check_auto_cache_resize(void) if ( ( ! rpt_fcn_called ) || ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (1000 * MEDIUM_ENTRY_SIZE) ) || - ( cache_ptr->min_clean_size != (1000 * MEDIUM_ENTRY_SIZE / 2) ) ) { + ( cache_ptr->max_cache_size != (500 * 1000) ) || + ( cache_ptr->min_clean_size != (50 * 1000) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 70.\n"; + failure_mssg = "Unexpected cache size change results 19.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* We have now tested all the major ageout modes individually. - * Lets try them all together to look for unexpected interactions - * and/or bugs. - */ + /****************************************************************** + * now do some tests with the maximum increase and decrease sizes + * disabled. + ******************************************************************/ if ( pass ) { @@ -11242,12 +6071,12 @@ check_auto_cache_resize(void) auto_size_ctl.rpt_fcn = test_rpt_fcn; auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 8 * 1000 * 1024; + auto_size_ctl.initial_size = 4 * 1024 * 1024; auto_size_ctl.min_clean_fraction = 0.5; - auto_size_ctl.max_size = 8 * 1000 * 1024; - auto_size_ctl.min_size = 512 * 1024; + auto_size_ctl.max_size = 16 * 1024 * 1024; + auto_size_ctl.min_size = 1 * 1024 * 1024; auto_size_ctl.epoch_length = 1000; @@ -11256,273 +6085,333 @@ check_auto_cache_resize(void) auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0; + auto_size_ctl.increment = 4.0; - auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.apply_max_increment = FALSE; auto_size_ctl.max_increment = (4 * 1024 * 1024); - auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; + auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */ + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5; + auto_size_ctl.decrement = 0.25; - auto_size_ctl.apply_max_decrement = TRUE; - auto_size_ctl.max_decrement = (1 * 1000 * 1024); + auto_size_ctl.apply_max_decrement = FALSE; + auto_size_ctl.max_decrement = (1 * 1024 * 1024); - auto_size_ctl.epochs_before_eviction = 1; /* for ease of testing */ + auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.5; /* for ease of testing */ + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 8.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 3.\n"; } } if ( pass ) { - if ( ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) ) { + if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 7.\n"; + failure_mssg = "bad cache size after set resize re-config 2.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* fill the cache with 4K byte entries -- increment mode is threshold, - * so the decrease code will not be executed until the hit rate exceeds - * .75. + /* force high hit rate -- should result in a decrease to the + * minimum cache size. */ - if ( pass ) { /* first epoch -- hit rate 0 */ + if ( pass ) { rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_max_size ) || - ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) ) { + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (1 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (512 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 71.\n"; + failure_mssg = "Unexpected cache size change results 20.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - if ( pass ) { /* second epoch -- hit rate 0 */ + /* force low hit rate with cache full -- should increase cache size + * from 1 to 4 Meg. + */ + if ( pass ) { rpt_fcn_called = FALSE; - i = 1000; - while ( ( pass ) && ( i < 2000 ) ) + i = 0; + while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != at_max_size ) || - ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) ) { + ( rpt_status != increase ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 72.\n"; + failure_mssg = "Unexpected cache size change results 21.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* third epoch -- force the hit rate to 1.0. Should be no change - * in the cache size due to the combination of the empty reserve - * and the max decrease. Max decrease will limit the evictions - * in any one epoch, and the empty reserve will not permit cache - * size reduction unless the specified empty reserve is maintained. - * - * In this epoch, all we should see is a reduction in the index size. + /* force low hit rate again with cache full -- should increase cache + * size from 4 to 16 Meg. + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( rpt_status != increase ) || + ( cache_ptr->max_cache_size != (16 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != ( 8 * 1024 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 22.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* force high hit rate -- should result in a decrease cache size from + * 16 to 4 Meg. */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 23.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /****************************************************************** + * We have tested the threshold increment and decrement modes. + * must now test the ageout decrement mode. + * + * Reconfigure the cache for this testing. + ******************************************************************/ + + if ( pass ) { + + auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; + + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 8 * 1024 * 1024; + + auto_size_ctl.min_clean_fraction = 0.5; + + auto_size_ctl.max_size = 8 * 1024 * 1024; + auto_size_ctl.min_size = 512 * 1024; + + auto_size_ctl.epoch_length = 1000; + + + auto_size_ctl.incr_mode = H5C_incr__threshold; + + auto_size_ctl.lower_hr_threshold = 0.75; + + auto_size_ctl.increment = 2.0; + + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (4 * 1024 * 1024); + + + auto_size_ctl.decr_mode = H5C_decr__age_out; + + auto_size_ctl.upper_hr_threshold = 0.995; + + auto_size_ctl.decrement = 0.5; - if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + auto_size_ctl.apply_max_decrement = FALSE; + auto_size_ctl.max_decrement = (1 * 1024 * 1024); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) || - ( cache_ptr->index_size != (7 * 1000 * 1024) ) ) { + auto_size_ctl.epochs_before_eviction = 3; + + auto_size_ctl.apply_empty_reserve = FALSE; + auto_size_ctl.empty_reserve = 0.05; + + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 73.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 4.\n"; } } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* fourth epoch -- hit rate still 1.0. Index size should decrease, - * but otherwise no change expected. - */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } - - if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) || - ( cache_ptr->index_size != (6 * 1000 * 1024) ) ) { + if ( ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 74.\n"; + failure_mssg = "bad cache size after set resize re-config 3.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* fifth epoch -- hit rate still 1.0. Index size should decrease, - * but otherwise no change expected. + + /* fill the cache with 1024 byte entries -- nothing should happen + * for three epochs while the markers are inserted into the cache + * + * Note that hit rate will be zero, so the cache will attempt to + * increase its size. Since we are already at max size, it will + * not be able to. */ - if ( pass ) { + if ( pass ) { /* first epoch */ rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) || - ( cache_ptr->index_size != (5 * 1000 * 1024) ) ) { + ( rpt_status != at_max_size ) || + ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 75.\n"; + failure_mssg = "Unexpected cache size change results 24.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* sixth epoch -- hit rate still 1.0. Index size should decrease, - * but otherwise no change expected. Note that the cache size is - * now just on the edge of meeting the clean reserve. - */ - if ( pass ) { + if ( pass ) { /* second epoch */ rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 1000; + while ( ( pass ) && ( i < 2000 ) ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) || - ( cache_ptr->index_size != (4 * 1000 * 1024) ) ) { + ( rpt_status != at_max_size ) || + ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 76.\n"; + failure_mssg = "Unexpected cache size change results 25.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* seventh epoch -- hit rate still 1.0. No change in index size expected. - */ - if ( pass ) { + if ( pass ) { /* third epoch */ rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 2000; + while ( ( pass ) && ( i < 3000 ) ) { - protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) || - ( cache_ptr->index_size != (4 * 1000 * 1024) ) ) { + ( rpt_status != at_max_size ) || + ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 77.\n"; + failure_mssg = "Unexpected cache size change results 26.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* eighth epoch -- start loading 1 KB entries. Hit rate 0 so - * decrease code shouldn't be called. + /* fourth epoch -- If the hit rate were above the lower threshold, + * we would see cache size reduction now. However, nothing will + * happen until we get the hit rate above the lower threshold. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 3000; + while ( ( pass ) && ( i < 4000 ) ) { protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); @@ -11535,26 +6424,24 @@ check_auto_cache_resize(void) if ( ( ! rpt_fcn_called ) || ( rpt_status != at_max_size ) || - ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) || - ( cache_ptr->index_size != (5 * 1000 * 1024) ) ) { + ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 78.\n"; + failure_mssg = "Unexpected cache size change results 27.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* ninth epoch -- access the 1 KB entries again, driving the hit rate - * to 1.0. Decrease code should be triggered, but the max decrease - * should prevent the empty reserve from being met in this epoch. + /* fifth epoch -- force the hit rate to 100%. We should see cache size + * reduction now. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 3000; + while ( ( pass ) && ( i < 4000 ) ) { protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); @@ -11566,27 +6453,24 @@ check_auto_cache_resize(void) } if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) || - ( cache_ptr->index_size != (4 * 1000 * 1024) ) ) { + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (2001 * 1024) ) || + ( cache_ptr->min_clean_size != (int)(2001 * 512) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 79.\n"; + failure_mssg = "Unexpected cache size change results 28.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* tenth epoch -- access the 1 KB entries yet again, forcing hit rate - * to 1.0. Decrease code should be triggered, and the empty reserve - * should finally be met. + /* sixth epoch -- force the hit rate to 100% again. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 3000; + while ( ( pass ) && ( i < 4000 ) ) { protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); @@ -11599,26 +6483,23 @@ check_auto_cache_resize(void) if ( ( ! rpt_fcn_called ) || ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (7 * 1000 * 1024) ) || - ( cache_ptr->min_clean_size != (7 * 1000 * 1024 / 2) ) || - ( cache_ptr->index_size != (3 * 1000 * 1024) ) ) { + ( cache_ptr->max_cache_size != (1001 * 1024) ) || + ( cache_ptr->min_clean_size != (int)(1001 * 512) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 80.\n"; + failure_mssg = "Unexpected cache size change results 29.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* eleventh epoch -- access the 1 KB entries yet again, forcing hit rate - * to 1.0. Decrease code should be triggered, and the empty reserve - * should be met again. + /* seventh epoch -- force the hit rate to 100% again. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 3000; + while ( ( pass ) && ( i < 4000 ) ) { protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); @@ -11631,24 +6512,24 @@ check_auto_cache_resize(void) if ( ( ! rpt_fcn_called ) || ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (6 * 1000 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1000 * 1024) ) || - ( cache_ptr->index_size != (2 * 1000 * 1024) ) ) { + ( cache_ptr->max_cache_size != (1000 * 1024) ) || + ( cache_ptr->min_clean_size != (int)(1000 * 512) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 81.\n"; + failure_mssg = "Unexpected cache size change results 30.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* twelth epoch -- hit rate 1.0 -- decrease as before. + /* eigth epoch -- force the hit rate to 100% again -- should be steady + * state. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 3000; + while ( ( pass ) && ( i < 4000 ) ) { protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); @@ -11660,375 +6541,335 @@ check_auto_cache_resize(void) } if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (5 * 1000 * 1024) ) || - ( cache_ptr->min_clean_size != (5 * 1000 * 1024 / 2) ) || - ( cache_ptr->index_size != (1 * 1000 * 1024) ) ) { + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (1000 * 1024) ) || + ( cache_ptr->min_clean_size != (int)(1000 * 512) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 82.\n"; + failure_mssg = "Unexpected cache size change results 31.\n"; } } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( show_progress ) HDfprintf(stderr, "*check point %d\n", checkpoint++); - /* thirteenth epoch -- hit rate 1.0 -- decrease as before. + /* now just bang on one entry -- after three epochs, this should + * get all entries other than the one evicted, and the cache size + * should be decreased to the minimum. */ - if ( pass ) { + if ( pass ) { /* ninth epoch */ rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (4 * 1000 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1000 * 1024) ) || - ( cache_ptr->index_size != (1 * 1000 * 1024) ) ) { + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (1000 * 1024) ) || + ( cache_ptr->min_clean_size != (int)(1000 * 512) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 83.\n"; + failure_mssg = "Unexpected cache size change results 32.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* fourteenth epoch -- hit rate 1.0 -- decrease as before. - */ - if ( pass ) { + if ( pass ) { /* tenth epoch */ rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (3 * 1000 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1000 * 1024 / 2) ) || - ( cache_ptr->index_size != (1 * 1000 * 1024) ) ) { + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (1000 * 1024) ) || + ( cache_ptr->min_clean_size != (int)(1000 * 512) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 84.\n"; + failure_mssg = "Unexpected cache size change results 33.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* fifteenth epoch -- hit rate 1.0 -- decrease as before. - */ - if ( pass ) { + if ( pass ) { /* eleventh epoch -- cache size reduction */ rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (2 * 1000 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1000 * 1024) ) || - ( cache_ptr->index_size != (1 * 1000 * 1024) ) ) { + if ( ( ! rpt_fcn_called ) || + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (512 * 1024) ) || + ( cache_ptr->min_clean_size != (256 * 1024) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != + MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 85.\n"; + failure_mssg = "Unexpected cache size change results 34.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* sixteenth epoch -- hit rate 1.0 -- should be stable now - */ - if ( pass ) { + if ( pass ) { /* twelth epoch -- at minimum size so no more ageouts */ rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (2 * 1000 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1000 * 1024) ) || - ( cache_ptr->index_size != (1 * 1000 * 1024) ) ) { + ( rpt_status != at_min_size ) || + ( cache_ptr->max_cache_size != (512 * 1024) ) || + ( cache_ptr->min_clean_size != (256 * 1024) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != + MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 86.\n"; + failure_mssg = "Unexpected cache size change results 35.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - if ( pass ) { - - takedown_cache(cache_ptr, FALSE, FALSE); - } - - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -} /* check_auto_cache_resize() */ - - -/*------------------------------------------------------------------------- - * Function: check_auto_cache_resize_disable() - * - * Purpose: Test the various ways in which the resize code can - * be disabled. Unfortunately, there are quite a few of them. - * - * Return: void - * - * Programmer: John Mainzer - * 12/16/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static void -check_auto_cache_resize_disable(void) -{ - const char * fcn_name = "check_auto_cache_resize_disable()"; - hbool_t show_progress = FALSE; - herr_t result; - int32_t i; - int32_t checkpoint = 0; - H5C_t * cache_ptr = NULL; - H5C_auto_size_ctl_t auto_size_ctl = - { - /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* H5C_auto_resize_report_fcn rpt_fcn = */ test_rpt_fcn, - - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (512 * 1024), - - /* double min_clean_fraction = */ 0.5, - - /* size_t max_size = */ (14 * 1024 * 1024), - /* size_t min_size = */ (512 * 1024), - - /* int64_t epoch_length = */ 1000, + /* repeat the above test, but with max_decrement enabled to see + * if that features works as it should. Note that this will change + * the structure of the test a bit. + */ - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - - /* double lower_hr_threshold = */ 0.75, + if ( pass ) { - /* double increment = */ 2.0, + auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 8 * 1024 * 1024; + auto_size_ctl.min_clean_fraction = 0.5; - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, + auto_size_ctl.max_size = 8 * 1024 * 1024; + auto_size_ctl.min_size = 512 * 1024; - /* double upper_hr_threshold = */ 0.995, + auto_size_ctl.epoch_length = 1000; - /* double decrement = */ 0.1, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), + auto_size_ctl.incr_mode = H5C_incr__threshold; - /* int32_t epochs_before_eviction = */ 3, + auto_size_ctl.lower_hr_threshold = 0.75; - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05 - }; + auto_size_ctl.increment = 2.0; - TESTING("automatic cache resize disable"); + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (4 * 1024 * 1024); - pass = TRUE; - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + auto_size_ctl.decr_mode = H5C_decr__age_out; - /* allocate a cache, enable automatic cache resizing, and then force - * the cache through all its operational modes. Verify that all - * performs as expected. - */ + auto_size_ctl.upper_hr_threshold = 0.995; - if ( pass ) { + auto_size_ctl.decrement = 0.5; - reset_entries(); + auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.max_decrement = (1 * 1024 * 1024); - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); - } + auto_size_ctl.epochs_before_eviction = 3; - if ( pass ) { + auto_size_ctl.apply_empty_reserve = FALSE; + auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 5.\n"; } } if ( pass ) { - if ( ( cache_ptr->max_cache_size != (512 * 1024) ) || - ( cache_ptr->min_clean_size != (256 * 1024) ) ) { + if ( ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after initialization.\n"; + failure_mssg = "bad cache size after set resize re-config 4.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /****************************************************************** - * So far, we have forced the auto cache resize through all modes - * other than increase_disabled and decrease_disabled. Force these - * modes now. Note that there are several ways we can reach these - * modes. - ******************************************************************/ - - if ( pass ) { - - auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - auto_size_ctl.rpt_fcn = test_rpt_fcn; - - auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 4 * 1024 * 1024; - - auto_size_ctl.min_clean_fraction = 0.5; - - auto_size_ctl.max_size = 16 * 1024 * 1024; - auto_size_ctl.min_size = 1 * 1024 * 1024; - - auto_size_ctl.epoch_length = 1000; - + /* fill the cache with 1024 byte entries -- nothing should happen + * for three epochs while the markers are inserted into the cache + * + * Note that hit rate will be zero, so the cache will attempt to + * increase its size. Since we are already at max size, it will + * not be able to. + */ + if ( pass ) { /* first epoch */ - auto_size_ctl.incr_mode = H5C_incr__threshold; + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - auto_size_ctl.lower_hr_threshold = 0.75; + if ( pass ) { + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - auto_size_ctl.increment = 1.0; /* disable size increases */ + if ( ( ! rpt_fcn_called ) || + ( rpt_status != at_max_size ) || + ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { - auto_size_ctl.apply_max_increment = FALSE; - auto_size_ctl.max_increment = (4 * 1024 * 1024); + pass = FALSE; + failure_mssg = "Unexpected cache size change results 36.\n"; + } + } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - auto_size_ctl.decr_mode = H5C_decr__threshold; + if ( pass ) { /* second epoch */ - auto_size_ctl.upper_hr_threshold = 0.995; + rpt_fcn_called = FALSE; + i = 1000; + while ( ( pass ) && ( i < 2000 ) ) + { + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - auto_size_ctl.decrement = 0.5; + if ( pass ) { + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - auto_size_ctl.apply_max_decrement = FALSE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); + if ( ( ! rpt_fcn_called ) || + ( rpt_status != at_max_size ) || + ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { - auto_size_ctl.epochs_before_eviction = 3; + pass = FALSE; + failure_mssg = "Unexpected cache size change results 37.\n"; + } + } - auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05; + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + if ( pass ) { /* third epoch */ - if ( result != SUCCEED ) { + rpt_fcn_called = FALSE; + i = 2000; + while ( ( pass ) && ( i < 3000 ) ) + { + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 2.\n"; + if ( pass ) { + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; } - } - - if ( pass ) { - if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + if ( ( ! rpt_fcn_called ) || + ( rpt_status != at_max_size ) || + ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 1.\n"; + failure_mssg = "Unexpected cache size change results 38.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate with cache full -- increase disabled so should - * be no change in cache size, and result should be increase_disabled. + /* fourth epoch -- If the hit rate were above the lower threshold, + * we would see cache size reduction now. However, nothing will + * happen until we get the hit rate above the lower threshold. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 3000; + while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_increase_possible ) || - ( rpt_status != increase_disabled ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + ( rpt_status != at_max_size ) || + ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 1.\n"; + failure_mssg = "Unexpected cache size change results 39.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force high hit rate -- make sure that we haven't disabled decreases. - * should result in a decrease cache size from 4 to 2 Meg. + /* fifth epoch -- force the hit rate to 100%. We should see cache size + * reduction now. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 3000; + while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -12036,156 +6877,115 @@ check_auto_cache_resize_disable(void) if ( ( ! rpt_fcn_called ) || ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + ( cache_ptr->max_cache_size != (7 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (7 * 512 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 2.\n"; + failure_mssg = "Unexpected cache size change results 40.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate again -- increase disabled so should - * be no change in cache size, and result should be increase_disabled. + /* sixth epoch -- force the hit rate to 100% again. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 2000; + while ( ( pass ) && ( i < 3000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_increase_possible ) || - ( rpt_status != increase_disabled ) || - ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (6 * 512 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 3.\n"; + failure_mssg = "Unexpected cache size change results 41.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Repeat the above tests, disabling increase through the lower - * threshold instead of the increment. + /* seventh epoch -- keep hit rate at 100%, and keep 2K entries active. */ - if ( pass ) { - auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - auto_size_ctl.rpt_fcn = test_rpt_fcn; - - auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 4 * 1024 * 1024; - - auto_size_ctl.min_clean_fraction = 0.5; - - auto_size_ctl.max_size = 16 * 1024 * 1024; - auto_size_ctl.min_size = 1 * 1024 * 1024; - - auto_size_ctl.epoch_length = 1000; - - - auto_size_ctl.incr_mode = H5C_incr__threshold; - - auto_size_ctl.lower_hr_threshold = 0.0; /* disable size increases */ - - auto_size_ctl.increment = 2.0; - - auto_size_ctl.apply_max_increment = FALSE; - auto_size_ctl.max_increment = (4 * 1024 * 1024); - - - auto_size_ctl.decr_mode = H5C_decr__threshold; - - auto_size_ctl.upper_hr_threshold = 0.995; - - auto_size_ctl.decrement = 0.5; - - auto_size_ctl.apply_max_decrement = FALSE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); - - auto_size_ctl.epochs_before_eviction = 3; - - auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05; - - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - - if ( result != SUCCEED ) { + rpt_fcn_called = FALSE; + i = 3000; + while ( ( pass ) && ( i < 4000 ) ) + { + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 3.\n"; + if ( pass ) { + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; } - } - - if ( pass ) { - if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + if ( ( ! rpt_fcn_called ) || + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (5 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (5 * 512 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 2.\n"; + failure_mssg = "Unexpected cache size change results 42.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate with cache full -- increase disabled so should - * be no change in cache size, and result should be in_spec. + /* eigth epoch -- still 100% hit rate */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 2000; + while ( ( pass ) && ( i < 3000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_increase_possible ) || - ( rpt_status != in_spec ) || + ( rpt_status != decrease ) || ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + ( cache_ptr->min_clean_size != (4 * 512 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 4.\n"; + failure_mssg = "Unexpected cache size change results 43.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force high hit rate -- make sure that we haven't disabled decreases. - * should result in a decrease cache size from 4 to 2 Meg. + /* ninth epoch --hit rate at 100%. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 3000; + while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; @@ -12193,147 +6993,165 @@ check_auto_cache_resize_disable(void) if ( ( ! rpt_fcn_called ) || ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + ( cache_ptr->max_cache_size != (3 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 512 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 5.\n"; + failure_mssg = "Unexpected cache size change results 44.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate again -- increase disabled so should - * be no change in cache size, and result should be increase_disabled. + /* tenth epoch -- still 100% hit rate */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 2000; + while ( ( pass ) && ( i < 3000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_increase_possible ) || - ( rpt_status != in_spec ) || + ( rpt_status != decrease ) || ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + ( cache_ptr->min_clean_size != (2 * 512 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 6.\n"; + failure_mssg = "Unexpected cache size change results 45.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Repeat the above tests yet again, disabling increase through the - * incr_mode. + /* eleventh epoch -- hit rate at 100% -- starting to stableize */ - if ( pass ) { - auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - auto_size_ctl.rpt_fcn = test_rpt_fcn; - - auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 4 * 1024 * 1024; - - auto_size_ctl.min_clean_fraction = 0.5; - - auto_size_ctl.max_size = 16 * 1024 * 1024; - auto_size_ctl.min_size = 1 * 1024 * 1024; - - auto_size_ctl.epoch_length = 1000; - - - auto_size_ctl.incr_mode = H5C_incr__off; + rpt_fcn_called = FALSE; + i = 3000; + while ( ( pass ) && ( i < 4000 ) ) + { + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - auto_size_ctl.lower_hr_threshold = 0.75; + if ( pass ) { + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - auto_size_ctl.increment = 2.0; + if ( ( ! rpt_fcn_called ) || + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (2000 * 1024) ) || + ( cache_ptr->min_clean_size != (int)(2000 * 512) ) ) { - auto_size_ctl.apply_max_increment = FALSE; - auto_size_ctl.max_increment = (4 * 1024 * 1024); + pass = FALSE; + failure_mssg = "Unexpected cache size change results 46.\n"; + } + } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - auto_size_ctl.decr_mode = H5C_decr__threshold; + /* twelth epoch -- force the hit rate to 100% again -- should be steady + * state. + */ + if ( pass ) { - auto_size_ctl.upper_hr_threshold = 0.995; + rpt_fcn_called = FALSE; + i = 2000; + while ( ( pass ) && ( i < 3000 ) ) + { + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - auto_size_ctl.decrement = 0.5; + if ( pass ) { + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - auto_size_ctl.apply_max_decrement = FALSE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); + if ( ( ! rpt_fcn_called ) || + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (2000 * 1024) ) || + ( cache_ptr->min_clean_size != (int)(2000 * 512) ) ) { - auto_size_ctl.epochs_before_eviction = 3; + pass = FALSE; + failure_mssg = "Unexpected cache size change results 47.\n"; + } + } - auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05; + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + /* now just bang on one entry -- after three epochs, this should + * get all entries other than the one evicted, and the cache size + * should be decreased to the minimum. + */ + if ( pass ) { /* thirteenth epoch */ - if ( result != SUCCEED ) { + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 4.\n"; + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; } - } - if ( pass ) { - - if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + if ( ( ! rpt_fcn_called ) || + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (2000 * 1024) ) || + ( cache_ptr->min_clean_size != (int)(2000 * 512) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 3.\n"; + failure_mssg = "Unexpected cache size change results 48.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate with cache full -- increase disabled so should - * be no change in cache size, and result should be in_spec. - */ - if ( pass ) { + if ( pass ) { /* fourteenth epoch */ rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_increase_possible ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != + (1001 * 1024 + MONSTER_ENTRY_SIZE) ) || + ( cache_ptr->min_clean_size != + (1001 * 512 + MONSTER_ENTRY_SIZE / 2) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 7.\n"; + failure_mssg = "Unexpected cache size change results 49.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force high hit rate -- make sure that we haven't disabled decreases. - * should result in a decrease cache size from 4 to 2 Meg. - */ - if ( pass ) { + if ( pass ) { /* fifteenth epoch -- cache size reduction */ rpt_fcn_called = FALSE; i = 0; @@ -12350,48 +7168,52 @@ check_auto_cache_resize_disable(void) if ( ( ! rpt_fcn_called ) || ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + ( cache_ptr->max_cache_size != (512 * 1024) ) || + ( cache_ptr->min_clean_size != (256 * 1024) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != + MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 8.\n"; + failure_mssg = "Unexpected cache size change results 50.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate again -- increase disabled so should - * be no change in cache size, and result should be increase_disabled. - */ - if ( pass ) { + if ( pass ) { /* sixteenth epoch -- at minimum size so no more ageouts */ rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_increase_possible ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + ( rpt_status != at_min_size ) || + ( cache_ptr->max_cache_size != (512 * 1024) ) || + ( cache_ptr->min_clean_size != (256 * 1024) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != + MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 9.\n"; + failure_mssg = "Unexpected cache size change results 51.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Now, disable size decreases, and repeat the above tests. + + /* repeat the test yet again, this time with empty reserve enabled. + * Again, some structural changes in the test are necessary. */ if ( pass ) { @@ -12400,12 +7222,12 @@ check_auto_cache_resize_disable(void) auto_size_ctl.rpt_fcn = test_rpt_fcn; auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 4 * 1024 * 1024; + auto_size_ctl.initial_size = 8 * 1024 * 1024; auto_size_ctl.min_clean_fraction = 0.5; - auto_size_ctl.max_size = 16 * 1024 * 1024; - auto_size_ctl.min_size = 1 * 1024 * 1024; + auto_size_ctl.max_size = 8 * 1024 * 1024; + auto_size_ctl.min_size = 512 * 1024; auto_size_ctl.epoch_length = 1000; @@ -12417,359 +7239,314 @@ check_auto_cache_resize_disable(void) auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.max_increment = (4 * 1024 * 1024); - auto_size_ctl.decr_mode = H5C_decr__threshold; + auto_size_ctl.decr_mode = H5C_decr__age_out; auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 1.0; /* disable size decreases */ + auto_size_ctl.decrement = 0.5; - auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.apply_max_decrement = FALSE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); auto_size_ctl.epochs_before_eviction = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05; + auto_size_ctl.empty_reserve = 0.5; /* for ease of testing */ result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 5.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 6.\n"; } } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - if ( pass ) { - if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + if ( ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 4.\n"; + failure_mssg = "bad cache size after set resize re-config 5.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force high hit rate -- should be no change in cache size, - * and result should be decrease_disabled. + + /* fill the cache with 1024 byte entries -- nothing should happen + * for three epochs while the markers are inserted into the cache + * + * Note that hit rate will be zero, so the cache will attempt to + * increase its size. Since we are already at max size, it will + * not be able to. */ - if ( pass ) { + if ( pass ) { /* first epoch */ rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease_disabled ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + ( rpt_status != at_max_size ) || + ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 10.\n"; + failure_mssg = "Unexpected cache size change results 52.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate -- cache size should increase from 4 to 6 Meg. - */ - if ( pass ) { + if ( pass ) { /* second epoch */ rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 1000; + while ( ( pass ) && ( i < 2000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != increase ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + ( rpt_status != at_max_size ) || + ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 11.\n"; + failure_mssg = "Unexpected cache size change results 53.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force high hit rate again -- should be no change in cache size, - * and result should be decrease_disabled. - */ - if ( pass ) { + if ( pass ) { /* third epoch */ rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 2000; + while ( ( pass ) && ( i < 3000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease_disabled ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + ( rpt_status != at_max_size ) || + ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 12.\n"; + failure_mssg = "Unexpected cache size change results 54.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Repeat the above tests, disabling decrease through the upper - * threshold instead of the decrement. + /* fourth epoch -- If the hit rate were above the lower threshold, + * we would see cache size reduction now. However, nothing will + * happen until we get the hit rate above the lower threshold. */ - if ( pass ) { - auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - auto_size_ctl.rpt_fcn = test_rpt_fcn; - - auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 4 * 1024 * 1024; - - auto_size_ctl.min_clean_fraction = 0.5; - - auto_size_ctl.max_size = 16 * 1024 * 1024; - auto_size_ctl.min_size = 1 * 1024 * 1024; - - auto_size_ctl.epoch_length = 1000; - - - auto_size_ctl.incr_mode = H5C_incr__threshold; - - auto_size_ctl.lower_hr_threshold = 0.75; - - auto_size_ctl.increment = 2.0; - - auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (2 * 1024 * 1024); - - - auto_size_ctl.decr_mode = H5C_decr__threshold; - - auto_size_ctl.upper_hr_threshold = 1.0; /* disable size decreases */ + rpt_fcn_called = FALSE; + i = 3000; + while ( ( pass ) && ( i < 4000 ) ) + { + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - auto_size_ctl.decrement = 0.5; + if ( pass ) { + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - auto_size_ctl.apply_max_decrement = TRUE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); + if ( ( ! rpt_fcn_called ) || + ( rpt_status != at_max_size ) || + ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { - auto_size_ctl.epochs_before_eviction = 3; + pass = FALSE; + failure_mssg = "Unexpected cache size change results 55.\n"; + } + } - auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05; + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + /* fifth epoch -- force the hit rate to 100%. We should see cache size + * reduction now. + */ + if ( pass ) { - if ( result != SUCCEED ) { + rpt_fcn_called = FALSE; + i = 3000; + while ( ( pass ) && ( i < 4000 ) ) + { + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 6.\n"; + if ( pass ) { + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; } - } - - if ( pass ) { - if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + if ( ( ! rpt_fcn_called ) || + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (4002 * 1024) ) || + ( cache_ptr->min_clean_size != (int)(4002 * 512) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 5.\n"; + failure_mssg = "Unexpected cache size change results 56.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force high hit rate -- should be no change in cache size, - * and result should be in_spec. + /* sixth epoch -- force the hit rate to 100% again. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 3000; + while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_decrease_possible ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (2002 * 1024) ) || + ( cache_ptr->min_clean_size != (int)(2002 * 512) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 13.\n"; + failure_mssg = "Unexpected cache size change results 57.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate -- cache size should increase from 4 to 6 Meg. + /* seventh epoch -- force the hit rate to 100% again. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 3000; + while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != increase ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (2000 * 1024) ) || + ( cache_ptr->min_clean_size != (int)(2000 * 512) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 14.\n"; + failure_mssg = "Unexpected cache size change results 58.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force high hit rate again -- should be no change in cache size, - * and result should be in_spec. + /* eigth epoch -- force the hit rate to 100% again -- should be steady + * state. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 3000; + while ( ( pass ) && ( i < 4000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_decrease_possible ) || ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + ( cache_ptr->max_cache_size != (2000 * 1024) ) || + ( cache_ptr->min_clean_size != (int)(2000 * 512) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 15.\n"; + failure_mssg = "Unexpected cache size change results 59.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Repeat the above tests, disabling decrease through the decr_mode. + /* now just bang on one entry -- after three epochs, this should + * get all entries other than the one evicted, and the cache size + * should be decreased to the minimum. */ + if ( pass ) { /* ninth epoch */ - if ( pass ) { - - auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - auto_size_ctl.rpt_fcn = test_rpt_fcn; - - auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 4 * 1024 * 1024; - - auto_size_ctl.min_clean_fraction = 0.5; - - auto_size_ctl.max_size = 16 * 1024 * 1024; - auto_size_ctl.min_size = 1 * 1024 * 1024; - - auto_size_ctl.epoch_length = 1000; - - - auto_size_ctl.incr_mode = H5C_incr__threshold; - - auto_size_ctl.lower_hr_threshold = 0.75; - - auto_size_ctl.increment = 2.0; - - auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (2 * 1024 * 1024); - - - auto_size_ctl.decr_mode = H5C_decr__off; - - auto_size_ctl.upper_hr_threshold = 0.995; - - auto_size_ctl.decrement = 0.5; - - auto_size_ctl.apply_max_decrement = TRUE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); - - auto_size_ctl.epochs_before_eviction = 3; - - auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05; - - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - - if ( result != SUCCEED ) { + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 7.\n"; + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; } - } - - if ( pass ) { - if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + if ( ( ! rpt_fcn_called ) || + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (2000 * 1024) ) || + ( cache_ptr->min_clean_size != (int)(2000 * 512) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 6.\n"; + failure_mssg = "Unexpected cache size change results 60.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force high hit rate -- should be no change in cache size, - * and result should be in_spec. - */ - if ( pass ) { + if ( pass ) { /* tenth epoch */ rpt_fcn_called = FALSE; i = 0; @@ -12785,51 +7562,48 @@ check_auto_cache_resize_disable(void) } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_decrease_possible ) || ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + ( cache_ptr->max_cache_size != (2000 * 1024) ) || + ( cache_ptr->min_clean_size != (2000 * 512) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 16.\n"; + failure_mssg = "Unexpected cache size change results 61.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate -- cache size should increase from 4 to 6 Meg. - */ - if ( pass ) { + if ( pass ) { /* eleventh epoch -- cache size reduction */ rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != increase ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (512 * 1024) ) || + ( cache_ptr->min_clean_size != (256 * 1024) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != + MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 17.\n"; + failure_mssg = "Unexpected cache size change results 62.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force high hit rate again -- should be no change in cache size, - * and result should be in_spec. - */ - if ( pass ) { + if ( pass ) { /* twelth epoch -- at minimum size so no more ageouts */ rpt_fcn_called = FALSE; i = 0; @@ -12845,21 +7619,25 @@ check_auto_cache_resize_disable(void) } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_decrease_possible ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + ( rpt_status != at_min_size ) || + ( cache_ptr->max_cache_size != (512 * 1024) ) || + ( cache_ptr->min_clean_size != (256 * 1024) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != + MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 18.\n"; + failure_mssg = "Unexpected cache size change results 63.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Now do tests disabling size decrement in age out mode. + + /* Repeat the test again, this time using the age out with threshold + * mode. To simplify the testing, set epochs to eviction to 1. * - * Start by disabling size decrement by setting max_decrement to zero. + * Again, there are some minor structural changes in the test. */ if ( pass ) { @@ -12868,38 +7646,38 @@ check_auto_cache_resize_disable(void) auto_size_ctl.rpt_fcn = test_rpt_fcn; auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 4 * 1024 * 1024; + auto_size_ctl.initial_size = 8 * 1024 * 1024; auto_size_ctl.min_clean_fraction = 0.5; - auto_size_ctl.max_size = 16 * 1024 * 1024; - auto_size_ctl.min_size = 1 * 1024 * 1024; + auto_size_ctl.max_size = 8 * 1024 * 1024; + auto_size_ctl.min_size = 512 * 1024; auto_size_ctl.epoch_length = 1000; - auto_size_ctl.incr_mode = H5C_incr__threshold; + auto_size_ctl.incr_mode = H5C_incr__off; auto_size_ctl.lower_hr_threshold = 0.75; auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.max_increment = (4 * 1024 * 1024); - auto_size_ctl.decr_mode = H5C_decr__age_out; + auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; - auto_size_ctl.upper_hr_threshold = 0.995; + auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */ auto_size_ctl.decrement = 0.5; - auto_size_ctl.apply_max_decrement = TRUE; - auto_size_ctl.max_decrement = 0; /* disable decrement */ + auto_size_ctl.apply_max_decrement = FALSE; + auto_size_ctl.max_decrement = (1 * 1024 * 1024); - auto_size_ctl.epochs_before_eviction = 1; + auto_size_ctl.epochs_before_eviction = 1; /* for ease of testing */ - auto_size_ctl.apply_empty_reserve = TRUE; + auto_size_ctl.apply_empty_reserve = FALSE; auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -12907,183 +7685,225 @@ check_auto_cache_resize_disable(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 8.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 7.\n"; + } + } + + if ( pass ) { + + if ( ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "bad cache size after set resize re-config 6.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + + /* fill the cache with 4K byte entries -- increment mode is off, + * so cache size reduction should kick in as soon as we get the + * hit rate above .999. + */ + if ( pass ) { /* first epoch -- hit rate 0 */ + + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 64.\n"; } } - if ( pass ) { + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + if ( pass ) { /* second epoch -- hit rate 0 */ - pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 7.\n"; + rpt_fcn_called = FALSE; + i = 1000; + while ( ( pass ) && ( i < 2000 ) ) + { + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; } - } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( ( ! rpt_fcn_called ) || + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { - /* flush the cache and destroy all entries so we start from a known point */ - flush_cache(cache_ptr, TRUE, FALSE, FALSE); + pass = FALSE; + failure_mssg = "Unexpected cache size change results 65.\n"; + } + } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* load up the cache with small entries. Note that it will take an - * epoch for the ageout code to initialize itself if it is enabled. - */ - if ( pass ) { + if ( pass ) { /* third epoch -- hit rate 1.0 -- should see decrease */ rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_decrease_possible ) || - ( rpt_status != not_full ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (1001 * LARGE_ENTRY_SIZE) ) || + ( cache_ptr->min_clean_size != (1001 * LARGE_ENTRY_SIZE / 2) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 19.\n"; + failure_mssg = "Unexpected cache size change results 66.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Load up some more small entries. - */ + /* fourth epoch -- load up the cache again -- hit rate 0 */ if ( pass ) { rpt_fcn_called = FALSE; - i = 1000; - while ( ( pass ) && ( i < 2000 ) ) + i = 0; + while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_decrease_possible ) || - ( rpt_status != not_full ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (1001 * LARGE_ENTRY_SIZE) ) || + ( cache_ptr->min_clean_size != (1001 * LARGE_ENTRY_SIZE / 2) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 20.\n"; + failure_mssg = "Unexpected cache size change results 67.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Now force a high hit rate so that the size increase code is - * is satisfied. We would see a decrease here if decrease were - * possible. - */ + /* fifth epoch -- still loading up the cache -- hit rate 0 */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 1000; + while ( ( pass ) && ( i < 2000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_decrease_possible ) || - ( rpt_status != decrease_disabled ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (1001 * LARGE_ENTRY_SIZE) ) || + ( cache_ptr->min_clean_size != (1001 * LARGE_ENTRY_SIZE / 2) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 21.\n"; + failure_mssg = "Unexpected cache size change results 68.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate -- cache size should increase from 4 to 6 Meg. - */ + /* sixth epoch -- force hit rate to .998 -- should be no reduction */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 1002; + while ( ( pass ) && ( i < 2002 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != increase ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (1001 * LARGE_ENTRY_SIZE) ) || + ( cache_ptr->min_clean_size != (1001 * LARGE_ENTRY_SIZE / 2) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 22.\n"; + failure_mssg = "Unexpected cache size change results 69.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* just bang on a single entry. This will see to it that there are - * many entries that could be aged out were decreases enabled. - * Should be no change in cache size, and result should be - * decrease_disabled. + /* seventh epoch -- force hit rate to .999 -- should see reduction */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 1003; + while ( ( pass ) && ( i < 2003 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_decrease_possible ) || - ( rpt_status != decrease_disabled ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (1000 * MEDIUM_ENTRY_SIZE) ) || + ( cache_ptr->min_clean_size != (1000 * MEDIUM_ENTRY_SIZE / 2) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 23.\n"; + failure_mssg = "Unexpected cache size change results 70.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Now disable size decrement in age out mode via the empty reserve. + + /* We have now tested all the major ageout modes individually. + * Lets try them all together to look for unexpected interactions + * and/or bugs. */ if ( pass ) { @@ -13092,12 +7912,12 @@ check_auto_cache_resize_disable(void) auto_size_ctl.rpt_fcn = test_rpt_fcn; auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 4 * 1024 * 1024; + auto_size_ctl.initial_size = 8 * 1000 * 1024; auto_size_ctl.min_clean_fraction = 0.5; - auto_size_ctl.max_size = 16 * 1024 * 1024; - auto_size_ctl.min_size = 1 * 1024 * 1024; + auto_size_ctl.max_size = 8 * 1000 * 1024; + auto_size_ctl.min_size = 512 * 1024; auto_size_ctl.epoch_length = 1000; @@ -13109,51 +7929,140 @@ check_auto_cache_resize_disable(void) auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.max_increment = (4 * 1024 * 1024); - auto_size_ctl.decr_mode = H5C_decr__age_out; + auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; - auto_size_ctl.upper_hr_threshold = 0.995; + auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */ auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = TRUE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); + auto_size_ctl.max_decrement = (1 * 1000 * 1024); - auto_size_ctl.epochs_before_eviction = 1; + auto_size_ctl.epochs_before_eviction = 1; /* for ease of testing */ auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 1.0; /* disable decrement */ + auto_size_ctl.empty_reserve = 0.5; /* for ease of testing */ result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 9.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 8.\n"; } } if ( pass ) { - if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + if ( ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "bad cache size after set resize re-config 7.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* fill the cache with 4K byte entries -- increment mode is threshold, + * so the decrease code will not be executed until the hit rate exceeds + * .75. + */ + if ( pass ) { /* first epoch -- hit rate 0 */ + + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( rpt_status != at_max_size ) || + ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 71.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass ) { /* second epoch -- hit rate 0 */ + + rpt_fcn_called = FALSE; + i = 1000; + while ( ( pass ) && ( i < 2000 ) ) + { + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( rpt_status != at_max_size ) || + ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 72.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* third epoch -- force the hit rate to 1.0. Should be no change + * in the cache size due to the combination of the empty reserve + * and the max decrease. Max decrease will limit the evictions + * in any one epoch, and the empty reserve will not permit cache + * size reduction unless the specified empty reserve is maintained. + * + * In this epoch, all we should see is a reduction in the index size. + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) || + ( cache_ptr->index_size != (7 * 1000 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 8.\n"; + failure_mssg = "Unexpected cache size change results 73.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* flush the cache and destroy all entries so we start from a known point */ - flush_cache(cache_ptr, TRUE, FALSE, FALSE); - - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* load up the cache with small entries. Note that it will take an - * epoch for the ageout code to initialize itself if it is enabled. + /* fourth epoch -- hit rate still 1.0. Index size should decrease, + * but otherwise no change expected. */ if ( pass ) { @@ -13161,61 +8070,62 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_decrease_possible ) || - ( rpt_status != not_full ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) || + ( cache_ptr->index_size != (6 * 1000 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 24.\n"; + failure_mssg = "Unexpected cache size change results 74.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Load up some more small entries. + /* fifth epoch -- hit rate still 1.0. Index size should decrease, + * but otherwise no change expected. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 1000; - while ( ( pass ) && ( i < 2000 ) ) + i = 0; + while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_decrease_possible ) || - ( rpt_status != not_full ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) || + ( cache_ptr->index_size != (5 * 1000 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 25.\n"; + failure_mssg = "Unexpected cache size change results 75.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Now force a high hit rate so that the size increase code is - * is satisfied. We would see a decrease here if decrease were - * possible. + /* sixth epoch -- hit rate still 1.0. Index size should decrease, + * but otherwise no change expected. Note that the cache size is + * now just on the edge of meeting the clean reserve. */ if ( pass ) { @@ -13223,29 +8133,29 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_decrease_possible ) || - ( rpt_status != decrease_disabled ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) || + ( cache_ptr->index_size != (4 * 1000 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 26.\n"; + failure_mssg = "Unexpected cache size change results 76.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate -- cache size should increase from 4 to 6 Meg. + /* seventh epoch -- hit rate still 1.0. No change in index size expected. */ if ( pass ) { @@ -13253,31 +8163,30 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != increase ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) || + ( cache_ptr->index_size != (4 * 1000 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 27.\n"; + failure_mssg = "Unexpected cache size change results 77.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* just bang on a single entry. This will see to it that there are - * many entries that could be aged out were decreases enabled. - * Should be no change in cache size, and result should be - * decrease_disabled. + /* eighth epoch -- start loading 1 KB entries. Hit rate 0 so + * decrease code shouldn't be called. */ if ( pass ) { @@ -13285,106 +8194,125 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_decrease_possible ) || - ( rpt_status != decrease_disabled ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + ( rpt_status != at_max_size ) || + ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) || + ( cache_ptr->index_size != (5 * 1000 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 28.\n"; + failure_mssg = "Unexpected cache size change results 78.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Now work with age out with threshold. One can argue that we should - * repeat the above age out tests with age out with threshold, but the - * same code is executed in both cases so I don't see the point. If - * that ever changes, this test should be updated. - * - * There is only one way of disabling decrements that is peculiar - * to age out with threshold, which is to set the upper threshold - * to 1.0. Test this now. + /* ninth epoch -- access the 1 KB entries again, driving the hit rate + * to 1.0. Decrease code should be triggered, but the max decrease + * should prevent the empty reserve from being met in this epoch. */ - if ( pass ) { - auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - auto_size_ctl.rpt_fcn = test_rpt_fcn; - - auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 4 * 1024 * 1024; - - auto_size_ctl.min_clean_fraction = 0.5; - - auto_size_ctl.max_size = 16 * 1024 * 1024; - auto_size_ctl.min_size = 1 * 1024 * 1024; - - auto_size_ctl.epoch_length = 1000; - - - auto_size_ctl.incr_mode = H5C_incr__threshold; - - auto_size_ctl.lower_hr_threshold = 0.75; - - auto_size_ctl.increment = 2.0; - - auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (2 * 1024 * 1024); - + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; + if ( pass ) { + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - auto_size_ctl.upper_hr_threshold = 1.0; + if ( ( ! rpt_fcn_called ) || + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (8 * 1000 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1000 * 1024) ) || + ( cache_ptr->index_size != (4 * 1000 * 1024) ) ) { - auto_size_ctl.decrement = 0.5; + pass = FALSE; + failure_mssg = "Unexpected cache size change results 79.\n"; + } + } - auto_size_ctl.apply_max_decrement = TRUE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - auto_size_ctl.epochs_before_eviction = 1; + /* tenth epoch -- access the 1 KB entries yet again, forcing hit rate + * to 1.0. Decrease code should be triggered, and the empty reserve + * should finally be met. + */ + if ( pass ) { - auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05; + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + if ( pass ) { + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - if ( result != SUCCEED ) { + if ( ( ! rpt_fcn_called ) || + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (7 * 1000 * 1024) ) || + ( cache_ptr->min_clean_size != (7 * 1000 * 1024 / 2) ) || + ( cache_ptr->index_size != (3 * 1000 * 1024) ) ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 10.\n"; + failure_mssg = "Unexpected cache size change results 80.\n"; } } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* eleventh epoch -- access the 1 KB entries yet again, forcing hit rate + * to 1.0. Decrease code should be triggered, and the empty reserve + * should be met again. + */ if ( pass ) { - if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 9.\n"; + if ( pass ) { + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; } - } - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( ( ! rpt_fcn_called ) || + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (6 * 1000 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1000 * 1024) ) || + ( cache_ptr->index_size != (2 * 1000 * 1024) ) ) { - /* flush the cache and destroy all entries so we start from a known point */ - flush_cache(cache_ptr, TRUE, FALSE, FALSE); + pass = FALSE; + failure_mssg = "Unexpected cache size change results 81.\n"; + } + } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* load up the cache with small entries. Note that it will take an - * epoch for the ageout code to initialize itself if it is enabled. + /* twelth epoch -- hit rate 1.0 -- decrease as before. */ if ( pass ) { @@ -13392,63 +8320,59 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_decrease_possible ) || - ( rpt_status != not_full ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (5 * 1000 * 1024) ) || + ( cache_ptr->min_clean_size != (5 * 1000 * 1024 / 2) ) || + ( cache_ptr->index_size != (1 * 1000 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 29.\n"; + failure_mssg = "Unexpected cache size change results 82.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Load up some more small entries. + /* thirteenth epoch -- hit rate 1.0 -- decrease as before. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 1000; - while ( ( pass ) && ( i < 2000 ) ) + i = 0; + while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_decrease_possible ) || - ( rpt_status != not_full ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (4 * 1000 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1000 * 1024) ) || + ( cache_ptr->index_size != (1 * 1000 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 30.\n"; + failure_mssg = "Unexpected cache size change results 83.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Now force a high hit rate so that the size increase code is - * is satisfied. We would see a decrease here if decrease were - * possible, but the upper threshold cannot be met, so no decrease. - * - * rpt_status should be decrease_disabled. + /* fourteenth epoch -- hit rate 1.0 -- decrease as before. */ if ( pass ) { @@ -13456,31 +8380,29 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_decrease_possible ) || - ( rpt_status != decrease_disabled ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) || - ( cache_ptr->index_len != 2000 ) || - ( cache_ptr->index_size != 2000 * SMALL_ENTRY_SIZE ) ) { + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (3 * 1000 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1000 * 1024 / 2) ) || + ( cache_ptr->index_size != (1 * 1000 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 31.\n"; + failure_mssg = "Unexpected cache size change results 84.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate -- cache size should increase from 4 to 6 Meg. + /* fifteenth epoch -- hit rate 1.0 -- decrease as before. */ if ( pass ) { @@ -13488,33 +8410,29 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != increase ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (2 * 1000 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1000 * 1024) ) || + ( cache_ptr->index_size != (1 * 1000 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 32.\n"; + failure_mssg = "Unexpected cache size change results 85.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* just bang on a single entry. This keeps the hit rate high, and sees - * to it that there are many entries that could be aged out were - * decreases enabled. - * - * Should be no change in cache size, and result should be - * decrease_disabled. + /* sixteenth epoch -- hit rate 1.0 -- should be stable now */ if ( pass ) { @@ -13522,35 +8440,159 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 999); + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 999, + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( cache_ptr->size_decrease_possible ) || - ( rpt_status != decrease_disabled ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (2 * 1000 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1000 * 1024) ) || + ( cache_ptr->index_size != (1 * 1000 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 33.\n"; + failure_mssg = "Unexpected cache size change results 86.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( pass ) { + + takedown_cache(cache_ptr, FALSE, FALSE); + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass ) { PASSED(); } else { H5_FAILED(); } - /********************************************************************* - * Finally, use the auto cache resize code to set the size of the - * cache and keep it there. Again, due to the complexity of the - * interface, there are lots of ways of doing this. We have to - * check them all. - *********************************************************************/ + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); + +} /* check_auto_cache_resize() */ + + +/*------------------------------------------------------------------------- + * Function: check_auto_cache_resize_disable() + * + * Purpose: Test the various ways in which the resize code can + * be disabled. Unfortunately, there are quite a few of them. + * + * Return: void + * + * Programmer: John Mainzer + * 12/16/04 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ + +static void +check_auto_cache_resize_disable(void) +{ + const char * fcn_name = "check_auto_cache_resize_disable()"; + hbool_t show_progress = FALSE; + herr_t result; + int32_t i; + int32_t checkpoint = 0; + H5C_t * cache_ptr = NULL; + H5C_auto_size_ctl_t auto_size_ctl = + { + /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* H5C_auto_resize_report_fcn rpt_fcn = */ test_rpt_fcn, + + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (512 * 1024), + + /* double min_clean_fraction = */ 0.5, + + /* size_t max_size = */ (14 * 1024 * 1024), + /* size_t min_size = */ (512 * 1024), + + /* int64_t epoch_length = */ 1000, + + + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, + + /* double lower_hr_threshold = */ 0.75, + + /* double increment = */ 2.0, + + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), + + + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, + + /* double upper_hr_threshold = */ 0.995, + + /* double decrement = */ 0.1, + + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), + + /* int32_t epochs_before_eviction = */ 3, + + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.05 + }; + + TESTING("automatic cache resize disable"); + + pass = TRUE; + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* allocate a cache, enable automatic cache resizing, and then force + * the cache through all its operational modes. Verify that all + * performs as expected. + */ + + if ( pass ) { + + reset_entries(); + + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); + } + + if ( pass ) { + + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n"; + } + } + + if ( pass ) { + + if ( ( cache_ptr->max_cache_size != (512 * 1024) ) || + ( cache_ptr->min_clean_size != (256 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "bad cache size after initialization.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + + /****************************************************************** + * So far, we have forced the auto cache resize through all modes + * other than increase_disabled and decrease_disabled. Force these + * modes now. Note that there are several ways we can reach these + * modes. + ******************************************************************/ if ( pass ) { @@ -13558,33 +8600,33 @@ check_auto_cache_resize_disable(void) auto_size_ctl.rpt_fcn = test_rpt_fcn; auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 2 * 1024 * 1024; + auto_size_ctl.initial_size = 4 * 1024 * 1024; auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 16 * 1024 * 1024; - auto_size_ctl.min_size = 1 * 1024 * 1024; + auto_size_ctl.min_size = 1 * 1024 * 1024; auto_size_ctl.epoch_length = 1000; auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.0; /* disable size increases */ + auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 2.0; + auto_size_ctl.increment = 1.0; /* disable size increases */ - auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.apply_max_increment = FALSE; + auto_size_ctl.max_increment = (4 * 1024 * 1024); auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 1.0; /* disable size decreases */ + auto_size_ctl.upper_hr_threshold = 0.995; auto_size_ctl.decrement = 0.5; - auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.apply_max_decrement = FALSE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); auto_size_ctl.epochs_before_eviction = 3; @@ -13597,24 +8639,55 @@ check_auto_cache_resize_disable(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 11.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 2.\n"; } } if ( pass ) { - if ( ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 10.\n"; + failure_mssg = "bad cache size after set resize re-config 1.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate -- should be no response as the auto-resize - * code should be disabled. + /* force low hit rate with cache full -- increase disabled so should + * be no change in cache size, and result should be increase_disabled. + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( cache_ptr->size_increase_possible ) || + ( rpt_status != increase_disabled ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 1.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* force high hit rate -- make sure that we haven't disabled decreases. + * should result in a decrease cache size from 4 to 2 Meg. */ if ( pass ) { @@ -13622,31 +8695,29 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } - if ( ( rpt_fcn_called ) || - ( cache_ptr->resize_enabled ) || - ( cache_ptr->size_increase_possible ) || - ( cache_ptr->size_decrease_possible ) || + if ( ( ! rpt_fcn_called ) || + ( rpt_status != decrease ) || ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 34.\n"; + failure_mssg = "Unexpected cache size change results 2.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force high hit rate -- should be no response as the auto-resize - * code should be disabled. + /* force low hit rate again -- increase disabled so should + * be no change in cache size, and result should be increase_disabled. */ if ( pass ) { @@ -13654,29 +8725,32 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } - if ( ( rpt_fcn_called ) || - ( cache_ptr->resize_enabled ) || + if ( ( ! rpt_fcn_called ) || ( cache_ptr->size_increase_possible ) || - ( cache_ptr->size_decrease_possible ) || + ( rpt_status != increase_disabled ) || ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 35.\n"; + failure_mssg = "Unexpected cache size change results 3.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* Repeat the above tests, disabling increase through the lower + * threshold instead of the increment. + */ + if ( pass ) { auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; @@ -13685,31 +8759,31 @@ check_auto_cache_resize_disable(void) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 4 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.25; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 16 * 1024 * 1024; - auto_size_ctl.min_size = 1 * 1024 * 1024; + auto_size_ctl.min_size = 1 * 1024 * 1024; auto_size_ctl.epoch_length = 1000; auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.75; + auto_size_ctl.lower_hr_threshold = 0.0; /* disable size increases */ - auto_size_ctl.increment = 1.0; /* disable size increment */ + auto_size_ctl.increment = 2.0; - auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.apply_max_increment = FALSE; + auto_size_ctl.max_increment = (4 * 1024 * 1024); auto_size_ctl.decr_mode = H5C_decr__threshold; auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 1.0; /* disable size decrement */ + auto_size_ctl.decrement = 0.5; - auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.apply_max_decrement = FALSE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); auto_size_ctl.epochs_before_eviction = 3; @@ -13722,24 +8796,24 @@ check_auto_cache_resize_disable(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 12.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 3.\n"; } } if ( pass ) { if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 11.\n"; + failure_mssg = "bad cache size after set resize re-config 2.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate -- should be no response as the auto-resize - * code should be disabled. + /* force low hit rate with cache full -- increase disabled so should + * be no change in cache size, and result should be in_spec. */ if ( pass ) { @@ -13756,22 +8830,21 @@ check_auto_cache_resize_disable(void) i++; } - if ( ( rpt_fcn_called ) || - ( cache_ptr->resize_enabled ) || + if ( ( ! rpt_fcn_called ) || ( cache_ptr->size_increase_possible ) || - ( cache_ptr->size_decrease_possible ) || + ( rpt_status != in_spec ) || ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 36.\n"; + failure_mssg = "Unexpected cache size change results 4.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force high hit rate -- should be no response as the auto-resize - * code should be disabled. + /* force high hit rate -- make sure that we haven't disabled decreases. + * should result in a decrease cache size from 4 to 2 Meg. */ if ( pass ) { @@ -13788,44 +8861,77 @@ check_auto_cache_resize_disable(void) i++; } - if ( ( rpt_fcn_called ) || - ( cache_ptr->resize_enabled ) || + if ( ( ! rpt_fcn_called ) || + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 5.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* force low hit rate again -- increase disabled so should + * be no change in cache size, and result should be increase_disabled. + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || ( cache_ptr->size_increase_possible ) || - ( cache_ptr->size_decrease_possible ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 37.\n"; + failure_mssg = "Unexpected cache size change results 6.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* Repeat the above tests yet again, disabling increase through the + * incr_mode. + */ + if ( pass ) { auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; auto_size_ctl.rpt_fcn = test_rpt_fcn; - auto_size_ctl.set_initial_size = FALSE; - auto_size_ctl.initial_size = 2 * 1024 * 1024; + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 4 * 1024 * 1024; auto_size_ctl.min_clean_fraction = 0.5; - auto_size_ctl.max_size = 6 * 1024 * 1024; /* no resize */ - auto_size_ctl.min_size = 6 * 1024 * 1024; /* no resize */ + auto_size_ctl.max_size = 16 * 1024 * 1024; + auto_size_ctl.min_size = 1 * 1024 * 1024; auto_size_ctl.epoch_length = 1000; - auto_size_ctl.incr_mode = H5C_incr__threshold; + auto_size_ctl.incr_mode = H5C_incr__off; auto_size_ctl.lower_hr_threshold = 0.75; auto_size_ctl.increment = 2.0; - auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.apply_max_increment = FALSE; + auto_size_ctl.max_increment = (4 * 1024 * 1024); auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -13834,7 +8940,7 @@ check_auto_cache_resize_disable(void) auto_size_ctl.decrement = 0.5; - auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.apply_max_decrement = FALSE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); auto_size_ctl.epochs_before_eviction = 3; @@ -13847,24 +8953,24 @@ check_auto_cache_resize_disable(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 13.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 4.\n"; } } if ( pass ) { - if ( ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 12.\n"; + failure_mssg = "bad cache size after set resize re-config 3.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate -- should be no response as the auto-resize - * code should be disabled. + /* force low hit rate with cache full -- increase disabled so should + * be no change in cache size, and result should be in_spec. */ if ( pass ) { @@ -13881,22 +8987,21 @@ check_auto_cache_resize_disable(void) i++; } - if ( ( rpt_fcn_called ) || - ( cache_ptr->resize_enabled ) || + if ( ( ! rpt_fcn_called ) || ( cache_ptr->size_increase_possible ) || - ( cache_ptr->size_decrease_possible ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 38.\n"; + failure_mssg = "Unexpected cache size change results 7.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force high hit rate -- should be no response as the auto-resize - * code should be disabled. + /* force high hit rate -- make sure that we haven't disabled decreases. + * should result in a decrease cache size from 4 to 2 Meg. */ if ( pass ) { @@ -13913,20 +9018,52 @@ check_auto_cache_resize_disable(void) i++; } - if ( ( rpt_fcn_called ) || - ( cache_ptr->resize_enabled ) || + if ( ( ! rpt_fcn_called ) || + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 8.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* force low hit rate again -- increase disabled so should + * be no change in cache size, and result should be increase_disabled. + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || ( cache_ptr->size_increase_possible ) || - ( cache_ptr->size_decrease_possible ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 39.\n"; + failure_mssg = "Unexpected cache size change results 9.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* Now, disable size decreases, and repeat the above tests. + */ + if ( pass ) { auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; @@ -13935,10 +9072,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.set_initial_size = TRUE; auto_size_ctl.initial_size = 4 * 1024 * 1024; - auto_size_ctl.min_clean_fraction = 0.25; + auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 16 * 1024 * 1024; - auto_size_ctl.min_size = 1 * 1024 * 1024; + auto_size_ctl.min_size = 1 * 1024 * 1024; auto_size_ctl.epoch_length = 1000; @@ -13947,7 +9084,7 @@ check_auto_cache_resize_disable(void) auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 1.0; /* disable size increment */ + auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); @@ -13955,9 +9092,9 @@ check_auto_cache_resize_disable(void) auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 1.0; /* disable size decrement */ + auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5; + auto_size_ctl.decrement = 1.0; /* disable size decreases */ auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -13972,24 +9109,26 @@ check_auto_cache_resize_disable(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 14.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 5.\n"; } } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( pass ) { if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 13.\n"; + failure_mssg = "bad cache size after set resize re-config 4.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate -- should be no response as the auto-resize - * code should be disabled. + /* force high hit rate -- should be no change in cache size, + * and result should be decrease_disabled. */ if ( pass ) { @@ -13997,31 +9136,58 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } - if ( ( rpt_fcn_called ) || - ( cache_ptr->resize_enabled ) || - ( cache_ptr->size_increase_possible ) || - ( cache_ptr->size_decrease_possible ) || + if ( ( ! rpt_fcn_called ) || + ( rpt_status != decrease_disabled ) || ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 10.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* force low hit rate -- cache size should increase from 4 to 6 Meg. + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( rpt_status != increase ) || + ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 40.\n"; + failure_mssg = "Unexpected cache size change results 11.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force high hit rate -- should be no response as the auto-resize - * code should be disabled. + /* force high hit rate again -- should be no change in cache size, + * and result should be decrease_disabled. */ if ( pass ) { @@ -14038,20 +9204,22 @@ check_auto_cache_resize_disable(void) i++; } - if ( ( rpt_fcn_called ) || - ( cache_ptr->resize_enabled ) || - ( cache_ptr->size_increase_possible ) || - ( cache_ptr->size_decrease_possible ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + if ( ( ! rpt_fcn_called ) || + ( rpt_status != decrease_disabled ) || + ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 41.\n"; + failure_mssg = "Unexpected cache size change results 12.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* Repeat the above tests, disabling decrease through the upper + * threshold instead of the decrement. + */ + if ( pass ) { auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; @@ -14063,14 +9231,14 @@ check_auto_cache_resize_disable(void) auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 16 * 1024 * 1024; - auto_size_ctl.min_size = 1 * 1024 * 1024; + auto_size_ctl.min_size = 1 * 1024 * 1024; auto_size_ctl.epoch_length = 1000; auto_size_ctl.incr_mode = H5C_incr__threshold; - auto_size_ctl.lower_hr_threshold = 0.0; /* disable size increment */ + auto_size_ctl.lower_hr_threshold = 0.75; auto_size_ctl.increment = 2.0; @@ -14080,9 +9248,9 @@ check_auto_cache_resize_disable(void) auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 0.995; + auto_size_ctl.upper_hr_threshold = 1.0; /* disable size decreases */ - auto_size_ctl.decrement = 1.0; /* disable size decrement */ + auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -14092,13 +9260,12 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_empty_reserve = TRUE; auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 15.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 6.\n"; } } @@ -14108,14 +9275,14 @@ check_auto_cache_resize_disable(void) ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 14.\n"; + failure_mssg = "bad cache size after set resize re-config 5.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate -- should be no response as the auto-resize - * code should be disabled. + /* force high hit rate -- should be no change in cache size, + * and result should be in_spec. */ if ( pass ) { @@ -14123,31 +9290,59 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } - if ( ( rpt_fcn_called ) || - ( cache_ptr->resize_enabled ) || - ( cache_ptr->size_increase_possible ) || + if ( ( ! rpt_fcn_called ) || ( cache_ptr->size_decrease_possible ) || + ( rpt_status != in_spec ) || ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 42.\n"; + failure_mssg = "Unexpected cache size change results 13.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force high hit rate -- should be no response as the auto-resize - * code should be disabled. + /* force low hit rate -- cache size should increase from 4 to 6 Meg. + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( rpt_status != increase ) || + ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 14.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* force high hit rate again -- should be no change in cache size, + * and result should be in_spec. */ if ( pass ) { @@ -14164,20 +9359,22 @@ check_auto_cache_resize_disable(void) i++; } - if ( ( rpt_fcn_called ) || - ( cache_ptr->resize_enabled ) || - ( cache_ptr->size_increase_possible ) || + if ( ( ! rpt_fcn_called ) || ( cache_ptr->size_decrease_possible ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 43.\n"; + failure_mssg = "Unexpected cache size change results 15.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* Repeat the above tests, disabling decrease through the decr_mode. + */ + if ( pass ) { auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; @@ -14189,12 +9386,12 @@ check_auto_cache_resize_disable(void) auto_size_ctl.min_clean_fraction = 0.5; auto_size_ctl.max_size = 16 * 1024 * 1024; - auto_size_ctl.min_size = 1 * 1024 * 1024; + auto_size_ctl.min_size = 1 * 1024 * 1024; auto_size_ctl.epoch_length = 1000; - auto_size_ctl.incr_mode = H5C_incr__off; + auto_size_ctl.incr_mode = H5C_incr__threshold; auto_size_ctl.lower_hr_threshold = 0.75; @@ -14218,13 +9415,12 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_empty_reserve = TRUE; auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 16.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 7.\n"; } } @@ -14234,46 +9430,14 @@ check_auto_cache_resize_disable(void) ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 15.\n"; - } - } - - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* force low hit rate -- should be no response as the auto-resize - * code should be disabled. - */ - if ( pass ) { - - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } - - if ( ( rpt_fcn_called ) || - ( cache_ptr->resize_enabled ) || - ( cache_ptr->size_increase_possible ) || - ( cache_ptr->size_decrease_possible ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { - - pass = FALSE; - failure_mssg = "Unexpected cache size change results 44.\n"; + failure_mssg = "bad cache size after set resize re-config 6.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force high hit rate -- should be no response as the auto-resize - * code should be disabled. + /* force high hit rate -- should be no change in cache size, + * and result should be in_spec. */ if ( pass ) { @@ -14290,142 +9454,82 @@ check_auto_cache_resize_disable(void) i++; } - if ( ( rpt_fcn_called ) || - ( cache_ptr->resize_enabled ) || - ( cache_ptr->size_increase_possible ) || + if ( ( ! rpt_fcn_called ) || ( cache_ptr->size_decrease_possible ) || + ( rpt_status != in_spec ) || ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 45.\n"; + failure_mssg = "Unexpected cache size change results 16.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* force low hit rate -- cache size should increase from 4 to 6 Meg. + */ if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); - } - - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -} /* check_auto_cache_resize_disable() */ - - -/*------------------------------------------------------------------------- - * Function: check_auto_cache_resize_epoch_markers() - * - * Purpose: Verify that the auto-resize code manages epoch markers - * correctly. - * - * Return: void - * - * Programmer: John Mainzer - * 12/16/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static void -check_auto_cache_resize_epoch_markers(void) -{ - const char * fcn_name = "check_auto_cache_resize_epoch_markers()"; - hbool_t show_progress = FALSE; - herr_t result; - int32_t i; - int32_t j; - int32_t checkpoint = 0; - H5C_t * cache_ptr = NULL; - H5C_auto_size_ctl_t auto_size_ctl = - { - /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* H5C_auto_resize_report_fcn rpt_fcn = */ test_rpt_fcn, - - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (512 * 1024), - - /* double min_clean_fraction = */ 0.5, - - /* size_t max_size = */ (14 * 1024 * 1024), - /* size_t min_size = */ (512 * 1024), - - /* int64_t epoch_length = */ 1000, - - - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - - /* double lower_hr_threshold = */ 0.75, - - /* double increment = */ 2.0, - - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - - - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, - - /* double upper_hr_threshold = */ 0.995, - - /* double decrement = */ 0.1, - - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - - /* int32_t epochs_before_eviction = */ 3, - - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05 - }; - - TESTING("automatic cache resize epoch marker management"); - - pass = TRUE; - - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - if ( pass ) { - - reset_entries(); - - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); - } - - if ( pass ) { - - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - if ( result != SUCCEED ) { + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( rpt_status != increase ) || + ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n"; + failure_mssg = "Unexpected cache size change results 17.\n"; } } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* force high hit rate again -- should be no change in cache size, + * and result should be in_spec. + */ if ( pass ) { - if ( ( cache_ptr->max_cache_size != (512 * 1024) ) || - ( cache_ptr->min_clean_size != (256 * 1024) ) ) { + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( cache_ptr->size_decrease_possible ) || + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after initialization.\n"; + failure_mssg = "Unexpected cache size change results 18.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* Now make sure that we are managing the epoch markers correctly. + /* Now do tests disabling size decrement in age out mode. + * + * Start by disabling size decrement by setting max_decrement to zero. */ if ( pass ) { @@ -14434,24 +9538,24 @@ check_auto_cache_resize_epoch_markers(void) auto_size_ctl.rpt_fcn = test_rpt_fcn; auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 8 * 1024 * 1024; + auto_size_ctl.initial_size = 4 * 1024 * 1024; auto_size_ctl.min_clean_fraction = 0.5; - auto_size_ctl.max_size = 8 * 1024 * 1024; - auto_size_ctl.min_size = 512 * 1024; + auto_size_ctl.max_size = 16 * 1024 * 1024; + auto_size_ctl.min_size = 1 * 1024 * 1024; auto_size_ctl.epoch_length = 1000; - auto_size_ctl.incr_mode = H5C_incr__off; + auto_size_ctl.incr_mode = H5C_incr__threshold; auto_size_ctl.lower_hr_threshold = 0.75; auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.max_increment = (2 * 1024 * 1024); auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -14460,12 +9564,12 @@ check_auto_cache_resize_epoch_markers(void) auto_size_ctl.decrement = 0.5; - auto_size_ctl.apply_max_decrement = FALSE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); + auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.max_decrement = 0; /* disable decrement */ - auto_size_ctl.epochs_before_eviction = 10; + auto_size_ctl.epochs_before_eviction = 1; - auto_size_ctl.apply_empty_reserve = FALSE; + auto_size_ctl.apply_empty_reserve = TRUE; auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -14473,105 +9577,97 @@ check_auto_cache_resize_epoch_markers(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 2.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 8.\n"; } } if ( pass ) { - if ( ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 1.\n"; + failure_mssg = "bad cache size after set resize re-config 7.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Since we just created the cache, there should be no epoch markers - * active. Verify that this is true. - */ - - if ( pass ) { - - if ( cache_ptr->epoch_markers_active != 0 ) { + /* flush the cache and destroy all entries so we start from a known point */ + flush_cache(cache_ptr, TRUE, FALSE, FALSE); - pass = FALSE; - failure_mssg = "Unexpected # of epoch markers 1.\n"; - } - } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* load up the cache with small entries. Note that it will take an + * epoch for the ageout code to initialize itself if it is enabled. + */ if ( pass ) { rpt_fcn_called = FALSE; i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); + protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) || - ( cache_ptr->index_size != (1 * 1000 * MEDIUM_ENTRY_SIZE) ) ) { + ( cache_ptr->size_decrease_possible ) || + ( rpt_status != not_full ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 0.\n"; + failure_mssg = "Unexpected cache size change results 19.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - + /* Load up some more small entries. + */ if ( pass ) { - j = 2; - while ( ( pass ) && ( j <= 10 ) ) + rpt_fcn_called = FALSE; + i = 1000; + while ( ( pass ) && ( i < 2000 ) ) { + protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); - rpt_fcn_called = FALSE; - i = (j - 2) * 1000; - while ( ( pass ) && ( i < (j - 1) * 1000 ) ) - { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; + if ( pass ) { + unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); } + i++; + } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->epoch_markers_active != j ) ) { - - pass = FALSE; - failure_mssg = "Unexpected # of epoch markers 2.\n"; - } + if ( ( ! rpt_fcn_called ) || + ( cache_ptr->size_decrease_possible ) || + ( rpt_status != not_full ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { - j++; + pass = FALSE; + failure_mssg = "Unexpected cache size change results 20.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* we now have a full complement of epoch markers -- see if - * we get the expected reduction. + /* Now force a high hit rate so that the size increase code is + * is satisfied. We would see a decrease here if decrease were + * possible. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 9000; - while ( ( pass ) && ( i < 10000 ) ) + i = 0; + while ( ( pass ) && ( i < 1000 ) ) { protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); @@ -14583,365 +9679,352 @@ check_auto_cache_resize_epoch_markers(void) } if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != - (10 * 1000 * SMALL_ENTRY_SIZE + MEDIUM_ENTRY_SIZE) ) || - ( cache_ptr->min_clean_size != - ((10 * 1000 * SMALL_ENTRY_SIZE + MEDIUM_ENTRY_SIZE) / 2) ) || - ( cache_ptr->index_size != - (10 * 1000 * SMALL_ENTRY_SIZE + MEDIUM_ENTRY_SIZE) ) ) { + ( cache_ptr->size_decrease_possible ) || + ( rpt_status != decrease_disabled ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 1.\n"; + failure_mssg = "Unexpected cache size change results 21.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* now reduce the epochs before eviction, and see if the cache - * deletes the extra markers + /* force low hit rate -- cache size should increase from 4 to 6 Meg. */ if ( pass ) { - auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - auto_size_ctl.rpt_fcn = test_rpt_fcn; - - auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 8 * 1024 * 1024; - - auto_size_ctl.min_clean_fraction = 0.5; - - auto_size_ctl.max_size = 8 * 1024 * 1024; - auto_size_ctl.min_size = 512 * 1024; - - auto_size_ctl.epoch_length = 1000; - - - auto_size_ctl.incr_mode = H5C_incr__off; - - auto_size_ctl.lower_hr_threshold = 0.75; - - auto_size_ctl.increment = 2.0; - - auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (4 * 1024 * 1024); - - - auto_size_ctl.decr_mode = H5C_decr__age_out; - - auto_size_ctl.upper_hr_threshold = 0.995; - - auto_size_ctl.decrement = 0.5; - - auto_size_ctl.apply_max_decrement = FALSE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); - - auto_size_ctl.epochs_before_eviction = 1; - - auto_size_ctl.apply_empty_reserve = FALSE; - auto_size_ctl.empty_reserve = 0.05; - - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - - if ( result != SUCCEED ) { + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 3.\n"; + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; } - } - - if ( pass ) { - if ( ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + if ( ( ! rpt_fcn_called ) || + ( rpt_status != increase ) || + ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 2.\n"; + failure_mssg = "Unexpected cache size change results 22.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* There should be exactly one active epoch marker at present. - */ - if ( pass ) { - - if ( cache_ptr->epoch_markers_active != 1 ) { - - pass = FALSE; - failure_mssg = "Unexpected # of epoch markers 3.\n"; - } - } - - /* Now do an epochs worth of accesses, and verify that everything - * not accessed in this epoch gets evicted, and the cache size - * is reduced. + /* just bang on a single entry. This will see to it that there are + * many entries that could be aged out were decreases enabled. + * Should be no change in cache size, and result should be + * decrease_disabled. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 9000; - while ( ( pass ) && ( i < 10000 ) ) + i = 0; + while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (512 * 1024) ) || - ( cache_ptr->min_clean_size != (256 * 1024) ) || - ( cache_ptr->index_size != (1 * 1000 * SMALL_ENTRY_SIZE) ) ) { + ( cache_ptr->size_decrease_possible ) || + ( rpt_status != decrease_disabled ) || + ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 2.\n"; + failure_mssg = "Unexpected cache size change results 23.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* There should be exactly one active epoch marker at present... + /* Now disable size decrement in age out mode via the empty reserve. */ - if ( pass ) { - - if ( cache_ptr->epoch_markers_active != 1 ) { - pass = FALSE; - failure_mssg = "Unexpected # of epoch markers 4.\n"; - } - } - - /* shift the decrement mode to threshold, and verify that we remove - * all epoch markers. - */ if ( pass ) { auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; auto_size_ctl.rpt_fcn = test_rpt_fcn; auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 8 * 1024 * 1024; + auto_size_ctl.initial_size = 4 * 1024 * 1024; auto_size_ctl.min_clean_fraction = 0.5; - auto_size_ctl.max_size = 8 * 1024 * 1024; - auto_size_ctl.min_size = 512 * 1024; + auto_size_ctl.max_size = 16 * 1024 * 1024; + auto_size_ctl.min_size = 1 * 1024 * 1024; auto_size_ctl.epoch_length = 1000; - auto_size_ctl.incr_mode = H5C_incr__off; + auto_size_ctl.incr_mode = H5C_incr__threshold; auto_size_ctl.lower_hr_threshold = 0.75; auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.max_increment = (2 * 1024 * 1024); - auto_size_ctl.decr_mode = H5C_decr__threshold; + auto_size_ctl.decr_mode = H5C_decr__age_out; auto_size_ctl.upper_hr_threshold = 0.995; auto_size_ctl.decrement = 0.5; - auto_size_ctl.apply_max_decrement = FALSE; + auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); auto_size_ctl.epochs_before_eviction = 1; - auto_size_ctl.apply_empty_reserve = FALSE; - auto_size_ctl.empty_reserve = 0.05; + auto_size_ctl.apply_empty_reserve = TRUE; + auto_size_ctl.empty_reserve = 1.0; /* disable decrement */ result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 4.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 9.\n"; } } if ( pass ) { - if ( ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { + if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 3.\n"; + failure_mssg = "bad cache size after set resize re-config 8.\n"; } } - /* ... and now there should be none. - */ - if ( pass ) { - - if ( cache_ptr->epoch_markers_active != 0 ) { + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - pass = FALSE; - failure_mssg = "Unexpected # of epoch markers 5.\n"; - } - } + /* flush the cache and destroy all entries so we start from a known point */ + flush_cache(cache_ptr, TRUE, FALSE, FALSE); if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* shift the decrement mode to age out with threshold. Set epochs - * before eviction to 10 again. + /* load up the cache with small entries. Note that it will take an + * epoch for the ageout code to initialize itself if it is enabled. */ if ( pass ) { - auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - auto_size_ctl.rpt_fcn = test_rpt_fcn; - - auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 8 * 1024 * 1024; - - auto_size_ctl.min_clean_fraction = 0.5; - - auto_size_ctl.max_size = 8 * 1024 * 1024; - auto_size_ctl.min_size = 512 * 1024; - - auto_size_ctl.epoch_length = 1000; - - - auto_size_ctl.incr_mode = H5C_incr__off; - - auto_size_ctl.lower_hr_threshold = 0.75; - - auto_size_ctl.increment = 2.0; - - auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (4 * 1024 * 1024); - + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); - auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; + if ( pass ) { + unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - auto_size_ctl.upper_hr_threshold = 0.995; + if ( ( ! rpt_fcn_called ) || + ( cache_ptr->size_decrease_possible ) || + ( rpt_status != not_full ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { - auto_size_ctl.decrement = 0.5; + pass = FALSE; + failure_mssg = "Unexpected cache size change results 24.\n"; + } + } - auto_size_ctl.apply_max_decrement = FALSE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - auto_size_ctl.epochs_before_eviction = 10; + /* Load up some more small entries. + */ + if ( pass ) { - auto_size_ctl.apply_empty_reserve = FALSE; - auto_size_ctl.empty_reserve = 0.05; + rpt_fcn_called = FALSE; + i = 1000; + while ( ( pass ) && ( i < 2000 ) ) + { + protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + if ( pass ) { + unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - if ( result != SUCCEED ) { + if ( ( ! rpt_fcn_called ) || + ( cache_ptr->size_decrease_possible ) || + ( rpt_status != not_full ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 5.\n"; + failure_mssg = "Unexpected cache size change results 25.\n"; } } - /* Verify that there are no active epoch markers. + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Now force a high hit rate so that the size increase code is + * is satisfied. We would see a decrease here if decrease were + * possible. */ if ( pass ) { - if ( cache_ptr->epoch_markers_active != 0 ) { + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( cache_ptr->size_decrease_possible ) || + ( rpt_status != decrease_disabled ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected # of epoch markers 6.\n"; + failure_mssg = "Unexpected cache size change results 26.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* build up a full set of epoch markers. */ + /* force low hit rate -- cache size should increase from 4 to 6 Meg. + */ if ( pass ) { - j = 1; - while ( ( pass ) && ( j <= 10 ) ) + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - rpt_fcn_called = FALSE; - i = (j - 1) * 1000; - while ( ( pass ) && ( i < j * 1000 ) ) - { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); - - if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); } + i++; + } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != in_spec ) || - ( cache_ptr->epoch_markers_active != j ) ) { - - pass = FALSE; - failure_mssg = "Unexpected # of epoch markers 7.\n"; - } + if ( ( ! rpt_fcn_called ) || + ( rpt_status != increase ) || + ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { - j++; + pass = FALSE; + failure_mssg = "Unexpected cache size change results 27.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Verify that there are now 10 active epoch markers. + /* just bang on a single entry. This will see to it that there are + * many entries that could be aged out were decreases enabled. + * Should be no change in cache size, and result should be + * decrease_disabled. */ if ( pass ) { - if ( cache_ptr->epoch_markers_active != 10 ) { + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( cache_ptr->size_decrease_possible ) || + ( rpt_status != decrease_disabled ) || + ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected # of epoch markers 8.\n"; + failure_mssg = "Unexpected cache size change results 28.\n"; } } - /* shift the decrement mode to off. This should cause all epoch - * markers to be removed. + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Now work with age out with threshold. One can argue that we should + * repeat the above age out tests with age out with threshold, but the + * same code is executed in both cases so I don't see the point. If + * that ever changes, this test should be updated. + * + * There is only one way of disabling decrements that is peculiar + * to age out with threshold, which is to set the upper threshold + * to 1.0. Test this now. */ + if ( pass ) { auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; auto_size_ctl.rpt_fcn = test_rpt_fcn; auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 8 * 1024 * 1024; + auto_size_ctl.initial_size = 4 * 1024 * 1024; auto_size_ctl.min_clean_fraction = 0.5; - auto_size_ctl.max_size = 8 * 1024 * 1024; - auto_size_ctl.min_size = 512 * 1024; + auto_size_ctl.max_size = 16 * 1024 * 1024; + auto_size_ctl.min_size = 1 * 1024 * 1024; auto_size_ctl.epoch_length = 1000; - auto_size_ctl.incr_mode = H5C_incr__off; + auto_size_ctl.incr_mode = H5C_incr__threshold; auto_size_ctl.lower_hr_threshold = 0.75; auto_size_ctl.increment = 2.0; auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.max_increment = (2 * 1024 * 1024); - auto_size_ctl.decr_mode = H5C_decr__off; + auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; - auto_size_ctl.upper_hr_threshold = 0.995; + auto_size_ctl.upper_hr_threshold = 1.0; auto_size_ctl.decrement = 0.5; - auto_size_ctl.apply_max_decrement = FALSE; + auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); - auto_size_ctl.epochs_before_eviction = 10; + auto_size_ctl.epochs_before_eviction = 1; - auto_size_ctl.apply_empty_reserve = FALSE; + auto_size_ctl.apply_empty_reserve = TRUE; auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); @@ -14949,1387 +10032,1771 @@ check_auto_cache_resize_epoch_markers(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 6.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 10.\n"; } } - /* Verify that there are now no active epoch markers. + if ( pass ) { + + if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "bad cache size after set resize re-config 9.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* flush the cache and destroy all entries so we start from a known point */ + flush_cache(cache_ptr, TRUE, FALSE, FALSE); + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* load up the cache with small entries. Note that it will take an + * epoch for the ageout code to initialize itself if it is enabled. */ if ( pass ) { - if ( cache_ptr->epoch_markers_active != 0 ) { + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( cache_ptr->size_decrease_possible ) || + ( rpt_status != not_full ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected # of epoch markers 9.\n"; + failure_mssg = "Unexpected cache size change results 29.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* verify that we still have the expected number of entries in the cache, - * and that the cache is of the expected size. + /* Load up some more small entries. */ if ( pass ) { - if ( ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (4 * 1024 * 1024) )|| - ( cache_ptr->index_size != (10 * 1000 * SMALL_ENTRY_SIZE) ) || - ( cache_ptr->index_len != 10000 ) ) { + rpt_fcn_called = FALSE; + i = 1000; + while ( ( pass ) && ( i < 2000 ) ) + { + protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( cache_ptr->size_decrease_possible ) || + ( rpt_status != not_full ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 3.\n"; + failure_mssg = "Unexpected cache size change results 30.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* Now force a high hit rate so that the size increase code is + * is satisfied. We would see a decrease here if decrease were + * possible, but the upper threshold cannot be met, so no decrease. + * + * rpt_status should be decrease_disabled. + */ if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( cache_ptr->size_decrease_possible ) || + ( rpt_status != decrease_disabled ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) || + ( cache_ptr->index_len != 2000 ) || + ( cache_ptr->index_size != 2000 * SMALL_ENTRY_SIZE ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 31.\n"; + } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - if ( pass ) { PASSED(); } else { H5_FAILED(); } + /* force low hit rate -- cache size should increase from 4 to 6 Meg. + */ + if ( pass ) { - if ( ! pass ) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); -} /* check_auto_cache_resize_epoch_markers() */ + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - -/*------------------------------------------------------------------------- - * Function: check_auto_cache_resize_input_errs() - * - * Purpose: Verify that H5C_set_cache_auto_resize_config() detects - * and rejects invalid input. - * - * Return: void - * - * Programmer: John Mainzer - * 10/29/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ + if ( ( ! rpt_fcn_called ) || + ( rpt_status != increase ) || + ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { -#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).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 ) ) + pass = FALSE; + failure_mssg = "Unexpected cache size change results 32.\n"; + } + } -static void -check_auto_cache_resize_input_errs(void) -{ - const char * fcn_name = "check_auto_cache_resize_input_errs()"; - herr_t result; - H5C_t * cache_ptr = NULL; - H5C_auto_size_ctl_t ref_auto_size_ctl = - { - /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* H5C_auto_resize_report_fcn rpt_fcn = */ test_rpt_fcn, + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (512 * 1024), + /* just bang on a single entry. This keeps the hit rate high, and sees + * to it that there are many entries that could be aged out were + * decreases enabled. + * + * Should be no change in cache size, and result should be + * decrease_disabled. + */ + if ( pass ) { - /* double min_clean_fraction = */ 0.5, + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 999); - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ (512 * 1024), + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 999, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - /* int64_t epoch_length = */ 1000, + if ( ( ! rpt_fcn_called ) || + ( cache_ptr->size_decrease_possible ) || + ( rpt_status != decrease_disabled ) || + ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + pass = FALSE; + failure_mssg = "Unexpected cache size change results 33.\n"; + } + } - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* double lower_hr_threshold = */ 0.75, - /* double increment = */ 2.0, + /********************************************************************* + * Finally, use the auto cache resize code to set the size of the + * cache and keep it there. Again, due to the complexity of the + * interface, there are lots of ways of doing this. We have to + * check them all. + *********************************************************************/ + + if ( pass ) { + + auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; + + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 2 * 1024 * 1024; + + auto_size_ctl.min_clean_fraction = 0.5; + + auto_size_ctl.max_size = 16 * 1024 * 1024; + auto_size_ctl.min_size = 1 * 1024 * 1024; + + auto_size_ctl.epoch_length = 1000; - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), + auto_size_ctl.incr_mode = H5C_incr__threshold; - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, + auto_size_ctl.lower_hr_threshold = 0.0; /* disable size increases */ - /* double upper_hr_threshold = */ 0.995, + auto_size_ctl.increment = 2.0; - /* double decrement = */ 0.1, + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (2 * 1024 * 1024); - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int32_t epochs_before_eviction = */ 3, + auto_size_ctl.decr_mode = H5C_decr__threshold; - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05 - }; + auto_size_ctl.upper_hr_threshold = 1.0; /* disable size decreases */ - H5C_auto_size_ctl_t invalid_auto_size_ctl; - H5C_auto_size_ctl_t test_auto_size_ctl; + auto_size_ctl.decrement = 0.5; - TESTING("automatic cache resize input errors"); + auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.max_decrement = (1 * 1024 * 1024); - pass = TRUE; + auto_size_ctl.epochs_before_eviction = 3; - /* allocate a cache, and set a reference automatic cache control - * configuration. Then feed H5C_set_cache_auto_resize_config() - * invalid input, and verify that the correct error is returned, - * and that the configuration is not modified. - */ + auto_size_ctl.apply_empty_reserve = TRUE; + auto_size_ctl.empty_reserve = 0.05; - if ( pass ) { + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - reset_entries(); + if ( result != SUCCEED ) { - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 11.\n"; + } } if ( pass ) { - result = H5C_set_cache_auto_resize_config(cache_ptr, - &ref_auto_size_ctl); - - if ( result != SUCCEED ) { + if ( ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n"; + failure_mssg = "bad cache size after set resize re-config 10.\n"; } } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* force low hit rate -- should be no response as the auto-resize + * code should be disabled. + */ if ( pass ) { - if ( ( cache_ptr->max_cache_size != (512 * 1024) ) || - ( cache_ptr->min_clean_size != (256 * 1024) ) ) { + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( rpt_fcn_called ) || + ( cache_ptr->resize_enabled ) || + ( cache_ptr->size_increase_possible ) || + ( cache_ptr->size_decrease_possible ) || + ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after initialization.\n"; + failure_mssg = "Unexpected cache size change results 34.\n"; } } - if ( pass ) { + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - result = H5C_get_cache_auto_resize_config(cache_ptr, - &test_auto_size_ctl); + /* force high hit rate -- should be no response as the auto-resize + * code should be disabled. + */ + if ( pass ) { - if ( result != SUCCEED ) { + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 1."; + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + if ( ( rpt_fcn_called ) || + ( cache_ptr->resize_enabled ) || + ( cache_ptr->size_increase_possible ) || + ( cache_ptr->size_decrease_possible ) || + ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 1."; + failure_mssg = "Unexpected cache size change results 35.\n"; } } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( pass ) { - invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - invalid_auto_size_ctl.rpt_fcn = NULL; + auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; - invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.5; + auto_size_ctl.min_clean_fraction = 0.25; - invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; - invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + auto_size_ctl.max_size = 16 * 1024 * 1024; + auto_size_ctl.min_size = 1 * 1024 * 1024; - invalid_auto_size_ctl.epoch_length = 5000; + auto_size_ctl.epoch_length = 1000; - invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; + auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.7; + auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0; + auto_size_ctl.increment = 1.0; /* disable size increment */ - invalid_auto_size_ctl.apply_max_increment = TRUE; - invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999; + auto_size_ctl.upper_hr_threshold = 0.995; - invalid_auto_size_ctl.decrement = 0.5; + auto_size_ctl.decrement = 1.0; /* disable size decrement */ - invalid_auto_size_ctl.apply_max_decrement = TRUE; - invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.max_decrement = (1 * 1024 * 1024); - invalid_auto_size_ctl.epochs_before_eviction = 3; + auto_size_ctl.epochs_before_eviction = 3; - invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05; + auto_size_ctl.apply_empty_reserve = TRUE; + auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(NULL, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - if ( result != FAIL ) { + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = - "H5C_set_cache_auto_resize_config accepted NULL cache_ptr.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 12.\n"; } } if ( pass ) { - result = H5C_get_cache_auto_resize_config(cache_ptr, - &test_auto_size_ctl); - - if ( result != SUCCEED ) { - - pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 2."; - - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 2."; + failure_mssg = "bad cache size after set resize re-config 11.\n"; } } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* check bad version rejection. */ - + /* force low hit rate -- should be no response as the auto-resize + * code should be disabled. + */ if ( pass ) { - invalid_auto_size_ctl.version = -1; /* INVALID */ - invalid_auto_size_ctl.rpt_fcn = NULL; - - invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - - invalid_auto_size_ctl.min_clean_fraction = 0.5; - - invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; - invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; - - invalid_auto_size_ctl.epoch_length = 5000; - - - invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - - invalid_auto_size_ctl.lower_hr_threshold = 0.7; - - invalid_auto_size_ctl.increment = 2.0; - - invalid_auto_size_ctl.apply_max_increment = TRUE; - invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - invalid_auto_size_ctl.upper_hr_threshold = 0.999; + if ( ( rpt_fcn_called ) || + ( cache_ptr->resize_enabled ) || + ( cache_ptr->size_increase_possible ) || + ( cache_ptr->size_decrease_possible ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { - invalid_auto_size_ctl.decrement = 0.5; + pass = FALSE; + failure_mssg = "Unexpected cache size change results 36.\n"; + } + } - invalid_auto_size_ctl.apply_max_decrement = TRUE; - invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - invalid_auto_size_ctl.epochs_before_eviction = 3; + /* force high hit rate -- should be no response as the auto-resize + * code should be disabled. + */ + if ( pass ) { - invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05; + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - if ( result != FAIL ) { + if ( ( rpt_fcn_called ) || + ( cache_ptr->resize_enabled ) || + ( cache_ptr->size_increase_possible ) || + ( cache_ptr->size_decrease_possible ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad version.\n"; + failure_mssg = "Unexpected cache size change results 37.\n"; } } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( pass ) { - result = H5C_get_cache_auto_resize_config(cache_ptr, - &test_auto_size_ctl); + auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; - if ( result != SUCCEED ) { + auto_size_ctl.set_initial_size = FALSE; + auto_size_ctl.initial_size = 2 * 1024 * 1024; - pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 3."; + auto_size_ctl.min_clean_fraction = 0.5; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + auto_size_ctl.max_size = 6 * 1024 * 1024; /* no resize */ + auto_size_ctl.min_size = 6 * 1024 * 1024; /* no resize */ - pass = FALSE; - failure_mssg = "Unexpected auto resize config 3."; - } - } + auto_size_ctl.epoch_length = 1000; - /* check bad initial size rejection */ + auto_size_ctl.incr_mode = H5C_incr__threshold; - if ( pass ) { + auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - invalid_auto_size_ctl.rpt_fcn = NULL; + auto_size_ctl.increment = 2.0; - invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 16 * 1024 * 1024 + 1; - /* INVALID */ + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.min_clean_fraction = 0.5; - invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; - invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.epoch_length = 5000; + auto_size_ctl.upper_hr_threshold = 0.995; + auto_size_ctl.decrement = 0.5; - invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; + auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.max_decrement = (1 * 1024 * 1024); - invalid_auto_size_ctl.lower_hr_threshold = 0.75; + auto_size_ctl.epochs_before_eviction = 3; - invalid_auto_size_ctl.increment = 2.0; + auto_size_ctl.apply_empty_reserve = TRUE; + auto_size_ctl.empty_reserve = 0.05; - invalid_auto_size_ctl.apply_max_increment = TRUE; - invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + if ( result != SUCCEED ) { - invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 13.\n"; + } + } - invalid_auto_size_ctl.upper_hr_threshold = 0.999; + if ( pass ) { - invalid_auto_size_ctl.decrement = 0.5; + if ( ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { - invalid_auto_size_ctl.apply_max_decrement = TRUE; - invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + pass = FALSE; + failure_mssg = "bad cache size after set resize re-config 12.\n"; + } + } - invalid_auto_size_ctl.epochs_before_eviction = 3; + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05; + /* force low hit rate -- should be no response as the auto-resize + * code should be disabled. + */ + if ( pass ) { - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - if ( result != FAIL ) { + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( rpt_fcn_called ) || + ( cache_ptr->resize_enabled ) || + ( cache_ptr->size_increase_possible ) || + ( cache_ptr->size_decrease_possible ) || + ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad init size 1.\n"; + failure_mssg = "Unexpected cache size change results 38.\n"; } } - if ( pass ) { + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - result = H5C_get_cache_auto_resize_config(cache_ptr, - &test_auto_size_ctl); + /* force high hit rate -- should be no response as the auto-resize + * code should be disabled. + */ + if ( pass ) { - if ( result != SUCCEED ) { + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 4."; + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + if ( ( rpt_fcn_called ) || + ( cache_ptr->resize_enabled ) || + ( cache_ptr->size_increase_possible ) || + ( cache_ptr->size_decrease_possible ) || + ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 4."; + failure_mssg = "Unexpected cache size change results 39.\n"; } } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( pass ) { - invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - invalid_auto_size_ctl.rpt_fcn = NULL; + auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; - invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 1 * 1024 * 1024 - 1; - /* INVALID */ + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.5; + auto_size_ctl.min_clean_fraction = 0.25; - invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; - invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + auto_size_ctl.max_size = 16 * 1024 * 1024; + auto_size_ctl.min_size = 1 * 1024 * 1024; - invalid_auto_size_ctl.epoch_length = 5000; + auto_size_ctl.epoch_length = 1000; - invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; + auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75; + auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0; + auto_size_ctl.increment = 1.0; /* disable size increment */ - invalid_auto_size_ctl.apply_max_increment = TRUE; - invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999; + auto_size_ctl.upper_hr_threshold = 1.0; /* disable size decrement */ - invalid_auto_size_ctl.decrement = 0.5; + auto_size_ctl.decrement = 0.5; - invalid_auto_size_ctl.apply_max_decrement = TRUE; - invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.max_decrement = (1 * 1024 * 1024); - invalid_auto_size_ctl.epochs_before_eviction = 3; + auto_size_ctl.epochs_before_eviction = 3; - invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05; + auto_size_ctl.apply_empty_reserve = TRUE; + auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - if ( result != FAIL ) { + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad init size 2.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 14.\n"; } } if ( pass ) { - result = H5C_get_cache_auto_resize_config(cache_ptr, - &test_auto_size_ctl); + if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { - if ( result != SUCCEED ) { + pass = FALSE; + failure_mssg = "bad cache size after set resize re-config 13.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* force low hit rate -- should be no response as the auto-resize + * code should be disabled. + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( rpt_fcn_called ) || + ( cache_ptr->resize_enabled ) || + ( cache_ptr->size_increase_possible ) || + ( cache_ptr->size_decrease_possible ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 5."; + failure_mssg = "Unexpected cache size change results 40.\n"; + } + } - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* force high hit rate -- should be no response as the auto-resize + * code should be disabled. + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( rpt_fcn_called ) || + ( cache_ptr->resize_enabled ) || + ( cache_ptr->size_increase_possible ) || + ( cache_ptr->size_decrease_possible ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 5."; + failure_mssg = "Unexpected cache size change results 41.\n"; } } - - /* test for invalid min clean fraction rejection. */ + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); if ( pass ) { - invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - invalid_auto_size_ctl.rpt_fcn = NULL; + auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; - invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 1.00001; /* INVALID */ + auto_size_ctl.min_clean_fraction = 0.5; - invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; - invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + auto_size_ctl.max_size = 16 * 1024 * 1024; + auto_size_ctl.min_size = 1 * 1024 * 1024; - invalid_auto_size_ctl.epoch_length = 5000; + auto_size_ctl.epoch_length = 1000; - invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; + auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75; + auto_size_ctl.lower_hr_threshold = 0.0; /* disable size increment */ - invalid_auto_size_ctl.increment = 2.0; + auto_size_ctl.increment = 2.0; - invalid_auto_size_ctl.apply_max_increment = TRUE; - invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999; + auto_size_ctl.upper_hr_threshold = 0.995; - invalid_auto_size_ctl.decrement = 0.5; + auto_size_ctl.decrement = 1.0; /* disable size decrement */ - invalid_auto_size_ctl.apply_max_decrement = TRUE; - invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.max_decrement = (1 * 1024 * 1024); - invalid_auto_size_ctl.epochs_before_eviction = 3; + auto_size_ctl.epochs_before_eviction = 3; - invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05; + auto_size_ctl.apply_empty_reserve = TRUE; + auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); - if ( result != FAIL ) { + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad min clean frac 1.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 15.\n"; } } if ( pass ) { - result = H5C_get_cache_auto_resize_config(cache_ptr, - &test_auto_size_ctl); - - if ( result != SUCCEED ) { - - pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 6."; - - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 6."; + failure_mssg = "bad cache size after set resize re-config 14.\n"; } } - if ( pass ) { - - invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - invalid_auto_size_ctl.rpt_fcn = NULL; - - invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - - invalid_auto_size_ctl.min_clean_fraction = -0.00001; /* INVALID */ - - invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; - invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; - - invalid_auto_size_ctl.epoch_length = 5000; - - - invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - - invalid_auto_size_ctl.lower_hr_threshold = 0.75; - - invalid_auto_size_ctl.increment = 2.0; - - invalid_auto_size_ctl.apply_max_increment = TRUE; - invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - - - invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - - invalid_auto_size_ctl.upper_hr_threshold = 0.999; - - invalid_auto_size_ctl.decrement = 0.5; - - invalid_auto_size_ctl.apply_max_decrement = TRUE; - invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - invalid_auto_size_ctl.epochs_before_eviction = 3; + /* force low hit rate -- should be no response as the auto-resize + * code should be disabled. + */ + if ( pass ) { - invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05; + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - if ( result != FAIL ) { + if ( ( rpt_fcn_called ) || + ( cache_ptr->resize_enabled ) || + ( cache_ptr->size_increase_possible ) || + ( cache_ptr->size_decrease_possible ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad min clean frac 2.\n"; + failure_mssg = "Unexpected cache size change results 42.\n"; } } - if ( pass ) { + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - result = H5C_get_cache_auto_resize_config(cache_ptr, - &test_auto_size_ctl); + /* force high hit rate -- should be no response as the auto-resize + * code should be disabled. + */ + if ( pass ) { - if ( result != SUCCEED ) { + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 7."; + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + if ( ( rpt_fcn_called ) || + ( cache_ptr->resize_enabled ) || + ( cache_ptr->size_increase_possible ) || + ( cache_ptr->size_decrease_possible ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 7."; + failure_mssg = "Unexpected cache size change results 43.\n"; } } - - /* test for invalid max_size and/or min_size rejection */ + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); if ( pass ) { - invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - invalid_auto_size_ctl.rpt_fcn = NULL; - - invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - - invalid_auto_size_ctl.min_clean_fraction = 0.5; - - invalid_auto_size_ctl.max_size = H5C__MAX_MAX_CACHE_SIZE + 1; - /* INVALID */ - invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; - invalid_auto_size_ctl.epoch_length = 5000; + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 4 * 1024 * 1024; + auto_size_ctl.min_clean_fraction = 0.5; - invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; + auto_size_ctl.max_size = 16 * 1024 * 1024; + auto_size_ctl.min_size = 1 * 1024 * 1024; - invalid_auto_size_ctl.lower_hr_threshold = 0.75; + auto_size_ctl.epoch_length = 1000; - invalid_auto_size_ctl.increment = 2.0; - invalid_auto_size_ctl.apply_max_increment = TRUE; - invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.incr_mode = H5C_incr__off; + auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + auto_size_ctl.increment = 2.0; - invalid_auto_size_ctl.upper_hr_threshold = 0.999; + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.decrement = 0.5; - invalid_auto_size_ctl.apply_max_decrement = TRUE; - invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + auto_size_ctl.decr_mode = H5C_decr__off; - invalid_auto_size_ctl.epochs_before_eviction = 3; + auto_size_ctl.upper_hr_threshold = 0.995; - invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05; + auto_size_ctl.decrement = 0.5; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.max_decrement = (1 * 1024 * 1024); - if ( result != FAIL ) { + auto_size_ctl.epochs_before_eviction = 3; - pass = FALSE; - failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad max_size.\n"; - } - } + auto_size_ctl.apply_empty_reserve = TRUE; + auto_size_ctl.empty_reserve = 0.05; - if ( pass ) { - result = H5C_get_cache_auto_resize_config(cache_ptr, - &test_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 8."; - - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { - - pass = FALSE; - failure_mssg = "Unexpected auto resize config 8."; + failure_mssg = "H5C_set_cache_auto_resize_config failed 16.\n"; } } if ( pass ) { - invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - invalid_auto_size_ctl.rpt_fcn = NULL; - - invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - - invalid_auto_size_ctl.min_clean_fraction = 0.5; - - invalid_auto_size_ctl.max_size = 1 * 1024 * 1024;/* INVALID */ - invalid_auto_size_ctl.min_size = 1 * 1024 * 1024 + 1;/*PAIR */ - - invalid_auto_size_ctl.epoch_length = 5000; - - - invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; + if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { - invalid_auto_size_ctl.lower_hr_threshold = 0.75; + pass = FALSE; + failure_mssg = "bad cache size after set resize re-config 15.\n"; + } + } - invalid_auto_size_ctl.increment = 2.0; + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - invalid_auto_size_ctl.apply_max_increment = TRUE; - invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + /* force low hit rate -- should be no response as the auto-resize + * code should be disabled. + */ + if ( pass ) { + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - invalid_auto_size_ctl.upper_hr_threshold = 0.999; + if ( ( rpt_fcn_called ) || + ( cache_ptr->resize_enabled ) || + ( cache_ptr->size_increase_possible ) || + ( cache_ptr->size_decrease_possible ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { - invalid_auto_size_ctl.decrement = 0.5; + pass = FALSE; + failure_mssg = "Unexpected cache size change results 44.\n"; + } + } - invalid_auto_size_ctl.apply_max_decrement = TRUE; - invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - invalid_auto_size_ctl.epochs_before_eviction = 3; + /* force high hit rate -- should be no response as the auto-resize + * code should be disabled. + */ + if ( pass ) { - invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05; + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - if ( result != FAIL ) { + if ( ( rpt_fcn_called ) || + ( cache_ptr->resize_enabled ) || + ( cache_ptr->size_increase_possible ) || + ( cache_ptr->size_decrease_possible ) || + ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad size pair.\n"; + failure_mssg = "Unexpected cache size change results 45.\n"; } } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( pass ) { - result = H5C_get_cache_auto_resize_config(cache_ptr, - &test_auto_size_ctl); + takedown_cache(cache_ptr, FALSE, FALSE); + } - if ( result != SUCCEED ) { + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 9."; + if ( pass ) { PASSED(); } else { H5_FAILED(); } - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); - pass = FALSE; - failure_mssg = "Unexpected auto resize config 9."; - } - } +} /* check_auto_cache_resize_disable() */ - if ( pass ) { + +/*------------------------------------------------------------------------- + * Function: check_auto_cache_resize_epoch_markers() + * + * Purpose: Verify that the auto-resize code manages epoch markers + * correctly. + * + * Return: void + * + * Programmer: John Mainzer + * 12/16/04 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ - invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - invalid_auto_size_ctl.rpt_fcn = NULL; +static void +check_auto_cache_resize_epoch_markers(void) +{ + const char * fcn_name = "check_auto_cache_resize_epoch_markers()"; + hbool_t show_progress = FALSE; + herr_t result; + int32_t i; + int32_t j; + int32_t checkpoint = 0; + H5C_t * cache_ptr = NULL; + H5C_auto_size_ctl_t auto_size_ctl = + { + /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* H5C_auto_resize_report_fcn rpt_fcn = */ test_rpt_fcn, - invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (512 * 1024), - invalid_auto_size_ctl.min_clean_fraction = 0.5; + /* double min_clean_fraction = */ 0.5, - invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; - invalid_auto_size_ctl.min_size = H5C__MIN_MAX_CACHE_SIZE - 1; - /* INVALID */ - invalid_auto_size_ctl.epoch_length = 5000; + /* size_t max_size = */ (14 * 1024 * 1024), + /* size_t min_size = */ (512 * 1024), + /* int64_t epoch_length = */ 1000, - invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75; + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - invalid_auto_size_ctl.increment = 2.0; + /* double lower_hr_threshold = */ 0.75, - invalid_auto_size_ctl.apply_max_increment = TRUE; - invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), - invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999; + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, - invalid_auto_size_ctl.decrement = 0.5; + /* double upper_hr_threshold = */ 0.995, - invalid_auto_size_ctl.apply_max_decrement = TRUE; - invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + /* double decrement = */ 0.1, - invalid_auto_size_ctl.epochs_before_eviction = 3; + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), - invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05; + /* int32_t epochs_before_eviction = */ 3, - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.05 + }; - if ( result != FAIL ) { + TESTING("automatic cache resize epoch marker management"); - pass = FALSE; - failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad min_size.\n"; - } + pass = TRUE; + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass ) { + + reset_entries(); + + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); } if ( pass ) { - result = H5C_get_cache_auto_resize_config(cache_ptr, - &test_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 10."; + failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n"; + } + } - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + if ( pass ) { + + if ( ( cache_ptr->max_cache_size != (512 * 1024) ) || + ( cache_ptr->min_clean_size != (256 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 10."; + failure_mssg = "bad cache size after initialization.\n"; } } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + - /* test for invalid epoch_length rejection */ + /* Now make sure that we are managing the epoch markers correctly. + */ if ( pass ) { - invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - invalid_auto_size_ctl.rpt_fcn = NULL; + auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; - invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 8 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1; + auto_size_ctl.min_clean_fraction = 0.5; - invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; - invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + auto_size_ctl.max_size = 8 * 1024 * 1024; + auto_size_ctl.min_size = 512 * 1024; - invalid_auto_size_ctl.epoch_length = H5C__MAX_AR_EPOCH_LENGTH + 1; - /* INVALID */ + auto_size_ctl.epoch_length = 1000; - invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75; + auto_size_ctl.incr_mode = H5C_incr__off; - invalid_auto_size_ctl.increment = 2.0; + auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.apply_max_increment = TRUE; - invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.increment = 2.0; + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (4 * 1024 * 1024); - invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999; + auto_size_ctl.decr_mode = H5C_decr__age_out; - invalid_auto_size_ctl.decrement = 0.9; + auto_size_ctl.upper_hr_threshold = 0.995; - invalid_auto_size_ctl.apply_max_decrement = TRUE; - invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + auto_size_ctl.decrement = 0.5; - invalid_auto_size_ctl.epochs_before_eviction = 3; + auto_size_ctl.apply_max_decrement = FALSE; + auto_size_ctl.max_decrement = (1 * 1024 * 1024); - invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05; + auto_size_ctl.epochs_before_eviction = 10; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + auto_size_ctl.apply_empty_reserve = FALSE; + auto_size_ctl.empty_reserve = 0.05; + + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 2.\n"; + } + } - if ( result != FAIL ) { + if ( pass ) { + + if ( ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad epoch len 1.\n"; + failure_mssg = "bad cache size after set resize re-config 1.\n"; } } - if ( pass ) { - - result = H5C_get_cache_auto_resize_config(cache_ptr, - &test_auto_size_ctl); + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - if ( result != SUCCEED ) { + /* Since we just created the cache, there should be no epoch markers + * active. Verify that this is true. + */ - pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 11."; + if ( pass ) { - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + if ( cache_ptr->epoch_markers_active != 0 ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 11."; + failure_mssg = "Unexpected # of epoch markers 1.\n"; } } if ( pass ) { - invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - invalid_auto_size_ctl.rpt_fcn = NULL; + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i); - invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + if ( pass ) { + unprotect_entry(cache_ptr, MEDIUM_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - invalid_auto_size_ctl.min_clean_fraction = 0.1; + if ( ( ! rpt_fcn_called ) || + ( rpt_status != in_spec ) || + ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) || + ( cache_ptr->index_size != (1 * 1000 * MEDIUM_ENTRY_SIZE) ) ) { - invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; - invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + pass = FALSE; + failure_mssg = "Unexpected cache size change results 0.\n"; + } + } - invalid_auto_size_ctl.epoch_length = H5C__MIN_AR_EPOCH_LENGTH - 1; - /* INVALID */ + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75; + if ( pass ) { - invalid_auto_size_ctl.increment = 2.0; + j = 2; + while ( ( pass ) && ( j <= 10 ) ) + { - invalid_auto_size_ctl.apply_max_increment = TRUE; - invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + rpt_fcn_called = FALSE; + i = (j - 2) * 1000; + while ( ( pass ) && ( i < (j - 1) * 1000 ) ) + { + protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + if ( pass ) { + unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + if ( ( ! rpt_fcn_called ) || + ( rpt_status != in_spec ) || + ( cache_ptr->epoch_markers_active != j ) ) { - invalid_auto_size_ctl.upper_hr_threshold = 0.999; + pass = FALSE; + failure_mssg = "Unexpected # of epoch markers 2.\n"; + } - invalid_auto_size_ctl.decrement = 0.9; + j++; + } + } - invalid_auto_size_ctl.apply_max_decrement = TRUE; - invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - invalid_auto_size_ctl.epochs_before_eviction = 3; + /* we now have a full complement of epoch markers -- see if + * we get the expected reduction. + */ + if ( pass ) { - invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05; + rpt_fcn_called = FALSE; + i = 9000; + while ( ( pass ) && ( i < 10000 ) ) + { + protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + if ( pass ) { + unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - if ( result != FAIL ) { + if ( ( ! rpt_fcn_called ) || + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != + (10 * 1000 * SMALL_ENTRY_SIZE + MEDIUM_ENTRY_SIZE) ) || + ( cache_ptr->min_clean_size != + ((10 * 1000 * SMALL_ENTRY_SIZE + MEDIUM_ENTRY_SIZE) / 2) ) || + ( cache_ptr->index_size != + (10 * 1000 * SMALL_ENTRY_SIZE + MEDIUM_ENTRY_SIZE) ) ) { pass = FALSE; - failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad epoch len 2.\n"; + failure_mssg = "Unexpected cache size change results 1.\n"; } } - if ( pass ) { + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - result = H5C_get_cache_auto_resize_config(cache_ptr, - &test_auto_size_ctl); + /* now reduce the epochs before eviction, and see if the cache + * deletes the extra markers + */ + if ( pass ) { - if ( result != SUCCEED ) { + auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; - pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 12."; + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 8 * 1024 * 1024; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + auto_size_ctl.min_clean_fraction = 0.5; - pass = FALSE; - failure_mssg = "Unexpected auto resize config 12."; - } - } + auto_size_ctl.max_size = 8 * 1024 * 1024; + auto_size_ctl.min_size = 512 * 1024; + auto_size_ctl.epoch_length = 1000; - /* test for bad incr_mode rejection */ - if ( pass ) { + auto_size_ctl.incr_mode = H5C_incr__off; - invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - invalid_auto_size_ctl.rpt_fcn = NULL; + auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + auto_size_ctl.increment = 2.0; - invalid_auto_size_ctl.min_clean_fraction = 0.1; + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (4 * 1024 * 1024); - invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; - invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; - invalid_auto_size_ctl.epoch_length = 5000; + auto_size_ctl.decr_mode = H5C_decr__age_out; + auto_size_ctl.upper_hr_threshold = 0.995; - invalid_auto_size_ctl.incr_mode = - (enum H5C_cache_incr_mode) -1; /* INVALID */ + auto_size_ctl.decrement = 0.5; - invalid_auto_size_ctl.lower_hr_threshold = 0.75; + auto_size_ctl.apply_max_decrement = FALSE; + auto_size_ctl.max_decrement = (1 * 1024 * 1024); - invalid_auto_size_ctl.increment = 2.0; + auto_size_ctl.epochs_before_eviction = 1; - invalid_auto_size_ctl.apply_max_increment = TRUE; - invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.apply_empty_reserve = FALSE; + auto_size_ctl.empty_reserve = 0.05; + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + if ( result != SUCCEED ) { - invalid_auto_size_ctl.upper_hr_threshold = 0.999; + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 3.\n"; + } + } - invalid_auto_size_ctl.decrement = 0.9; + if ( pass ) { - invalid_auto_size_ctl.apply_max_decrement = TRUE; - invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + if ( ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { - invalid_auto_size_ctl.epochs_before_eviction = 3; + pass = FALSE; + failure_mssg = "bad cache size after set resize re-config 2.\n"; + } + } - invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05; + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + /* There should be exactly one active epoch marker at present. + */ + if ( pass ) { - if ( result != FAIL ) { + if ( cache_ptr->epoch_markers_active != 1 ) { pass = FALSE; - failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad incr_mode 1.\n"; + failure_mssg = "Unexpected # of epoch markers 3.\n"; } } + /* Now do an epochs worth of accesses, and verify that everything + * not accessed in this epoch gets evicted, and the cache size + * is reduced. + */ if ( pass ) { - result = H5C_get_cache_auto_resize_config(cache_ptr, - &test_auto_size_ctl); + rpt_fcn_called = FALSE; + i = 9000; + while ( ( pass ) && ( i < 10000 ) ) + { + protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); - if ( result != SUCCEED ) { + if ( pass ) { + unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( rpt_status != decrease ) || + ( cache_ptr->max_cache_size != (512 * 1024) ) || + ( cache_ptr->min_clean_size != (256 * 1024) ) || + ( cache_ptr->index_size != (1 * 1000 * SMALL_ENTRY_SIZE) ) ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 13."; + failure_mssg = "Unexpected cache size change results 2.\n"; + } + } - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* There should be exactly one active epoch marker at present... + */ + if ( pass ) { + + if ( cache_ptr->epoch_markers_active != 1 ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 13."; + failure_mssg = "Unexpected # of epoch markers 4.\n"; } } + /* shift the decrement mode to threshold, and verify that we remove + * all epoch markers. + */ if ( pass ) { - invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - invalid_auto_size_ctl.rpt_fcn = NULL; + auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; - invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 8 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1; + auto_size_ctl.min_clean_fraction = 0.5; - invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; - invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + auto_size_ctl.max_size = 8 * 1024 * 1024; + auto_size_ctl.min_size = 512 * 1024; - invalid_auto_size_ctl.epoch_length = 5000; + auto_size_ctl.epoch_length = 1000; - invalid_auto_size_ctl.incr_mode = - (enum H5C_cache_incr_mode) 2; /* INVALID */ + auto_size_ctl.incr_mode = H5C_incr__off; - invalid_auto_size_ctl.lower_hr_threshold = 0.75; + auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0; + auto_size_ctl.increment = 2.0; - invalid_auto_size_ctl.apply_max_increment = TRUE; - invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (4 * 1024 * 1024); - invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999; + auto_size_ctl.upper_hr_threshold = 0.995; - invalid_auto_size_ctl.decrement = 0.9; + auto_size_ctl.decrement = 0.5; - invalid_auto_size_ctl.apply_max_decrement = TRUE; - invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + auto_size_ctl.apply_max_decrement = FALSE; + auto_size_ctl.max_decrement = (1 * 1024 * 1024); - invalid_auto_size_ctl.epochs_before_eviction = 3; + auto_size_ctl.epochs_before_eviction = 1; - invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05; + auto_size_ctl.apply_empty_reserve = FALSE; + auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - if ( result != FAIL ) { + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad incr_mode 2.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 4.\n"; } } if ( pass ) { - result = H5C_get_cache_auto_resize_config(cache_ptr, - &test_auto_size_ctl); - - if ( result != SUCCEED ) { + if ( ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 14."; + failure_mssg = "bad cache size after set resize re-config 3.\n"; + } + } - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + /* ... and now there should be none. + */ + if ( pass ) { + + if ( cache_ptr->epoch_markers_active != 0 ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 14."; + failure_mssg = "Unexpected # of epoch markers 5.\n"; } } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* check for bad upper and/or lower threshold rejection */ - + /* shift the decrement mode to age out with threshold. Set epochs + * before eviction to 10 again. + */ if ( pass ) { - invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - invalid_auto_size_ctl.rpt_fcn = NULL; + auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; - invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 8 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.5; + auto_size_ctl.min_clean_fraction = 0.5; - invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; - invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + auto_size_ctl.max_size = 8 * 1024 * 1024; + auto_size_ctl.min_size = 512 * 1024; - invalid_auto_size_ctl.epoch_length = 5000; + auto_size_ctl.epoch_length = 1000; - invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; + auto_size_ctl.incr_mode = H5C_incr__off; - invalid_auto_size_ctl.lower_hr_threshold = 0.7; + auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 2.0; + auto_size_ctl.increment = 2.0; - invalid_auto_size_ctl.apply_max_increment = TRUE; - invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (4 * 1024 * 1024); - invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; - invalid_auto_size_ctl.upper_hr_threshold = 1.01; /* INVALID */ + auto_size_ctl.upper_hr_threshold = 0.995; - invalid_auto_size_ctl.decrement = 0.5; + auto_size_ctl.decrement = 0.5; - invalid_auto_size_ctl.apply_max_decrement = TRUE; - invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + auto_size_ctl.apply_max_decrement = FALSE; + auto_size_ctl.max_decrement = (1 * 1024 * 1024); - invalid_auto_size_ctl.epochs_before_eviction = 3; + auto_size_ctl.epochs_before_eviction = 10; - invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05; + auto_size_ctl.apply_empty_reserve = FALSE; + auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - if ( result != FAIL ) { + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad upper threshold.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 5.\n"; } } + /* Verify that there are no active epoch markers. + */ if ( pass ) { - result = H5C_get_cache_auto_resize_config(cache_ptr, - &test_auto_size_ctl); - - if ( result != SUCCEED ) { - - pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 15."; - - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + if ( cache_ptr->epoch_markers_active != 0 ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 15."; + failure_mssg = "Unexpected # of epoch markers 6.\n"; } } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* build up a full set of epoch markers. */ if ( pass ) { - invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - invalid_auto_size_ctl.rpt_fcn = NULL; + j = 1; + while ( ( pass ) && ( j <= 10 ) ) + { - invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + rpt_fcn_called = FALSE; + i = (j - 1) * 1000; + while ( ( pass ) && ( i < j * 1000 ) ) + { + protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); - invalid_auto_size_ctl.min_clean_fraction = 0.5; + if ( pass ) { + unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; - invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + if ( ( ! rpt_fcn_called ) || + ( rpt_status != in_spec ) || + ( cache_ptr->epoch_markers_active != j ) ) { - invalid_auto_size_ctl.epoch_length = 5000; + pass = FALSE; + failure_mssg = "Unexpected # of epoch markers 7.\n"; + } + j++; + } + } - invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - invalid_auto_size_ctl.lower_hr_threshold = 0.8; /* INVALID */ + /* Verify that there are now 10 active epoch markers. + */ + if ( pass ) { - invalid_auto_size_ctl.increment = 2.0; + if ( cache_ptr->epoch_markers_active != 10 ) { - invalid_auto_size_ctl.apply_max_increment = TRUE; - invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + pass = FALSE; + failure_mssg = "Unexpected # of epoch markers 8.\n"; + } + } + /* shift the decrement mode to off. This should cause all epoch + * markers to be removed. + */ + if ( pass ) { - invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; - invalid_auto_size_ctl.upper_hr_threshold = 0.7; /* INVALID */ + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 8 * 1024 * 1024; - invalid_auto_size_ctl.decrement = 0.5; + auto_size_ctl.min_clean_fraction = 0.5; - invalid_auto_size_ctl.apply_max_decrement = TRUE; - invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + auto_size_ctl.max_size = 8 * 1024 * 1024; + auto_size_ctl.min_size = 512 * 1024; - invalid_auto_size_ctl.epochs_before_eviction = 3; + auto_size_ctl.epoch_length = 1000; - invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + auto_size_ctl.incr_mode = H5C_incr__off; - if ( result != FAIL ) { + auto_size_ctl.lower_hr_threshold = 0.75; - pass = FALSE; - failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad threshold pair.\n"; - } - } + auto_size_ctl.increment = 2.0; - if ( pass ) { + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (4 * 1024 * 1024); - result = H5C_get_cache_auto_resize_config(cache_ptr, - &test_auto_size_ctl); - if ( result != SUCCEED ) { + auto_size_ctl.decr_mode = H5C_decr__off; - pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 16."; + auto_size_ctl.upper_hr_threshold = 0.995; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + auto_size_ctl.decrement = 0.5; - pass = FALSE; - failure_mssg = "Unexpected auto resize config 16."; - } - } + auto_size_ctl.apply_max_decrement = FALSE; + auto_size_ctl.max_decrement = (1 * 1024 * 1024); - if ( pass ) { + auto_size_ctl.epochs_before_eviction = 10; - invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - invalid_auto_size_ctl.rpt_fcn = NULL; + auto_size_ctl.apply_empty_reserve = FALSE; + auto_size_ctl.empty_reserve = 0.05; - invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); - invalid_auto_size_ctl.min_clean_fraction = 0.5; + if ( result != SUCCEED ) { - invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; - invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 6.\n"; + } + } - invalid_auto_size_ctl.epoch_length = 5000; + /* Verify that there are now no active epoch markers. + */ + if ( pass ) { + + if ( cache_ptr->epoch_markers_active != 0 ) { + pass = FALSE; + failure_mssg = "Unexpected # of epoch markers 9.\n"; + } + } - invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - invalid_auto_size_ctl.lower_hr_threshold = -0.0001; /* INVALID */ + /* verify that we still have the expected number of entries in the cache, + * and that the cache is of the expected size. + */ + if ( pass ) { - invalid_auto_size_ctl.increment = 2.0; + if ( ( cache_ptr->max_cache_size != (8 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 1024 * 1024) )|| + ( cache_ptr->index_size != (10 * 1000 * SMALL_ENTRY_SIZE) ) || + ( cache_ptr->index_len != 10000 ) ) { - invalid_auto_size_ctl.apply_max_increment = TRUE; - invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + pass = FALSE; + failure_mssg = "Unexpected cache size change results 3.\n"; + } + } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + if ( pass ) { - invalid_auto_size_ctl.upper_hr_threshold = 0.999; + takedown_cache(cache_ptr, FALSE, FALSE); + } - invalid_auto_size_ctl.decrement = 0.5; + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - invalid_auto_size_ctl.apply_max_decrement = TRUE; - invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + if ( pass ) { PASSED(); } else { H5_FAILED(); } - invalid_auto_size_ctl.epochs_before_eviction = 3; + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); - invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05; +} /* check_auto_cache_resize_epoch_markers() */ - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + +/*------------------------------------------------------------------------- + * Function: check_auto_cache_resize_input_errs() + * + * Purpose: Verify that H5C_set_cache_auto_resize_config() detects + * and rejects invalid input. + * + * Return: void + * + * Programmer: John Mainzer + * 10/29/04 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ - if ( result != FAIL ) { +#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).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 ) ) - pass = FALSE; - failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad lower threshold.\n"; - } - } +static void +check_auto_cache_resize_input_errs(void) +{ + const char * fcn_name = "check_auto_cache_resize_input_errs()"; + herr_t result; + H5C_t * cache_ptr = NULL; + H5C_auto_size_ctl_t ref_auto_size_ctl = + { + /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* H5C_auto_resize_report_fcn rpt_fcn = */ test_rpt_fcn, - if ( pass ) { + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (512 * 1024), - result = H5C_get_cache_auto_resize_config(cache_ptr, - &test_auto_size_ctl); + /* double min_clean_fraction = */ 0.5, - if ( result != SUCCEED ) { + /* size_t max_size = */ (16 * 1024 * 1024), + /* size_t min_size = */ (512 * 1024), - pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 17."; + /* int64_t epoch_length = */ 1000, - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { - pass = FALSE; - failure_mssg = "Unexpected auto resize config 17."; - } - } + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, + /* double lower_hr_threshold = */ 0.75, - /* test for bad increment rejection */ + /* double increment = */ 2.0, - if ( pass ) { + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), - invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - invalid_auto_size_ctl.rpt_fcn = NULL; - invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, - invalid_auto_size_ctl.min_clean_fraction = 0.1; + /* double upper_hr_threshold = */ 0.995, - invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; - invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + /* double decrement = */ 0.1, - invalid_auto_size_ctl.epoch_length = 5000; + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), + /* int32_t epochs_before_eviction = */ 3, - invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.05 + }; - invalid_auto_size_ctl.lower_hr_threshold = 0.75; + H5C_auto_size_ctl_t invalid_auto_size_ctl; + H5C_auto_size_ctl_t test_auto_size_ctl; - invalid_auto_size_ctl.increment = 0.99999; /* INVALID */ + TESTING("automatic cache resize input errors"); - invalid_auto_size_ctl.apply_max_increment = TRUE; - invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + pass = TRUE; + /* allocate a cache, and set a reference automatic cache control + * configuration. Then feed H5C_set_cache_auto_resize_config() + * invalid input, and verify that the correct error is returned, + * and that the configuration is not modified. + */ - invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + if ( pass ) { - invalid_auto_size_ctl.upper_hr_threshold = 0.999; + reset_entries(); - invalid_auto_size_ctl.decrement = 0.5; + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); + } - invalid_auto_size_ctl.apply_max_decrement = TRUE; - invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + if ( pass ) { - invalid_auto_size_ctl.epochs_before_eviction = 3; + result = H5C_set_cache_auto_resize_config(cache_ptr, + &ref_auto_size_ctl); - invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = 0.05; + if ( result != SUCCEED ) { + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n"; + } + } - result = H5C_set_cache_auto_resize_config(cache_ptr, - &invalid_auto_size_ctl); + if ( pass ) { - if ( result != FAIL ) { + if ( ( cache_ptr->max_cache_size != (512 * 1024) ) || + ( cache_ptr->min_clean_size != (256 * 1024) ) ) { pass = FALSE; - failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad increment.\n"; + failure_mssg = "bad cache size after initialization.\n"; } } @@ -16341,19 +11808,16 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 18."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 1."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 18."; + failure_mssg = "Unexpected auto resize config 1."; } } - - /* test for bad decr_mode rejection */ - if ( pass ) { invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; @@ -16362,7 +11826,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1; + invalid_auto_size_ctl.min_clean_fraction = 0.5; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -16372,7 +11836,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75; + invalid_auto_size_ctl.lower_hr_threshold = 0.7; invalid_auto_size_ctl.increment = 2.0; @@ -16380,12 +11844,11 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.decr_mode = - (enum H5C_cache_decr_mode) -1; /* INVALID */ + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -16395,14 +11858,14 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; - result = H5C_set_cache_auto_resize_config(cache_ptr, + result = H5C_set_cache_auto_resize_config(NULL, &invalid_auto_size_ctl); if ( result != FAIL ) { pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad decr_mode 1.\n"; + "H5C_set_cache_auto_resize_config accepted NULL cache_ptr.\n"; } } @@ -16414,25 +11877,28 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 19."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 2."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 19."; + failure_mssg = "Unexpected auto resize config 2."; } } + + /* check bad version rejection. */ + if ( pass ) { - invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.version = -1; /* INVALID */ invalid_auto_size_ctl.rpt_fcn = NULL; invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1; + invalid_auto_size_ctl.min_clean_fraction = 0.5; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -16442,7 +11908,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.75; + invalid_auto_size_ctl.lower_hr_threshold = 0.7; invalid_auto_size_ctl.increment = 2.0; @@ -16450,12 +11916,11 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.decr_mode = - (enum H5C_cache_decr_mode) 4; /* INVALID */ + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -16472,7 +11937,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad decr_mode 2.\n"; + "H5C_set_cache_auto_resize_config accepted bad version.\n"; } } @@ -16484,18 +11949,18 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 20."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 3."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 20."; + failure_mssg = "Unexpected auto resize config 3."; } } - /* check for bad decrement rejection */ + /* check bad initial size rejection */ if ( pass ) { @@ -16503,9 +11968,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.rpt_fcn = NULL; invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + invalid_auto_size_ctl.initial_size = 16 * 1024 * 1024 + 1; + /* INVALID */ - invalid_auto_size_ctl.min_clean_fraction = 0.1; + invalid_auto_size_ctl.min_clean_fraction = 0.5; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -16527,7 +11993,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 1.000001; /* INVALID */ + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -16544,7 +12010,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad decrement 1.\n"; + "H5C_set_cache_auto_resize_config accepted bad init size 1.\n"; } } @@ -16556,13 +12022,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 21."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 4."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 21."; + failure_mssg = "Unexpected auto resize config 4."; } } @@ -16572,9 +12038,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.rpt_fcn = NULL; invalid_auto_size_ctl.set_initial_size = TRUE; - invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + invalid_auto_size_ctl.initial_size = 1 * 1024 * 1024 - 1; + /* INVALID */ - invalid_auto_size_ctl.min_clean_fraction = 0.1; + invalid_auto_size_ctl.min_clean_fraction = 0.5; invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -16596,7 +12063,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = -0.000001; /* INVALID */ + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -16613,7 +12080,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad decrement 2.\n"; + "H5C_set_cache_auto_resize_config accepted bad init size 2.\n"; } } @@ -16625,18 +12092,18 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 22."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 5."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 22."; + failure_mssg = "Unexpected auto resize config 5."; } } - /* check for rejection of bad epochs_before_eviction */ + /* test for invalid min clean fraction rejection. */ if ( pass ) { @@ -16646,7 +12113,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1; + invalid_auto_size_ctl.min_clean_fraction = 1.00001; /* INVALID */ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -16664,16 +12131,16 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.decr_mode = H5C_decr__age_out; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); - invalid_auto_size_ctl.epochs_before_eviction = 0; /* INVALID */ + invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; @@ -16684,7 +12151,8 @@ check_auto_cache_resize_input_errs(void) if ( result != FAIL ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config accepted bad epochs_before_eviction 1.\n"; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad min clean frac 1.\n"; } } @@ -16696,13 +12164,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 23."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 6."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 23."; + failure_mssg = "Unexpected auto resize config 6."; } } @@ -16714,7 +12182,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1; + invalid_auto_size_ctl.min_clean_fraction = -0.00001; /* INVALID */ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; @@ -16732,17 +12200,16 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); - invalid_auto_size_ctl.epochs_before_eviction = - H5C__MAX_EPOCH_MARKERS + 1; /* INVALID */ + invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; @@ -16753,7 +12220,8 @@ check_auto_cache_resize_input_errs(void) if ( result != FAIL ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config accepted bad epochs_before_eviction 2.\n"; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad min clean frac 2.\n"; } } @@ -16765,18 +12233,18 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 24."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 7."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 24."; + failure_mssg = "Unexpected auto resize config 7."; } } - /* Check for bad apply_empty_reserve rejection */ + /* test for invalid max_size and/or min_size rejection */ if ( pass ) { @@ -16786,9 +12254,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1; + invalid_auto_size_ctl.min_clean_fraction = 0.5; - invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.max_size = H5C__MAX_MAX_CACHE_SIZE + 1; + /* INVALID */ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; invalid_auto_size_ctl.epoch_length = 5000; @@ -16804,11 +12273,11 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.decr_mode = H5C_decr__age_out; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -16816,7 +12285,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; - invalid_auto_size_ctl.empty_reserve = -0.0000001; /* INVALID */ + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl); @@ -16824,7 +12293,8 @@ check_auto_cache_resize_input_errs(void) if ( result != FAIL ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config accepted bad empty_reserve 1.\n"; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad max_size.\n"; } } @@ -16836,13 +12306,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 25."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 8."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 25."; + failure_mssg = "Unexpected auto resize config 8."; } } @@ -16854,10 +12324,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.set_initial_size = TRUE; invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - invalid_auto_size_ctl.min_clean_fraction = 0.1; + invalid_auto_size_ctl.min_clean_fraction = 0.5; - invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; - invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + invalid_auto_size_ctl.max_size = 1 * 1024 * 1024;/* INVALID */ + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024 + 1;/*PAIR */ invalid_auto_size_ctl.epoch_length = 5000; @@ -16872,17 +12342,16 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.9; + invalid_auto_size_ctl.decrement = 0.5; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); - invalid_auto_size_ctl.epochs_before_eviction = - H5C__MAX_EPOCH_MARKERS + 1; /* INVALID */ + invalid_auto_size_ctl.epochs_before_eviction = 3; invalid_auto_size_ctl.apply_empty_reserve = TRUE; invalid_auto_size_ctl.empty_reserve = 0.05; @@ -16893,7 +12362,8 @@ check_auto_cache_resize_input_errs(void) if ( result != FAIL ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config accepted bad empty_reserve 2.\n"; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad size pair.\n"; } } @@ -16905,3601 +12375,1843 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 26."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 9."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 26."; - } - } - - - /* finally, before we finish, try feeding - * H5C_get_cache_auto_resize_config invalid data. - */ - - if ( pass ) { - - result = H5C_get_cache_auto_resize_config(NULL, &test_auto_size_ctl); - - if ( result != FAIL ) { - - pass = FALSE; - failure_mssg = - "H5C_get_cache_auto_resize_config accepted NULL cache_ptr.\n"; - } - } - - if ( pass ) { - - result = H5C_get_cache_auto_resize_config((H5C_t *)&test_auto_size_ctl, - &test_auto_size_ctl); - - if ( result != FAIL ) { - - pass = FALSE; - failure_mssg = - "H5C_get_cache_auto_resize_config accepted bad cache_ptr.\n"; - } - } - - if ( pass ) { - - result = H5C_get_cache_auto_resize_config(cache_ptr, NULL); - - if ( result != FAIL ) { - - pass = FALSE; - failure_mssg = - "H5C_get_cache_auto_resize_config accepted NULL config ptr.\n"; + failure_mssg = "Unexpected auto resize config 9."; } } if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); - } - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - -} /* check_auto_cache_resize_input_errs() */ - - -/*------------------------------------------------------------------------- - * Function: check_auto_cache_resize_aux_fcns() - * - * Purpose: Verify that the auxilary functions associated with - * the automatic cache resize capability are operating - * correctly. These functions are: - * - * H5C_get_cache_size() - * H5C_get_cache_hit_rate() - * H5C_reset_cache_hit_rate_stats() - * - * Return: void - * - * Programmer: John Mainzer - * 11/4/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static void -check_auto_cache_resize_aux_fcns(void) -{ - const char * fcn_name = "check_auto_cache_resize_aux_fcns()"; - herr_t result; - int32_t i; - H5C_t * cache_ptr = NULL; - double hit_rate; - size_t max_size; - size_t min_clean_size; - size_t cur_size; - int32_t cur_num_entries; - H5C_auto_size_ctl_t auto_size_ctl = - { - /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, -#if 0 - /* H5C_auto_resize_report_fcn rpt_fcn = */ NULL, -#else - /* H5C_auto_resize_report_fcn rpt_fcn = */ H5C_def_auto_resize_rpt_fcn, -#endif - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - - /* double min_clean_fraction = */ 0.5, - - /* size_t max_size = */ (16 * 1024 * 1025), - /* size_t min_size = */ (512 * 1024), - - /* int64_t epoch_length = */ 50000, - - - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off, - - /* double lower_hr_threshold = */ 0.75, - - /* double increment = */ 2.0, - - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, + invalid_auto_size_ctl.min_clean_fraction = 0.5; - /* double upper_hr_threshold = */ 0.995, + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = H5C__MIN_MAX_CACHE_SIZE - 1; + /* INVALID */ + invalid_auto_size_ctl.epoch_length = 5000; - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - /* int32_t epochs_before_eviction = */ 3, + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.5 - }; + invalid_auto_size_ctl.increment = 2.0; + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - TESTING("automatic cache resize auxilary functions"); - pass = TRUE; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - /* allocate a cache, and then test the various auxilary functions. - */ + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - if ( pass ) { + invalid_auto_size_ctl.decrement = 0.5; - reset_entries(); + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); - } + invalid_auto_size_ctl.epochs_before_eviction = 3; - if ( pass ) { + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; result = H5C_set_cache_auto_resize_config(cache_ptr, - &auto_size_ctl); - - if ( result != SUCCEED ) { - - pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n"; - } - } - - if ( pass ) { - - if ( ( cache_ptr->max_cache_size != (1 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (512 * 1024) ) ) { - - pass = FALSE; - failure_mssg = "bad cache size after initialization.\n"; - } - } - - /* lets start with the H5C_get_cache_hit_rate(), - * H5C_reset_cache_hit_rate_stats() pair. - */ - - if ( pass ) { + &invalid_auto_size_ctl); - if ( ( H5C_get_cache_hit_rate(NULL, &hit_rate) != FAIL ) || - ( H5C_get_cache_hit_rate(cache_ptr, NULL) != FAIL ) ) { + if ( result != FAIL ) { pass = FALSE; - failure_mssg = "H5C_get_cache_hit_rate accepts bad params.\n"; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad min_size.\n"; } } if ( pass ) { - result = H5C_get_cache_hit_rate(cache_ptr, &hit_rate); + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_hit_rate failed.\n"; + failure_mssg = "H5C_get_cache_auto_resize_config failed 10."; - } else if ( hit_rate != 0.0 ) { + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = - "H5C_get_cache_hit_rate returned unexpected hit rate 1.\n"; + failure_mssg = "Unexpected auto resize config 10."; } } + + /* test for invalid epoch_length rejection */ + if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, PICO_ENTRY_TYPE, i); + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; - if ( pass ) { + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - unprotect_entry(cache_ptr, PICO_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } - } + invalid_auto_size_ctl.min_clean_fraction = 0.1; - if ( pass ) { + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; - result = H5C_get_cache_hit_rate(cache_ptr, &hit_rate); + invalid_auto_size_ctl.epoch_length = H5C__MAX_AR_EPOCH_LENGTH + 1; + /* INVALID */ - if ( result != SUCCEED ) { + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - pass = FALSE; - failure_mssg = "H5C_get_cache_hit_rate failed.\n"; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - } else if ( hit_rate != 0.0 ) { + invalid_auto_size_ctl.increment = 2.0; - pass = FALSE; - failure_mssg = - "H5C_get_cache_hit_rate returned unexpected hit rate 2.\n"; + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - } else if ( ( cache_ptr->cache_accesses != 1000 ) || - ( cache_ptr->cache_hits != 0 ) ) { - pass = FALSE; - failure_mssg = "Unexpected cache hit rate stats.\n"; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - } else if ( rpt_fcn_called ) { + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - pass = FALSE; - failure_mssg = "Report function called?.\n"; + invalid_auto_size_ctl.decrement = 0.9; - } - } + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); - if ( pass ) { + invalid_auto_size_ctl.epochs_before_eviction = 3; - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, PICO_ENTRY_TYPE, 0); + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; - if ( pass ) { + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); - unprotect_entry(cache_ptr, PICO_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; + if ( result != FAIL ) { + + pass = FALSE; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad epoch len 1.\n"; } } if ( pass ) { - result = H5C_get_cache_hit_rate(cache_ptr, &hit_rate); + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_hit_rate failed.\n"; - - } else if ( hit_rate != 0.5 ) { - - pass = FALSE; - failure_mssg = - "H5C_get_cache_hit_rate returned unexpected hit rate 3.\n"; - - } else if ( ( cache_ptr->cache_accesses != 2000 ) || - ( cache_ptr->cache_hits != 1000 ) ) { - - pass = FALSE; - failure_mssg = "Unexpected cache hit rate stats.\n"; + failure_mssg = "H5C_get_cache_auto_resize_config failed 11."; - } else if ( rpt_fcn_called ) { + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Report function called?.\n"; - + failure_mssg = "Unexpected auto resize config 11."; } } if ( pass ) { - result = H5C_reset_cache_hit_rate_stats(NULL); + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; - if ( result != FAIL ) { + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - pass = FALSE; - failure_mssg = - "H5C_reset_cache_hit_rate_stats accepted NULL cache_ptr.\n"; + invalid_auto_size_ctl.min_clean_fraction = 0.1; - } else if ( ( cache_ptr->cache_accesses != 2000 ) || - ( cache_ptr->cache_hits != 1000 ) ) { + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; - pass = FALSE; - failure_mssg = - "Failed call to H5C_reset_cache_hit_rate_stats altered stats?\n"; - } - } + invalid_auto_size_ctl.epoch_length = H5C__MIN_AR_EPOCH_LENGTH - 1; + /* INVALID */ - if ( pass ) { + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - result = H5C_reset_cache_hit_rate_stats(cache_ptr); + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - if ( result != SUCCEED ) { + invalid_auto_size_ctl.increment = 2.0; - pass = FALSE; - failure_mssg = "H5C_reset_cache_hit_rate_stats failed.\n"; + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - } else if ( ( cache_ptr->cache_accesses != 0 ) || - ( cache_ptr->cache_hits != 0 ) ) { - pass = FALSE; - failure_mssg = "Unexpected cache hit rate stats.\n"; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - } - } + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - if ( pass ) { + invalid_auto_size_ctl.decrement = 0.9; - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, PICO_ENTRY_TYPE, i + 500); + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); - if ( pass ) { + invalid_auto_size_ctl.epochs_before_eviction = 3; - unprotect_entry(cache_ptr, PICO_ENTRY_TYPE, i + 500, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; + + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); + + if ( result != FAIL ) { + + pass = FALSE; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad epoch len 2.\n"; } } - if ( pass ) { - result = H5C_get_cache_hit_rate(cache_ptr, &hit_rate); + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_hit_rate failed.\n"; + failure_mssg = "H5C_get_cache_auto_resize_config failed 12."; - } else if ( hit_rate != 0.5 ) { + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = - "H5C_get_cache_hit_rate returned unexpected hit rate 4.\n"; + failure_mssg = "Unexpected auto resize config 12."; + } + } - } else if ( ( cache_ptr->cache_accesses != 1000 ) || - ( cache_ptr->cache_hits != 500 ) ) { - pass = FALSE; - failure_mssg = "Unexpected cache hit rate stats.\n"; + /* test for bad incr_mode rejection */ - } else if ( rpt_fcn_called ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "Report function called?.\n"; + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; - } - } + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - /*************************************************** - * So much for testing H5C_get_cache_hit_rate() and - * H5C_reset_cache_hit_rate_stats(). Now on to - * H5C_get_cache_size(). - ***************************************************/ + invalid_auto_size_ctl.min_clean_fraction = 0.1; - if ( pass ) { + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; - result = H5C_get_cache_size(NULL, &max_size, &min_clean_size, - &cur_size, &cur_num_entries); + invalid_auto_size_ctl.epoch_length = 5000; - if ( result != FAIL ) { - pass = FALSE; - failure_mssg = "H5C_get_cache_size accepted NULL cache_ptr.\n"; - } - } + invalid_auto_size_ctl.incr_mode = + (enum H5C_cache_incr_mode) -1; /* INVALID */ - if ( pass ) { + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - max_size = 0; - min_clean_size = 0; - cur_size = 0; - cur_num_entries = 0; + invalid_auto_size_ctl.increment = 2.0; - result = H5C_get_cache_size(cache_ptr, &max_size, &min_clean_size, - &cur_size, &cur_num_entries); + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - if ( result != SUCCEED ) { - pass = FALSE; - failure_mssg = "H5C_get_cache_size failed 1.\n"; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - } else if ( max_size != (1 * 1024 * 1024) ) { + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - pass = FALSE; - failure_mssg = - "H5C_get_cache_size reports unexpected max_size 1.\n"; + invalid_auto_size_ctl.decrement = 0.9; - } else if ( min_clean_size != (512 * 1024) ) { + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + + invalid_auto_size_ctl.epochs_before_eviction = 3; + + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; + + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); + + if ( result != FAIL ) { pass = FALSE; failure_mssg = - "H5C_get_cache_size reports unexpected min_clean_size 1.\n"; + "H5C_set_cache_auto_resize_config accepted bad incr_mode 1.\n"; + } + } - } else if ( cur_size != (1500 * PICO_ENTRY_SIZE) ) { + if ( pass ) { + + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); + + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = - "H5C_get_cache_size reports unexpected cur_size 1.\n"; + failure_mssg = "H5C_get_cache_auto_resize_config failed 13."; - } else if ( cur_num_entries != 1500 ) { + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = - "H5C_get_cache_size reports unexpected cur_num_entries 1.\n"; + failure_mssg = "Unexpected auto resize config 13."; } } - /* read a larger entry so that cur_size and cur_num_entries will be - * different. - */ if ( pass ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); - } + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, - H5C__NO_FLAGS_SET); - } + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - if ( pass ) { + invalid_auto_size_ctl.min_clean_fraction = 0.1; - max_size = 0; - min_clean_size = 0; - cur_size = 0; - cur_num_entries = 0; + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; - result = H5C_get_cache_size(cache_ptr, &max_size, &min_clean_size, - &cur_size, &cur_num_entries); + invalid_auto_size_ctl.epoch_length = 5000; - if ( result != SUCCEED ) { - pass = FALSE; - failure_mssg = "H5C_get_cache_size failed 2.\n"; + invalid_auto_size_ctl.incr_mode = + (enum H5C_cache_incr_mode) 2; /* INVALID */ - } else if ( max_size != (1 * 1024 * 1024) ) { + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - pass = FALSE; - failure_mssg = - "H5C_get_cache_size reports unexpected max_size 2.\n"; + invalid_auto_size_ctl.increment = 2.0; - } else if ( min_clean_size != (512 * 1024) ) { + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - pass = FALSE; - failure_mssg = - "H5C_get_cache_size reports unexpected min_clean_size 2.\n"; - } else if ( cur_size != - ((1500 * PICO_ENTRY_SIZE) + MONSTER_ENTRY_SIZE) ) { + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - pass = FALSE; - failure_mssg = - "H5C_get_cache_size reports unexpected cur_size 2.\n"; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - } else if ( cur_num_entries != 1501 ) { + invalid_auto_size_ctl.decrement = 0.9; + + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + + invalid_auto_size_ctl.epochs_before_eviction = 3; + + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; + + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); + + if ( result != FAIL ) { pass = FALSE; failure_mssg = - "H5C_get_cache_size reports unexpected cur_num_entries 2.\n"; + "H5C_set_cache_auto_resize_config accepted bad incr_mode 2.\n"; } } if ( pass ) { - max_size = 0; - min_clean_size = 0; - cur_size = 0; - cur_num_entries = 0; - - result = H5C_get_cache_size(cache_ptr, &max_size, NULL, NULL, NULL); + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_size failed 3.\n"; - - } else if ( max_size != (1 * 1024 * 1024) ) { - - pass = FALSE; - failure_mssg = - "H5C_get_cache_size reports unexpected max_size 3.\n"; + failure_mssg = "H5C_get_cache_auto_resize_config failed 14."; - } else if ( ( min_clean_size != 0 ) || - ( cur_size != 0 ) || - ( cur_num_entries != 0 ) ) { + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Phantom returns from H5C_get_cache_size?\n"; - + failure_mssg = "Unexpected auto resize config 14."; } } + + /* check for bad upper and/or lower threshold rejection */ + if ( pass ) { - max_size = 0; - min_clean_size = 0; - cur_size = 0; - cur_num_entries = 0; + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; - result = H5C_get_cache_size(cache_ptr, NULL, &min_clean_size, - NULL, NULL); + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - if ( result != SUCCEED ) { + invalid_auto_size_ctl.min_clean_fraction = 0.5; - pass = FALSE; - failure_mssg = "H5C_get_cache_size failed 4.\n"; + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; - } else if ( min_clean_size != (512 * 1024) ) { + invalid_auto_size_ctl.epoch_length = 5000; - pass = FALSE; - failure_mssg = - "H5C_get_cache_size reports unexpected min_clean_size 4.\n"; - } else if ( ( max_size != 0 ) || - ( cur_size != 0 ) || - ( cur_num_entries != 0 ) ) { + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - pass = FALSE; - failure_mssg = "Phantom returns from H5C_get_cache_size?\n"; + invalid_auto_size_ctl.lower_hr_threshold = 0.7; - } - } + invalid_auto_size_ctl.increment = 2.0; - if ( pass ) { + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - max_size = 0; - min_clean_size = 0; - cur_size = 0; - cur_num_entries = 0; - result = H5C_get_cache_size(cache_ptr, NULL, NULL, &cur_size, NULL); + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - if ( result != SUCCEED ) { + invalid_auto_size_ctl.upper_hr_threshold = 1.01; /* INVALID */ - pass = FALSE; - failure_mssg = "H5C_get_cache_size failed 5.\n"; + invalid_auto_size_ctl.decrement = 0.5; - } else if ( cur_size != - ((1500 * PICO_ENTRY_SIZE) + MONSTER_ENTRY_SIZE) ) { + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); - pass = FALSE; - failure_mssg = - "H5C_get_cache_size reports unexpected cur_size 5.\n"; + invalid_auto_size_ctl.epochs_before_eviction = 3; - } else if ( ( max_size != 0 ) || - ( min_clean_size != 0 ) || - ( cur_num_entries != 0 ) ) { + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; - pass = FALSE; - failure_mssg = "Phantom returns from H5C_get_cache_size?\n"; + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); + + if ( result != FAIL ) { + pass = FALSE; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad upper threshold.\n"; } } if ( pass ) { - max_size = 0; - min_clean_size = 0; - cur_size = 0; - cur_num_entries = 0; - - result = H5C_get_cache_size(cache_ptr, NULL, NULL, NULL, - &cur_num_entries); + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_size failed 6.\n"; - - } else if ( cur_num_entries != 1501 ) { - - pass = FALSE; - failure_mssg = - "H5C_get_cache_size reports unexpected cur_num_entries 2.\n"; + failure_mssg = "H5C_get_cache_auto_resize_config failed 15."; - } else if ( ( max_size != 0 ) || - ( min_clean_size != 0 ) || - ( cur_size != 0 ) ) { + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Phantom returns from H5C_get_cache_size?\n"; - + failure_mssg = "Unexpected auto resize config 15."; } } if ( pass ) { - takedown_cache(cache_ptr, FALSE, FALSE); - } - - if ( pass ) { PASSED(); } else { H5_FAILED(); } - - if ( ! pass ) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; -} /* check_auto_cache_resize_aux_fcns() */ + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - -/*------------------------------------------------------------------------- - * Function: check_fapl_mdc_api_calls() - * - * Purpose: Verify that the file access property list related - * metadata cache related API calls are functioning - * correctly. - * - * Since we have tested the H5C code elsewhere, it should - * be sufficient to verify that the desired configuration - * data is getting to the cache. - * - * Return: void - * - * Programmer: John Mainzer - * 4/12/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ + invalid_auto_size_ctl.min_clean_fraction = 0.5; -#define CACHE_CONFIGS_EQUAL(a, b, cmp_set_init, cmp_init_size) \ - ( ( (a).version == (b).version ) && \ - ( (a).rpt_fcn_enabled == (b).rpt_fcn_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).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).decr_mode = (e).decr_mode; \ - (i).upper_hr_threshold = (e).upper_hr_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; \ -} + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; -static void -check_fapl_mdc_api_calls(void) -{ - const char * fcn_name = "check_fapl_mdc_api_calls()"; - char filename[512]; - herr_t result; - hid_t fapl_id = -1; - hid_t test_fapl_id = -1; - hid_t file_id = -1; - H5F_t * file_ptr = NULL; - H5C_t * cache_ptr = NULL; - H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG; - H5AC_cache_config_t mod_config = - { - /* int version = */ - H5AC__CURR_CACHE_CONFIG_VERSION, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024 + 1), - /* double min_clean_fraction = */ 0.2, - /* size_t max_size = */ (16 * 1024 * 1024 + 1), - /* size_t min_size = */ ( 1 * 1024 * 1024 + 1), - /* long int epoch_length = */ 50001, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.91, - /* double increment = */ 2.1, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024 + 1), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out, - /* double upper_hr_threshold = */ 0.998, - /* double decrement = */ 0.91, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024 - 1), - /* int epochs_before_eviction = */ 4, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05 - }; - H5AC_cache_config_t scratch; - H5C_auto_size_ctl_t default_auto_size_ctl; - H5C_auto_size_ctl_t mod_auto_size_ctl; + invalid_auto_size_ctl.epoch_length = 5000; - TESTING("MDC/FAPL related API calls"); - pass = TRUE; + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - XLATE_EXT_TO_INT_MDC_CONFIG(default_auto_size_ctl, default_config) - XLATE_EXT_TO_INT_MDC_CONFIG(mod_auto_size_ctl, mod_config) + invalid_auto_size_ctl.lower_hr_threshold = 0.8; /* INVALID */ - /* Create a FAPL and verify that it contains the default - * initial mdc configuration - */ + invalid_auto_size_ctl.increment = 2.0; - if ( pass ) { + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - fapl_id = H5Pcreate(H5P_FILE_ACCESS); - if ( fapl_id < 0 ) { + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - pass = FALSE; - failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n"; - } - } + invalid_auto_size_ctl.upper_hr_threshold = 0.7; /* INVALID */ - if ( pass ) { + invalid_auto_size_ctl.decrement = 0.5; - scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); - result = H5Pget_mdc_config(fapl_id, &scratch); + invalid_auto_size_ctl.epochs_before_eviction = 3; - if ( result < 0 ) { + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; - pass = FALSE; - failure_mssg = "H5Pget_mdc_config() failed.\n"; + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); - } else if (!CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE)) { + if ( result != FAIL ) { pass = FALSE; - failure_mssg = "retrieved config doesn't match default."; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad threshold pair.\n"; } } + if ( pass ) { - /* Modify the initial mdc configuration in a FAPL, and verify that - * the changes can be read back - */ + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); - if ( pass ) { + if ( result != SUCCEED ) { - result = H5Pset_mdc_config(fapl_id, &mod_config); + pass = FALSE; + failure_mssg = "H5C_get_cache_auto_resize_config failed 16."; - if ( result < 0 ) { + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "H5Pset_mdc_config() failed.\n"; + failure_mssg = "Unexpected auto resize config 16."; } } if ( pass ) { - scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; - result = H5Pget_mdc_config(fapl_id, &scratch); + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - if ( result < 0 ) { + invalid_auto_size_ctl.min_clean_fraction = 0.5; - pass = FALSE; - failure_mssg = "H5Pget_mdc_config() failed.\n"; + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; - } else if ( ! CACHE_CONFIGS_EQUAL(mod_config, scratch, TRUE, TRUE) ) { + invalid_auto_size_ctl.epoch_length = 5000; - pass = FALSE; - failure_mssg = "retrieved config doesn't match mod config."; - } - } - if ( pass ) { + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - if ( H5Pclose(fapl_id) < 0 ) { + invalid_auto_size_ctl.lower_hr_threshold = -0.0001; /* INVALID */ - pass = FALSE; - failure_mssg = "H5Pclose() failed.\n"; - } - } + invalid_auto_size_ctl.increment = 2.0; - /* Open a file using the default FAPL. Verify that the resulting - * metadata cache uses the default configuration as well. Get a - * copy of the FAPL from the file, and verify that it contains the - * default initial meta data cache configuration. Close and delete - * the file. - */ + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - /* setup the file name */ - if ( pass ) { - if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) - == NULL ) { + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - pass = FALSE; - failure_mssg = "h5_fixname() failed.\n"; - } - } + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - /* create the file using the default FAPL */ - if ( pass ) { + invalid_auto_size_ctl.decrement = 0.5; + + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + + invalid_auto_size_ctl.epochs_before_eviction = 3; - file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; + + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); - if ( file_id < 0 ) { + if ( result != FAIL ) { pass = FALSE; - failure_mssg = "H5Fcreate() failed.\n"; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad lower threshold.\n"; } } - /* get a pointer to the files internal data structure */ if ( pass ) { - file_ptr = H5I_object_verify(file_id, H5I_FILE); + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); - if ( file_ptr == NULL ) { + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "Can't get file_ptr.\n"; + failure_mssg = "H5C_get_cache_auto_resize_config failed 17."; - } else { + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { - cache_ptr = file_ptr->shared->cache; + pass = FALSE; + failure_mssg = "Unexpected auto resize config 17."; } } - /* verify that we can access the internal version of the cache config */ + + /* test for bad increment rejection */ + if ( pass ) { - if ( ( cache_ptr == NULL ) || - ( cache_ptr->magic != H5C__H5C_T_MAGIC ) || - ( cache_ptr->resize_ctl.version != H5C__CURR_AUTO_SIZE_CTL_VER ) ){ + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; - pass = FALSE; - failure_mssg = "Can't access cache resize_ctl.\n"; - } - } + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - /* conpare the cache's internal configuration with the expected value */ - if ( pass ) { + invalid_auto_size_ctl.min_clean_fraction = 0.1; - if ( ! RESIZE_CONFIGS_ARE_EQUAL(default_auto_size_ctl, \ - cache_ptr->resize_ctl, TRUE) ) { + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + invalid_auto_size_ctl.epoch_length = 5000; - pass = FALSE; - failure_mssg = "Unexpected value(s) in cache resize_ctl.\n"; - } - } - /* get a copy of the files FAPL */ - if ( pass ) { + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - fapl_id = H5Fget_access_plist(file_id); + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - if ( fapl_id < 0 ) { + invalid_auto_size_ctl.increment = 0.99999; /* INVALID */ - pass = FALSE; - failure_mssg = "H5Fget_access_plist() failed.\n"; - } - } + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - /* compare the initial cache config from the copy of the file's FAPL - * to the expected value. If all goes well, close the copy of the FAPL. - */ - if ( pass ) { - scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - result = H5Pget_mdc_config(fapl_id, &scratch); + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - if ( result < 0 ) { + invalid_auto_size_ctl.decrement = 0.5; - pass = FALSE; - failure_mssg = "H5Pget_mdc_config() failed.\n"; + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); - } else if (!CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE)) { + invalid_auto_size_ctl.epochs_before_eviction = 3; - pass = FALSE; - failure_mssg = "config retrieved from file doesn't match default."; + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; + + + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); - } else if ( H5Pclose(fapl_id) < 0 ) { + if ( result != FAIL ) { pass = FALSE; - failure_mssg = "H5Pclose() failed.\n"; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad increment.\n"; } } - /* close the file and delete it */ if ( pass ) { - if ( H5Fclose(file_id) < 0 ) { + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); + + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5Fclose() failed.\n"; + failure_mssg = "H5C_get_cache_auto_resize_config failed 18."; - } else if ( HDremove(filename) < 0 ) { + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "HDremove() failed.\n"; + failure_mssg = "Unexpected auto resize config 18."; } } - /* Open a file using a FAPL with a modified initial metadata cache - * configuration. Verify that the resulting metadata cache uses the - * modified configuration as well. Get a copy of the FAPL from the - * file, and verify that it contains the modified initial meta data - * cache configuration. Close and delete the file. - */ + /* test for bad decr_mode rejection */ - /* Create a FAPL */ if ( pass ) { - fapl_id = H5Pcreate(H5P_FILE_ACCESS); + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; - if ( fapl_id < 0 ) { + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - pass = FALSE; - failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n"; - } - } + invalid_auto_size_ctl.min_clean_fraction = 0.1; - /* Modify the initial mdc configuration in the FAPL. */ + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; - if ( pass ) { + invalid_auto_size_ctl.epoch_length = 5000; - result = H5Pset_mdc_config(fapl_id, &mod_config); - if ( result < 0 ) { + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - pass = FALSE; - failure_mssg = "H5Pset_mdc_config() failed.\n"; - } - } + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - /* setup the file name */ - if ( pass ) { + invalid_auto_size_ctl.increment = 2.0; - if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) - == NULL ) { + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - pass = FALSE; - failure_mssg = "h5_fixname() failed.\n"; - } - } - /* create the file using the modified FAPL */ - if ( pass ) { + invalid_auto_size_ctl.decr_mode = + (enum H5C_cache_decr_mode) -1; /* INVALID */ - file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + invalid_auto_size_ctl.upper_hr_threshold = 0.999; + + invalid_auto_size_ctl.decrement = 0.9; + + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + + invalid_auto_size_ctl.epochs_before_eviction = 3; - if ( file_id < 0 ) { + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; + + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); + + if ( result != FAIL ) { pass = FALSE; - failure_mssg = "H5Fcreate() failed.\n"; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad decr_mode 1.\n"; } } - /* get a pointer to the files internal data structure */ if ( pass ) { - file_ptr = H5I_object_verify(file_id, H5I_FILE); + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); - if ( file_ptr == NULL ) { + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "Can't get file_ptr.\n"; + failure_mssg = "H5C_get_cache_auto_resize_config failed 19."; - } else { + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { - cache_ptr = file_ptr->shared->cache; + pass = FALSE; + failure_mssg = "Unexpected auto resize config 19."; } } - /* 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 ) ){ + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; - pass = FALSE; - failure_mssg = "Can't access cache resize_ctl.\n"; - } - } + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - /* conpare the cache's internal configuration with the expected value */ - if ( pass ) { + invalid_auto_size_ctl.min_clean_fraction = 0.1; - if ( ! RESIZE_CONFIGS_ARE_EQUAL(mod_auto_size_ctl, \ - cache_ptr->resize_ctl, TRUE) ) { + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + invalid_auto_size_ctl.epoch_length = 5000; - pass = FALSE; - failure_mssg = "Unexpected value(s) in cache resize_ctl.\n"; - } - } - /* get a copy of the files FAPL */ - if ( pass ) { + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - test_fapl_id = H5Fget_access_plist(file_id); + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - if ( test_fapl_id < 0 ) { + invalid_auto_size_ctl.increment = 2.0; - pass = FALSE; - failure_mssg = "H5Fget_access_plist() failed.\n"; - } - } + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - /* compare the initial cache config from the copy of the file's FAPL - * to the expected value. If all goes well, close the copy of the FAPL. - */ - if ( pass ) { - scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.decr_mode = + (enum H5C_cache_decr_mode) 4; /* INVALID */ - result = H5Pget_mdc_config(test_fapl_id, &scratch); + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - if ( result < 0 ) { + invalid_auto_size_ctl.decrement = 0.9; - pass = FALSE; - failure_mssg = "H5Pget_mdc_config() failed.\n"; + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); - } else if ( ! CACHE_CONFIGS_EQUAL(mod_config, scratch, TRUE, TRUE) ) { + invalid_auto_size_ctl.epochs_before_eviction = 3; - pass = FALSE; - failure_mssg = "config retrieved from file doesn't match."; + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; - } else if ( H5Pclose(test_fapl_id) < 0 ) { + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); + + if ( result != FAIL ) { pass = FALSE; - failure_mssg = "H5Pclose() failed.\n"; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad decr_mode 2.\n"; } } - /* close the fapl used to create the file */ if ( pass ) { - if ( H5Pclose(fapl_id) < 0 ) { + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_get_cache_auto_resize_config failed 20."; + + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "H5Pclose() failed.\n"; + failure_mssg = "Unexpected auto resize config 20."; } } - /* close the file and delete it */ + + /* check for bad decrement rejection */ + if ( pass ) { - if ( H5Fclose(file_id) < 0 ) { + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; + + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + + invalid_auto_size_ctl.min_clean_fraction = 0.1; + + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + + invalid_auto_size_ctl.epoch_length = 5000; - pass = FALSE; - failure_mssg = "H5Fclose() failed.\n"; - } else if ( HDremove(filename) < 0 ) { + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - pass = FALSE; - failure_mssg = "HDremove() failed.\n"; - } - } + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - if ( pass ) { PASSED(); } else { H5_FAILED(); } + invalid_auto_size_ctl.increment = 2.0; - if ( ! pass ) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); -} /* check_fapl_mdc_api_calls() */ - -/*------------------------------------------------------------------------- - * 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: - * - *------------------------------------------------------------------------- - */ + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; -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; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - XLATE_EXT_TO_INT_MDC_CONFIG(int_config, (*ext_config_ptr)) + invalid_auto_size_ctl.decrement = 1.000001; /* INVALID */ - /* get a pointer to the files internal data structure */ - if ( pass ) { + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); - file_ptr = H5I_object_verify(file_id, H5I_FILE); + invalid_auto_size_ctl.epochs_before_eviction = 3; - if ( file_ptr == NULL ) { + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; - pass = FALSE; - HDsnprintf(msg, (size_t)128, "Can't get file_ptr #%d.", test_num); - failure_mssg = msg; + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); - } else { + if ( result != FAIL ) { - cache_ptr = file_ptr->shared->cache; + pass = FALSE; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad decrement 1.\n"; } } - /* 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 ) ){ + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); + + if ( result != SUCCEED ) { 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 ) { + failure_mssg = "H5C_get_cache_auto_resize_config failed 21."; - if ( ! RESIZE_CONFIGS_ARE_EQUAL(int_config, cache_ptr->resize_ctl, - compare_init) ) { + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { pass = FALSE; - HDsnprintf(msg, (size_t)128, - "Unexpected internal config #%d.", test_num); - failure_mssg = msg; + failure_mssg = "Unexpected auto resize config 21."; } } - /* obtain external cache config */ if ( pass ) { - scratch.version = H5AC__CURR_CACHE_CONFIG_VERSION; + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; - if ( H5Fget_mdc_config(file_id, &scratch) < 0 ) { + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "H5Fget_mdc_config() failed #%d.", test_num); - failure_mssg = msg; - } - } + invalid_auto_size_ctl.min_clean_fraction = 0.1; - if ( pass ) { + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; - /* 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 resume 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) ) { + invalid_auto_size_ctl.epoch_length = 5000; - pass = FALSE; - HDsnprintf(msg, (size_t)128, - "Unexpected external config #%d.", test_num); - failure_mssg = msg; - } - } - return; + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; -} /* validate_mdc_config() */ + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - -/*------------------------------------------------------------------------- - * Function: check_file_mdc_api_calls() - * - * Purpose: Verify that the file related metadata cache API calls are - * functioning correctly. - * - * Since we have tested the H5C code elsewhere, it should - * be sufficient to verify that the desired configuration - * data is getting in and out of the cache. Similarly, - * we need only verify that the cache monitoring calls - * return the data that the cache thinks they should return. - * We shouldn't need to verify data correctness beyond that - * point. - * - * Return: void - * - * Programmer: John Mainzer - * 4/14/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ + invalid_auto_size_ctl.increment = 2.0; -static void -check_file_mdc_api_calls(void) -{ - const char * fcn_name = "check_file_mdc_api_calls()"; - char filename[512]; - hid_t file_id = -1; - size_t max_size; - size_t min_clean_size; - size_t cur_size; - int cur_num_entries; - double hit_rate; - H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG; - H5AC_cache_config_t mod_config_1 = - { - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024 + 1), - /* double min_clean_fraction = */ 0.2, - /* size_t max_size = */ (16 * 1024 * 1024 + 1), - /* size_t min_size = */ ( 1 * 1024 * 1024 + 1), - /* long int epoch_length = */ 50001, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.91, - /* double increment = */ 2.1, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024 + 1), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out, - /* double upper_hr_threshold = */ 0.998, - /* double decrement = */ 0.91, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024 - 1), - /* int epochs_before_eviction = */ 4, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05 - }; - H5AC_cache_config_t mod_config_2 = - { - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ TRUE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (512 * 1024), - /* double min_clean_fraction = */ 0.1, - /* size_t max_size = */ ( 8 * 1024 * 1024), - /* size_t min_size = */ ( 512 * 1024), - /* long int epoch_length = */ 25000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (2 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, - /* double upper_hr_threshold = */ 0.9995, - /* double decrement = */ 0.95, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (512 * 1024), - /* int epochs_before_eviction = */ 4, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05 - }; - H5AC_cache_config_t mod_config_3 = - { - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.2, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off, - /* double lower_hr_threshold = */ 0.90, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ FALSE, - /* size_t max_decrement = */ (1 * 1024 * 1024 - 1), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ FALSE, - /* double empty_reserve = */ 0.05 - }; - H5AC_cache_config_t mod_config_4 = - { - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.15, - /* size_t max_size = */ (20 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 75000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (2 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ - H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }; + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - TESTING("MDC/FILE related API calls"); - pass = TRUE; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - /* Open a file with the default FAPL. Verify that the cache is - * configured as per the default both by looking at its internal - * configuration, and via the H5Fget_mdc_config() call. - * - * Then set serveral different configurations, and verify that - * they took as per above. - */ + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - /* setup the file name */ - if ( pass ) { + invalid_auto_size_ctl.decrement = -0.000001; /* INVALID */ - if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) - == NULL ) { + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); - pass = FALSE; - failure_mssg = "h5_fixname() failed.\n"; - } - } + invalid_auto_size_ctl.epochs_before_eviction = 3; - /* create the file using the default FAPL */ - if ( pass ) { + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; - file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); - if ( file_id < 0 ) { + if ( result != FAIL ) { pass = FALSE; - failure_mssg = "H5Fcreate() failed.\n"; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad decrement 2.\n"; } } - /* verify that the cache is set to the default config */ - validate_mdc_config(file_id, &default_config, TRUE, 1); - - /* set alternate config 1 */ if ( pass ) { - if ( H5Fset_mdc_config(file_id, &mod_config_1) < 0 ) { + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_get_cache_auto_resize_config failed 22."; + + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "H5Fset_mdc_config() failed 1.\n"; + failure_mssg = "Unexpected auto resize config 22."; } } - /* verify that the cache is now set to the alternate config */ - validate_mdc_config(file_id, &mod_config_1, TRUE, 2); - /* set alternate config 2 */ + /* check for rejection of bad epochs_before_eviction */ + if ( pass ) { - if ( H5Fset_mdc_config(file_id, &mod_config_2) < 0 ) { + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; - pass = FALSE; - failure_mssg = "H5Fset_mdc_config() failed 2.\n"; - } - } + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - /* verify that the cache is now set to the alternate config */ - validate_mdc_config(file_id, &mod_config_2, TRUE, 3); + invalid_auto_size_ctl.min_clean_fraction = 0.1; - /* set alternate config 3 */ - if ( pass ) { + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; - if ( H5Fset_mdc_config(file_id, &mod_config_3) < 0 ) { + invalid_auto_size_ctl.epoch_length = 5000; - pass = FALSE; - failure_mssg = "H5Fset_mdc_config() failed 3.\n"; - } - } - /* verify that the cache is now set to the alternate config */ - validate_mdc_config(file_id, &mod_config_3, TRUE, 4); + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - /* set alternate config 4 */ - if ( pass ) { + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - if ( H5Fset_mdc_config(file_id, &mod_config_4) < 0 ) { + invalid_auto_size_ctl.increment = 2.0; - pass = FALSE; - failure_mssg = "H5Fset_mdc_config() failed 4.\n"; - } - } + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - /* verify that the cache is now set to the alternate config */ - validate_mdc_config(file_id, &mod_config_4, TRUE, 5); + invalid_auto_size_ctl.decr_mode = H5C_decr__age_out; - /* Run some quick smoke checks on the cache status monitoring - * calls -- no interesting data as the cache hasn't had a - * chance to do much yet. - */ + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - if ( pass ) { + invalid_auto_size_ctl.decrement = 0.9; - if ( H5Fget_mdc_hit_rate(file_id, &hit_rate) < 0 ) { + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); - pass = FALSE; - failure_mssg = "H5Fget_mdc_hit_rate() failed 1.\n"; + invalid_auto_size_ctl.epochs_before_eviction = 0; /* INVALID */ - } else if ( hit_rate != 0.0 ) { + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; - pass = FALSE; - failure_mssg = - "H5Fget_mdc_hit_rate() returned unexpected hit rate.\n"; + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); - } -#if 0 /* this may be useful now and then -- keep it around */ - else { + if ( result != FAIL ) { - HDfprintf(stdout, - "H5Fget_mdc_hit_rate() reports hit_rate = %lf:\n", - hit_rate); + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config accepted bad epochs_before_eviction 1.\n"; } -#endif } if ( pass ) { - if ( H5Fget_mdc_size(file_id, &max_size, &min_clean_size, - &cur_size, &cur_num_entries) < 0 ) { - - pass = FALSE; - failure_mssg = "H5Fget_mdc_size() failed 1.\n"; + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); - } else if ( ( mod_config_4.initial_size != max_size ) || - ( min_clean_size != (size_t) - ((double)max_size * mod_config_4.min_clean_fraction) ) ) { + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5Fget_mdc_size() returned unexpected value(s).\n"; + failure_mssg = "H5C_get_cache_auto_resize_config failed 23."; - } -#if 0 /* this may be useful now and then -- keep it around */ - else { + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { - HDfprintf(stdout, "H5Fget_mdc_size() reports:\n"); - HDfprintf(stdout, " max_size: %ld, min_clean_size: %ld\n", - (long)max_size, (long)min_clean_size); - HDfprintf(stdout, " cur_size: %ld, cur_num_entries: %d\n", - (long)cur_size, cur_num_entries); + pass = FALSE; + failure_mssg = "Unexpected auto resize config 23."; } -#endif } - /* close the file and delete it */ if ( pass ) { - if ( H5Fclose(file_id) < 0 ) { + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; + + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - pass = FALSE; - failure_mssg = "H5Fclose() failed.\n"; + invalid_auto_size_ctl.min_clean_fraction = 0.1; - } else if ( HDremove(filename) < 0 ) { + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; - pass = FALSE; - failure_mssg = "HDremove() failed.\n"; - } - } + invalid_auto_size_ctl.epoch_length = 5000; - if ( pass ) { PASSED(); } else { H5_FAILED(); } - if ( ! pass ) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; -} /* check_file_mdc_api_calls() */ + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - -/*------------------------------------------------------------------------- - * 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: - * - *------------------------------------------------------------------------- - */ + invalid_auto_size_ctl.increment = 2.0; -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; - int64_t cache_accesses; - double expected_hit_rate; - double hit_rate; - H5F_t * file_ptr = NULL; - H5C_t * cache_ptr = NULL; + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - /* get a pointer to the files internal data structure */ - if ( pass ) { - file_ptr = H5I_object_verify(file_id, H5I_FILE); + invalid_auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; + + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - if ( file_ptr == NULL ) { + invalid_auto_size_ctl.decrement = 0.9; - pass = FALSE; - failure_mssg = "Can't get file_ptr."; + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); - } else { + invalid_auto_size_ctl.epochs_before_eviction = + H5C__MAX_EPOCH_MARKERS + 1; /* INVALID */ - cache_ptr = file_ptr->shared->cache; - } - } + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; - /* verify that we can access the cache data structure */ - if ( pass ) { + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); - if ( ( cache_ptr == NULL ) || - ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) { + if ( result != FAIL ) { pass = FALSE; - failure_mssg = "Can't access cache resize_ctl."; + failure_mssg = "H5C_set_cache_auto_resize_config accepted bad epochs_before_eviction 2.\n"; } } - /* 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); + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); - if ( result < 0 ) { + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5Fget_mdc_hit_rate() failed."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 24."; - } else if ( hit_rate != expected_hit_rate ) { + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "unexpected hit rate."; + failure_mssg = "Unexpected auto resize config 24."; } } - if ( pass ) { /* reset the hit rate */ - result = H5Freset_mdc_hit_rate_stats(file_id); + /* Check for bad apply_empty_reserve rejection */ - if ( result < 0 ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "H5Freset_mdc_hit_rate_stats() failed."; - } - } + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; - /* set *hit_rate_ptr if appropriate */ - if ( ( pass ) && ( hit_rate_ptr != NULL ) ) { + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - *hit_rate_ptr = hit_rate; - } + invalid_auto_size_ctl.min_clean_fraction = 0.1; - /* dump data to stdout if requested */ - if ( ( pass ) && ( dump_data ) ) { + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; - HDfprintf(stdout, - "cache_hits: %ld, cache_accesses: %ld, hit_rate: %lf\n", - (long)cache_hits, (long)cache_accesses, hit_rate); - } + invalid_auto_size_ctl.epoch_length = 5000; - if ( ( pass ) && - ( cache_accesses > min_accesses ) && - ( hit_rate < min_hit_rate ) ) { - pass = FALSE; - failure_mssg = "Unexpectedly low hit rate."; - } + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - return; + invalid_auto_size_ctl.lower_hr_threshold = 0.75; -} /* check_and_validate_cache_hit_rate() */ + invalid_auto_size_ctl.increment = 2.0; - -/*------------------------------------------------------------------------- - * 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: - * - *------------------------------------------------------------------------- - */ + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); -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 ) { + invalid_auto_size_ctl.decr_mode = H5C_decr__age_out; - file_ptr = H5I_object_verify(file_id, H5I_FILE); + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - if ( file_ptr == NULL ) { + invalid_auto_size_ctl.decrement = 0.9; - pass = FALSE; - failure_mssg = "Can't get file_ptr."; + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); - } else { + invalid_auto_size_ctl.epochs_before_eviction = 3; - cache_ptr = file_ptr->shared->cache; - } - } + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = -0.0000001; /* INVALID */ - /* verify that we can access the cache data structure */ - if ( pass ) { + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); - if ( ( cache_ptr == NULL ) || - ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) { + if ( result != FAIL ) { pass = FALSE; - failure_mssg = "Can't access cache data structure."; + failure_mssg = "H5C_set_cache_auto_resize_config accepted bad empty_reserve 1.\n"; } } - /* 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); + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); - if ( result < 0 ) { + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5Fget_mdc_size() failed."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 25."; - } 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 ) ) { + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "H5Fget_mdc_size() returned unexpected value(s)."; - + failure_mssg = "Unexpected auto resize config 25."; } } - /* return size values if requested */ - if ( ( pass ) && ( max_size_ptr != NULL ) ) { - - *max_size_ptr = max_size; - } + if ( pass ) { - if ( ( pass ) && ( min_clean_size_ptr != NULL ) ) { + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; - *min_clean_size_ptr = min_clean_size; - } + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - if ( ( pass ) && ( cur_size_ptr != NULL ) ) { + invalid_auto_size_ctl.min_clean_fraction = 0.1; - *cur_size_ptr = cur_size; - } + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; - if ( ( pass ) && ( cur_num_entries_ptr != NULL ) ) { + invalid_auto_size_ctl.epoch_length = 5000; - *cur_num_entries_ptr = cur_num_entries; - } + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - /* dump data to stdout if requested */ - if ( ( pass ) && ( dump_data ) ) { + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - 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); - } + invalid_auto_size_ctl.increment = 2.0; - return; + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); -} /* check_and_validate_cache_size() */ - -/*------------------------------------------------------------------------- - * Function: mdc_api_call_smoke_check() - * - * Purpose: - * - * Return: void - * - * Programmer: John Mainzer - * 4/14/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ + invalid_auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; -#define CHUNK_SIZE 2 -#define DSET_SIZE (200 * CHUNK_SIZE) -#define NUM_DSETS 6 -#define NUM_RANDOM_ACCESSES 200000 + invalid_auto_size_ctl.upper_hr_threshold = 0.999; -static void -mdc_api_call_smoke_check(void) -{ - const char * fcn_name = "mdc_api_call_smoke_check()"; - char filename[512]; - hbool_t valid_chunk; - hbool_t dump_hit_rate = FALSE; - int64_t min_accesses = 1000; - double min_hit_rate = 0.90; - hbool_t dump_cache_size = FALSE; - hid_t file_id = -1; - hid_t dataspace_id; - hid_t filespace_ids[NUM_DSETS]; - hid_t memspace_id; - hid_t dataset_ids[NUM_DSETS]; - hid_t properties; - char dset_name[64]; - int i, j, k, l, m, n; - herr_t status; - hsize_t dims[2]; - hsize_t a_size[2]; - hsize_t offset[2]; - hsize_t chunk_size[2]; - int data_chunk[CHUNK_SIZE][CHUNK_SIZE]; - H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG; - H5AC_cache_config_t mod_config_1 = - { - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ 500000, - /* double min_clean_fraction = */ 0.1, - /* size_t max_size = */ 16000000, - /* size_t min_size = */ 250000, - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off, - /* double lower_hr_threshold = */ 0.95, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ FALSE, - /* size_t max_increment = */ 4000000, - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ FALSE, - /* size_t max_decrement = */ 1000000, - /* int epochs_before_eviction = */ 2, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05 - }; - H5AC_cache_config_t mod_config_2 = - { - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ 12000000, - /* double min_clean_fraction = */ 0.1, - /* size_t max_size = */ 16000000, - /* size_t min_size = */ 250000, - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off, - /* double lower_hr_threshold = */ 0.95, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ FALSE, - /* size_t max_increment = */ 4000000, - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ FALSE, - /* size_t max_decrement = */ 1000000, - /* int epochs_before_eviction = */ 2, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05 - }; - H5AC_cache_config_t mod_config_3 = - { - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ 2000000, - /* double min_clean_fraction = */ 0.1, - /* size_t max_size = */ 16000000, - /* size_t min_size = */ 250000, - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off, - /* double lower_hr_threshold = */ 0.95, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ FALSE, - /* size_t max_increment = */ 4000000, - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ FALSE, - /* size_t max_decrement = */ 1000000, - /* int epochs_before_eviction = */ 2, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05 - }; + invalid_auto_size_ctl.decrement = 0.9; - TESTING("MDC API smoke check"); + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); - pass = TRUE; + invalid_auto_size_ctl.epochs_before_eviction = + H5C__MAX_EPOCH_MARKERS + 1; /* INVALID */ - /* Open a file with the default FAPL. Verify that the cache is - * configured as per the default both by looking at its internal - * configuration, and via the H5Fget_mdc_config() call. - * - * Then set the cache to mod_config_1, which fixes cache size at - * 500000 bytes, and turns off automatic cache resize. - */ + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; - /* setup the file name */ - if ( pass ) { + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); - if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) - == NULL ) { + if ( result != FAIL ) { pass = FALSE; - failure_mssg = "h5_fixname() failed.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config accepted bad empty_reserve 2.\n"; } } - /* create the file using the default FAPL */ if ( pass ) { - file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); - if ( file_id < 0 ) { + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5Fcreate() failed.\n"; - } - } - - /* verify that the cache is set to the default config */ - validate_mdc_config(file_id, &default_config, TRUE, 1); - - /* set alternate config 1 */ - if ( pass ) { + failure_mssg = "H5C_get_cache_auto_resize_config failed 26."; - if ( H5Fset_mdc_config(file_id, &mod_config_1) < 0 ) { + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "H5Fset_mdc_config() failed 1.\n"; + failure_mssg = "Unexpected auto resize config 26."; } } - /* verify that the cache is now set to the alternate config */ - validate_mdc_config(file_id, &mod_config_1, TRUE, 2); + /* finally, before we finish, try feeding + * H5C_get_cache_auto_resize_config invalid data. + */ - /* create the datasets */ if ( pass ) { - i = 0; - - while ( ( pass ) && ( i < NUM_DSETS ) ) - { - /* create a dataspace for the chunked dataset */ - dims[0] = DSET_SIZE; - dims[1] = DSET_SIZE; - dataspace_id = H5Screate_simple(2, dims, NULL); - - if ( dataspace_id < 0 ) { - - pass = FALSE; - failure_mssg = "H5Screate_simple() failed."; - } - - /* set the dataset creation plist to specify that the raw data is - * to be partioned into 10X10 element chunks. - */ - - if ( pass ) { - - chunk_size[0] = CHUNK_SIZE; - chunk_size[1] = CHUNK_SIZE; - properties = H5Pcreate(H5P_DATASET_CREATE); - - if ( properties < 0 ) { - - pass = FALSE; - failure_mssg = "H5Pcreate() failed."; - } - } - - if ( pass ) { - - if ( H5Pset_chunk(properties, 2, chunk_size) < 0 ) { - - pass = FALSE; - failure_mssg = "H5Pset_chunk() failed."; - } - } - - /* create the dataset */ - if ( pass ) { - - sprintf(dset_name, "/dset%03d", i); - dataset_ids[i] = H5Dcreate(file_id, dset_name, H5T_STD_I32BE, - dataspace_id, properties); - - if ( dataset_ids[i] < 0 ) { - - pass = FALSE; - failure_mssg = "H5Dcreate() failed."; - } - } - - /* get the file space ID */ - if ( pass ) { - - filespace_ids[i] = H5Dget_space(dataset_ids[i]); - - if ( filespace_ids[i] < 0 ) { + result = H5C_get_cache_auto_resize_config(NULL, &test_auto_size_ctl); - pass = FALSE; - failure_mssg = "H5Dget_space() failed."; - } - } + if ( result != FAIL ) { - i++; + pass = FALSE; + failure_mssg = + "H5C_get_cache_auto_resize_config accepted NULL cache_ptr.\n"; } } - /* create the mem space to be used to read and write chunks */ if ( pass ) { - dims[0] = CHUNK_SIZE; - dims[1] = CHUNK_SIZE; - memspace_id = H5Screate_simple(2, dims, NULL); + result = H5C_get_cache_auto_resize_config((H5C_t *)&test_auto_size_ctl, + &test_auto_size_ctl); - if ( memspace_id < 0 ) { + if ( result != FAIL ) { pass = FALSE; - failure_mssg = "H5Screate_simple() failed."; + failure_mssg = + "H5C_get_cache_auto_resize_config accepted bad cache_ptr.\n"; } } - /* select in memory hyperslab */ if ( pass ) { - offset[0] = 0; /*offset of hyperslab in memory*/ - offset[1] = 0; - a_size[0] = CHUNK_SIZE; /*size of hyperslab*/ - a_size[1] = CHUNK_SIZE; - status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, offset, NULL, - a_size, NULL); + result = H5C_get_cache_auto_resize_config(cache_ptr, NULL); - if ( status < 0 ) { + if ( result != FAIL ) { pass = FALSE; - failure_mssg = "H5Sselect_hyperslab() failed."; + failure_mssg = + "H5C_get_cache_auto_resize_config accepted NULL config ptr.\n"; } } - /* initialize all datasets on a round robin basis */ - i = 0; - while ( ( pass ) && ( i < DSET_SIZE ) ) - { - j = 0; - while ( ( pass ) && ( j < DSET_SIZE ) ) - { - m = 0; - while ( ( pass ) && ( m < NUM_DSETS ) ) - { - /* initialize the slab */ - for ( k = 0; k < CHUNK_SIZE; k++ ) - { - for ( l = 0; l < CHUNK_SIZE; l++ ) - { - data_chunk[k][l] = (DSET_SIZE * DSET_SIZE * m) + - (DSET_SIZE * (i + k)) + j + l; - } - } + if ( pass ) { - /* select on disk hyperslab */ - offset[0] = i; /*offset of hyperslab in file*/ - offset[1] = j; - a_size[0] = CHUNK_SIZE; /*size of hyperslab*/ - a_size[1] = CHUNK_SIZE; - status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, - offset, NULL, a_size, NULL); + takedown_cache(cache_ptr, FALSE, FALSE); + } - if ( status < 0 ) { + if ( pass ) { PASSED(); } else { H5_FAILED(); } - pass = FALSE; - failure_mssg = "disk H5Sselect_hyperslab() failed."; - } + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); - /* write the chunk to file */ - status = H5Dwrite(dataset_ids[m], H5T_NATIVE_INT, memspace_id, - filespace_ids[m], H5P_DEFAULT, data_chunk); +} /* check_auto_cache_resize_input_errs() */ - if ( status < 0 ) { + +/*------------------------------------------------------------------------- + * Function: check_auto_cache_resize_aux_fcns() + * + * Purpose: Verify that the auxilary functions associated with + * the automatic cache resize capability are operating + * correctly. These functions are: + * + * H5C_get_cache_size() + * H5C_get_cache_hit_rate() + * H5C_reset_cache_hit_rate_stats() + * + * Return: void + * + * Programmer: John Mainzer + * 11/4/04 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ - pass = FALSE; - failure_mssg = "H5Dwrite() failed."; - } - m++; - } - j += CHUNK_SIZE; - } +static void +check_auto_cache_resize_aux_fcns(void) +{ + const char * fcn_name = "check_auto_cache_resize_aux_fcns()"; + herr_t result; + int32_t i; + H5C_t * cache_ptr = NULL; + double hit_rate; + size_t max_size; + size_t min_clean_size; + size_t cur_size; + int32_t cur_num_entries; + H5C_auto_size_ctl_t auto_size_ctl = + { + /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, +#if 0 + /* H5C_auto_resize_report_fcn rpt_fcn = */ NULL, +#else + /* H5C_auto_resize_report_fcn rpt_fcn = */ H5C_def_auto_resize_rpt_fcn, +#endif + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (1 * 1024 * 1024), - /* check the cache hit rate, and reset the counters. - * Hit rate should be just about unity here, so we will just - * get the data and (possibly) print it without checking it - * beyond ensuring that it agrees with the cache internal - * data structures. - * - * similarly, check cache size. - */ + /* double min_clean_fraction = */ 0.5, - if ( ( pass ) && ( i % (DSET_SIZE / 4) == 0 ) ) { + /* size_t max_size = */ (16 * 1024 * 1025), + /* size_t min_size = */ (512 * 1024), - check_and_validate_cache_hit_rate(file_id, NULL, dump_hit_rate, - min_accesses, min_hit_rate); + /* int64_t epoch_length = */ 50000, - check_and_validate_cache_size(file_id, NULL, NULL, NULL, NULL, - dump_cache_size); - } - i += CHUNK_SIZE; - } + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off, - /* set alternate config 2 */ - if ( pass ) { + /* double lower_hr_threshold = */ 0.75, - if ( H5Fset_mdc_config(file_id, &mod_config_2) < 0 ) { + /* double increment = */ 2.0, - pass = FALSE; - failure_mssg = "H5Fset_mdc_config() failed 2.\n"; - } - } + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), - /* verify that the cache is now set to the alternate config */ - validate_mdc_config(file_id, &mod_config_2, TRUE, 3); - /* do random reads on all datasets */ - n = 0; - while ( ( pass ) && ( n < NUM_RANDOM_ACCESSES ) ) - { - m = rand() % NUM_DSETS; - i = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; - j = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, - /* select on disk hyperslab */ - offset[0] = i; /*offset of hyperslab in file*/ - offset[1] = j; - a_size[0] = CHUNK_SIZE; /*size of hyperslab*/ - a_size[1] = CHUNK_SIZE; - status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, - offset, NULL, a_size, NULL); + /* double upper_hr_threshold = */ 0.995, - if ( status < 0 ) { + /* double decrement = */ 0.9, - pass = FALSE; - failure_mssg = "disk hyperslab create failed."; - } + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), - /* read the chunk from file */ - if ( pass ) { + /* int32_t epochs_before_eviction = */ 3, - status = H5Dread(dataset_ids[m], H5T_NATIVE_INT, memspace_id, - filespace_ids[m], H5P_DEFAULT, data_chunk); + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.5 + }; - if ( status < 0 ) { - pass = FALSE; - failure_mssg = "disk hyperslab create failed."; - } - } + TESTING("automatic cache resize auxilary functions"); - /* validate the slab */ - if ( pass ) { + pass = TRUE; - valid_chunk = TRUE; - for ( k = 0; k < CHUNK_SIZE; k++ ) - { - for ( l = 0; l < CHUNK_SIZE; l++ ) - { - if ( data_chunk[k][l] - != - ((DSET_SIZE * DSET_SIZE * m) + - (DSET_SIZE * (i + k)) + j + l) ) { - - valid_chunk = FALSE; -#if 0 /* this will be useful from time to time -- lets keep it*/ - HDfprintf(stdout, - "data_chunk[%0d][%0d] = %0d, expect %0d.\n", - k, l, data_chunk[k][l], - ((DSET_SIZE * DSET_SIZE * m) + - (DSET_SIZE * (i + k)) + j + l)); - HDfprintf(stdout, - "m = %d, i = %d, j = %d, k = %d, l = %d\n", - m, i, j, k, l); -#endif - } - } - } + /* allocate a cache, and then test the various auxilary functions. + */ - if ( ! valid_chunk ) { -#if 1 - pass = FALSE; - failure_mssg = "slab validation failed."; -#else /* as above */ - fprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", - i, j, m); -#endif - } - } + if ( pass ) { - if ( ( pass ) && ( n % (NUM_RANDOM_ACCESSES / 4) == 0 ) ) { + reset_entries(); - check_and_validate_cache_hit_rate(file_id, NULL, dump_hit_rate, - min_accesses, min_hit_rate); + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); + } - check_and_validate_cache_size(file_id, NULL, NULL, NULL, NULL, - dump_cache_size); - } + if ( pass ) { - n++; - } + result = H5C_set_cache_auto_resize_config(cache_ptr, + &auto_size_ctl); - /* close the file spaces we are done with */ - i = 1; - while ( ( pass ) && ( i < NUM_DSETS ) ) - { - if ( H5Sclose(filespace_ids[i]) < 0 ) { + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5Sclose() failed."; + failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n"; } - i++; } + if ( pass ) { - /* close the datasets we are done with */ - i = 1; - while ( ( pass ) && ( i < NUM_DSETS ) ) - { - if ( H5Dclose(dataset_ids[i]) < 0 ) { + if ( ( cache_ptr->max_cache_size != (1 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (512 * 1024) ) ) { pass = FALSE; - failure_mssg = "H5Dclose() failed."; + failure_mssg = "bad cache size after initialization.\n"; } - i++; } - /* set alternate config 3 */ + /* lets start with the H5C_get_cache_hit_rate(), + * H5C_reset_cache_hit_rate_stats() pair. + */ + if ( pass ) { - if ( H5Fset_mdc_config(file_id, &mod_config_3) < 0 ) { + if ( ( H5C_get_cache_hit_rate(NULL, &hit_rate) != FAIL ) || + ( H5C_get_cache_hit_rate(cache_ptr, NULL) != FAIL ) ) { pass = FALSE; - failure_mssg = "H5Fset_mdc_config() failed 3.\n"; + failure_mssg = "H5C_get_cache_hit_rate accepts bad params.\n"; } } - /* verify that the cache is now set to the alternate config */ - validate_mdc_config(file_id, &mod_config_3, TRUE, 4); - - /* do random reads on data set 0 only */ - m = 0; - n = 0; - while ( ( pass ) && ( n < NUM_RANDOM_ACCESSES ) ) - { - i = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; - j = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; - - /* select on disk hyperslab */ - offset[0] = i; /*offset of hyperslab in file*/ - offset[1] = j; - a_size[0] = CHUNK_SIZE; /*size of hyperslab*/ - a_size[1] = CHUNK_SIZE; - status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, - offset, NULL, a_size, NULL); - - if ( status < 0 ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "disk hyperslab create failed."; - } + result = H5C_get_cache_hit_rate(cache_ptr, &hit_rate); - /* read the chunk from file */ - if ( pass ) { + if ( result != SUCCEED ) { - status = H5Dread(dataset_ids[m], H5T_NATIVE_INT, memspace_id, - filespace_ids[m], H5P_DEFAULT, data_chunk); + pass = FALSE; + failure_mssg = "H5C_get_cache_hit_rate failed.\n"; - if ( status < 0 ) { + } else if ( hit_rate != 0.0 ) { - pass = FALSE; - failure_mssg = "disk hyperslab create failed."; - } + pass = FALSE; + failure_mssg = + "H5C_get_cache_hit_rate returned unexpected hit rate 1.\n"; } + } - /* validate the slab */ - if ( pass ) { + if ( pass ) { - valid_chunk = TRUE; - for ( k = 0; k < CHUNK_SIZE; k++ ) - { - for ( l = 0; l < CHUNK_SIZE; l++ ) - { - if ( data_chunk[k][l] - != - ((DSET_SIZE * DSET_SIZE * m) + - (DSET_SIZE * (i + k)) + j + l) ) { - - valid_chunk = FALSE; - } -#if 0 /* this will be useful from time to time -- lets keep it */ - HDfprintf(stdout, "data_chunk[%0d][%0d] = %0d, expect %0d.\n", - k, l, data_chunk[k][l], - ((DSET_SIZE * DSET_SIZE * m) + - (DSET_SIZE * (i + k)) + j + l)); -#endif - } - } + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, PICO_ENTRY_TYPE, i); - if ( ! valid_chunk ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "slab validation failed."; -#if 0 /* as above */ - fprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", - i, j, m); -#endif + unprotect_entry(cache_ptr, PICO_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); } + i++; } - - if ( ( pass ) && ( n % (NUM_RANDOM_ACCESSES / 4) == 0 ) ) { - - check_and_validate_cache_hit_rate(file_id, NULL, dump_hit_rate, - min_accesses, min_hit_rate); - - check_and_validate_cache_size(file_id, NULL, NULL, NULL, NULL, - dump_cache_size); - } - - n++; } - /* close file space 0 */ if ( pass ) { - if ( H5Sclose(filespace_ids[0]) < 0 ) { + result = H5C_get_cache_hit_rate(cache_ptr, &hit_rate); - pass = FALSE; - failure_mssg = "H5Sclose(filespace_ids[0]) failed."; - } - } + if ( result != SUCCEED ) { - /* close the data space */ - if ( pass ) { + pass = FALSE; + failure_mssg = "H5C_get_cache_hit_rate failed.\n"; - if ( H5Sclose(dataspace_id) < 0 ) { + } else if ( hit_rate != 0.0 ) { pass = FALSE; - failure_mssg = "H5Sclose(dataspace) failed."; - } - } - - /* close the mem space */ - if ( pass ) { + failure_mssg = + "H5C_get_cache_hit_rate returned unexpected hit rate 2.\n"; - if ( H5Sclose(memspace_id) < 0 ) { + } else if ( ( cache_ptr->cache_accesses != 1000 ) || + ( cache_ptr->cache_hits != 0 ) ) { pass = FALSE; - failure_mssg = "H5Sclose(memspace_id) failed."; - } - } - - /* close dataset 0 */ - if ( pass ) { + failure_mssg = "Unexpected cache hit rate stats.\n"; - if ( H5Dclose(dataset_ids[0]) < 0 ) { + } else if ( rpt_fcn_called ) { pass = FALSE; - failure_mssg = "H5Dclose(dataset_ids[0]) failed."; + failure_mssg = "Report function called?.\n"; + } } - /* close the file and delete it */ if ( pass ) { - if ( H5Fclose(file_id) < 0 ) { - - pass = FALSE; - failure_mssg = "H5Fclose() failed.\n"; + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, PICO_ENTRY_TYPE, 0); - } - else if ( HDremove(filename) < 0 ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "HDremove() failed.\n"; + unprotect_entry(cache_ptr, PICO_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; } } - if ( pass ) { PASSED(); } else { H5_FAILED(); } + if ( pass ) { - if ( ! pass ) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); + result = H5C_get_cache_hit_rate(cache_ptr, &hit_rate); -} /* mdc_api_call_smoke_check() */ + if ( result != SUCCEED ) { + pass = FALSE; + failure_mssg = "H5C_get_cache_hit_rate failed.\n"; -/* The following array of invalid external MDC cache configurations is - * used to test error rejection in the MDC related API calls. - */ + } else if ( hit_rate != 0.5 ) { -#define NUM_INVALID_CONFIGS 29 + pass = FALSE; + failure_mssg = + "H5C_get_cache_hit_rate returned unexpected hit rate 3.\n"; -H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = -{ - { - /* 0 -- bad version */ - /* int version = */ -1, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 1 -- bad rpt_fcn_enabled */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ -1, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 2 -- bad set_initial_size */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ 2, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 3 -- max_size too big */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ H5C__MAX_MAX_CACHE_SIZE + 1, - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 4 -- min_size too small */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ H5C__MIN_MAX_CACHE_SIZE - 1, - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 5 -- min_size > max_size */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ FALSE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ (16 * 1024 * 1024 + 1), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 6 -- initial size out of range (too big) */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (16 * 1024 * 1024 + 1), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 7 -- initial_size out of range (too small) */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024 - 1), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 8 -- min_clean_fraction too big */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 1.000001, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 9 -- min_clean_fraction too small */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ -0.00000001, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 10 -- epoch_length too small */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ H5C__MIN_AR_EPOCH_LENGTH - 1, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 11 -- epoch_length too big */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ H5C__MAX_AR_EPOCH_LENGTH + 1, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 12 -- invalid incr_mode */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ -1, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 13 -- lower_hr_threshold too small */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ -0.000001, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 14 -- lower_hr_threshold too big */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 1.00000001, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 15 -- increment too small */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 0.999999999999, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 16 -- bad apply_max_increment */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ -1, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 17 -- bad decr_mode */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ -1, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 18 -- upper_hr_threshold too big */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, - /* double upper_hr_threshold = */ 1.00001, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 19 -- decrement too small */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ -0.0000000001, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 20 -- decrement too big */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 1.0000000001, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 21 -- epochs_before_eviction too small */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 0, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 22 -- epochs_before_eviction too big */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ H5C__MAX_EPOCH_MARKERS + 1, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 23 -- invalid apply_empty_reserve */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ 2, - /* double empty_reserve = */ 0.1 - }, - { - /* 24 -- empty_reserve too small */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ -0.0000000001 - }, - { - /* 25 -- empty_reserve too big */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 1.00000000001 - }, - { - /* 26 -- upper_hr_threshold too small */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ -0.000000001, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 27 -- upper_hr_threshold too big */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 1.00000001, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - }, - { - /* 28 -- upper_hr_threshold <= lower_hr_threshold */ - /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.25, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.9, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1 - } -}; + } else if ( ( cache_ptr->cache_accesses != 2000 ) || + ( cache_ptr->cache_hits != 1000 ) ) { - -/*------------------------------------------------------------------------- - * Function: check_fapl_mdc_api_errs() - * - * Purpose: Verify that the FAPL related MDC API calls reject input - * errors gracefully. - * - * Return: void - * - * Programmer: John Mainzer - * 4/19/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ + pass = FALSE; + failure_mssg = "Unexpected cache hit rate stats.\n"; -static void -check_fapl_mdc_api_errs(void) -{ - const char * fcn_name = "check_fapl_mdc_api_errs()"; - static char msg[128]; - int i; - herr_t result; - hid_t fapl_id; - H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG; - H5AC_cache_config_t scratch; + } else if ( rpt_fcn_called ) { - TESTING("MDC/FAPL related API input errors"); + pass = FALSE; + failure_mssg = "Report function called?.\n"; - pass = TRUE; + } + } + if ( pass ) { - /* first test H5Pget_mdc_config(). - */ + result = H5C_reset_cache_hit_rate_stats(NULL); - scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER; - if ( pass ) { + if ( result != FAIL ) { - H5E_BEGIN_TRY { result = H5Pget_mdc_config(-1, &scratch); } H5E_END_TRY; + pass = FALSE; + failure_mssg = + "H5C_reset_cache_hit_rate_stats accepted NULL cache_ptr.\n"; - if ( result >= 0 ) { + } else if ( ( cache_ptr->cache_accesses != 2000 ) || + ( cache_ptr->cache_hits != 1000 ) ) { pass = FALSE; - failure_mssg = "H5Pget_mdc_config() accepted invalid plist_id."; + failure_mssg = + "Failed call to H5C_reset_cache_hit_rate_stats altered stats?\n"; } } - /* Create a FAPL for test purposes, and veify that it contains the - * default MDC configuration. - */ - if ( pass ) { - fapl_id = H5Pcreate(H5P_FILE_ACCESS); + result = H5C_reset_cache_hit_rate_stats(cache_ptr); - if ( fapl_id < 0 ) { + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n"; - } - } - - scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER; - if ( ( pass ) && - ( ( H5Pget_mdc_config(fapl_id, &scratch) < 0 ) || - ( !CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE) ) ) ) { - - pass = FALSE; - failure_mssg = "New FAPL has unexpected metadata cache config?!?!?.\n"; - } - - if ( pass ) { - - H5E_BEGIN_TRY { - result = H5Pget_mdc_config(fapl_id, NULL); - } H5E_END_TRY; + failure_mssg = "H5C_reset_cache_hit_rate_stats failed.\n"; - if ( result >= 0 ) { + } else if ( ( cache_ptr->cache_accesses != 0 ) || + ( cache_ptr->cache_hits != 0 ) ) { pass = FALSE; - failure_mssg = "H5Pget_mdc_config() accepted NULL config_ptr."; + failure_mssg = "Unexpected cache hit rate stats.\n"; + } } - /* one last test for H5Pget_mdc_config() */ - - scratch.version = -1; /* a convenient, invalid value */ - if ( pass ) { + if ( pass ) { - H5E_BEGIN_TRY { - result = H5Pget_mdc_config(fapl_id, &scratch); - } H5E_END_TRY; + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, PICO_ENTRY_TYPE, i + 500); - if ( result >= 0 ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "H5Pget_mdc_config() accepted bad config version."; + unprotect_entry(cache_ptr, PICO_ENTRY_TYPE, i + 500, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; } } - /* now test H5Pset_mdc_config() - */ - - scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER; if ( pass ) { - H5E_BEGIN_TRY { - result = H5Pset_mdc_config(-1, &default_config); - } H5E_END_TRY; + result = H5C_get_cache_hit_rate(cache_ptr, &hit_rate); - if ( result >= 0 ) { + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5Pset_mdc_config() accepted bad invalid plist_id."; - } - } + failure_mssg = "H5C_get_cache_hit_rate failed.\n"; - if ( pass ) { + } else if ( hit_rate != 0.5 ) { - H5E_BEGIN_TRY { - result = H5Pset_mdc_config(fapl_id, NULL); - } H5E_END_TRY; + pass = FALSE; + failure_mssg = + "H5C_get_cache_hit_rate returned unexpected hit rate 4.\n"; - if ( result >= 0 ) { + } else if ( ( cache_ptr->cache_accesses != 1000 ) || + ( cache_ptr->cache_hits != 500 ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache hit rate stats.\n"; + + } else if ( rpt_fcn_called ) { pass = FALSE; - failure_mssg = "H5Pset_mdc_config() accepted NULL config_ptr."; + failure_mssg = "Report function called?.\n"; + } } - i = 0; - while ( ( pass ) && ( i < NUM_INVALID_CONFIGS ) ) - { - H5E_BEGIN_TRY { - result = H5Pset_mdc_config(fapl_id, &(invalid_configs[i])); - } H5E_END_TRY; + /*************************************************** + * So much for testing H5C_get_cache_hit_rate() and + * H5C_reset_cache_hit_rate_stats(). Now on to + * H5C_get_cache_size(). + ***************************************************/ - if ( result >= 0 ) { + if ( pass ) { + + result = H5C_get_cache_size(NULL, &max_size, &min_clean_size, + &cur_size, &cur_num_entries); + + if ( result != FAIL ) { pass = FALSE; - HDsnprintf(msg, (size_t)128, - "H5Pset_mdc_config() accepted invalid_configs[%d].", i); - failure_mssg = msg; + failure_mssg = "H5C_get_cache_size accepted NULL cache_ptr.\n"; } - i++; } - /* verify that none of the above calls to H5Pset_mdc_config() changed - * the configuration in the FAPL. - */ - scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER; - if ( ( pass ) && - ( ( H5Pget_mdc_config(fapl_id, &scratch) < 0 ) || - ( !CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE) ) ) ) { + if ( pass ) { - pass = FALSE; - failure_mssg = "FAPL metadata cache config changed???.\n"; - } + max_size = 0; + min_clean_size = 0; + cur_size = 0; + cur_num_entries = 0; - if ( pass ) { PASSED(); } else { H5_FAILED(); } + result = H5C_get_cache_size(cache_ptr, &max_size, &min_clean_size, + &cur_size, &cur_num_entries); - if ( ! pass ) - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); + if ( result != SUCCEED ) { -} /* check_fapl_mdc_api_errs() */ + pass = FALSE; + failure_mssg = "H5C_get_cache_size failed 1.\n"; - -/*------------------------------------------------------------------------- - * Function: check_file_mdc_api_errs() - * - * Purpose: Verify that the file related MDC API calls reject input - * errors gracefully. - * - * Return: void - * - * Programmer: John Mainzer - * 4/19/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ + } else if ( max_size != (1 * 1024 * 1024) ) { -static void -check_file_mdc_api_errs(void) -{ - const char * fcn_name = "check_file_mdc_api_errs()"; - char filename[512]; - static char msg[128]; - int i; - herr_t result; - hid_t file_id; - size_t max_size; - size_t min_clean_size; - size_t cur_size; - int cur_num_entries; - double hit_rate; - H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG; - H5AC_cache_config_t scratch; + pass = FALSE; + failure_mssg = + "H5C_get_cache_size reports unexpected max_size 1.\n"; - TESTING("MDC/FILE related API input errors"); + } else if ( min_clean_size != (512 * 1024) ) { - pass = TRUE; + pass = FALSE; + failure_mssg = + "H5C_get_cache_size reports unexpected min_clean_size 1.\n"; - /* Create a file for test purposes, and veify that its metadata cache - * set to the default MDC configuration. - */ + } else if ( cur_size != (1500 * PICO_ENTRY_SIZE) ) { - /* setup the file name */ - if ( pass ) { + pass = FALSE; + failure_mssg = + "H5C_get_cache_size reports unexpected cur_size 1.\n"; - if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) - == NULL ) { + } else if ( cur_num_entries != 1500 ) { pass = FALSE; - failure_mssg = "h5_fixname() failed.\n"; + failure_mssg = + "H5C_get_cache_size reports unexpected cur_num_entries 1.\n"; } } + /* read a larger entry so that cur_size and cur_num_entries will be + * different. + */ if ( pass ) { - file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - - if ( file_id < 0 ) { - - pass = FALSE; - failure_mssg = "H5Fcreate() failed.\n"; - } + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); } - validate_mdc_config(file_id, &default_config, TRUE, 1); - + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, NO_CHANGE, + H5C__NO_FLAGS_SET); + } - /* test H5Fget_mdc_config(). */ + if ( pass ) { - scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER; - if ( pass ) { + max_size = 0; + min_clean_size = 0; + cur_size = 0; + cur_num_entries = 0; - H5E_BEGIN_TRY { - result = H5Fget_mdc_config(-1, &scratch); - } H5E_END_TRY; + result = H5C_get_cache_size(cache_ptr, &max_size, &min_clean_size, + &cur_size, &cur_num_entries); - if ( result >= 0 ) { + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5Fget_mdc_config() accepted invalid file_id."; - } - } + failure_mssg = "H5C_get_cache_size failed 2.\n"; - if ( pass ) { + } else if ( max_size != (1 * 1024 * 1024) ) { - H5E_BEGIN_TRY { - result = H5Fget_mdc_config(file_id, NULL); - } H5E_END_TRY; + pass = FALSE; + failure_mssg = + "H5C_get_cache_size reports unexpected max_size 2.\n"; - if ( result >= 0 ) { + } else if ( min_clean_size != (512 * 1024) ) { pass = FALSE; - failure_mssg = "H5Fget_mdc_config() accepted NULL config_ptr."; - } - } + failure_mssg = + "H5C_get_cache_size reports unexpected min_clean_size 2.\n"; - scratch.version = -1; /* a convenient, invalid value */ - if ( pass ) { + } else if ( cur_size != + ((1500 * PICO_ENTRY_SIZE) + MONSTER_ENTRY_SIZE) ) { - H5E_BEGIN_TRY { - result = H5Fget_mdc_config(file_id, &scratch); - } H5E_END_TRY; + pass = FALSE; + failure_mssg = + "H5C_get_cache_size reports unexpected cur_size 2.\n"; - if ( result >= 0 ) { + } else if ( cur_num_entries != 1501 ) { pass = FALSE; - failure_mssg = "H5Fget_mdc_config() accepted bad config version."; + failure_mssg = + "H5C_get_cache_size reports unexpected cur_num_entries 2.\n"; } } - - /* test H5Fset_mdc_config() */ - - scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER; if ( pass ) { - H5E_BEGIN_TRY { - result = H5Fset_mdc_config(-1, &default_config); - } H5E_END_TRY; - - if ( result >= 0 ) { + max_size = 0; + min_clean_size = 0; + cur_size = 0; + cur_num_entries = 0; - pass = FALSE; - failure_mssg = "H5Fset_mdc_config() accepted bad invalid file_id."; - } - } + result = H5C_get_cache_size(cache_ptr, &max_size, NULL, NULL, NULL); - if ( pass ) { + if ( result != SUCCEED ) { - H5E_BEGIN_TRY { - result = H5Fset_mdc_config(file_id, NULL); - } H5E_END_TRY; + pass = FALSE; + failure_mssg = "H5C_get_cache_size failed 3.\n"; - if ( result >= 0 ) { + } else if ( max_size != (1 * 1024 * 1024) ) { pass = FALSE; - failure_mssg = "H5Fset_mdc_config() accepted NULL config_ptr."; - } - } - - i = 0; - while ( ( pass ) && ( i < NUM_INVALID_CONFIGS ) ) - { - H5E_BEGIN_TRY { - result = H5Fset_mdc_config(file_id, &(invalid_configs[i])); - } H5E_END_TRY; + failure_mssg = + "H5C_get_cache_size reports unexpected max_size 3.\n"; - if ( result >= 0 ) { + } else if ( ( min_clean_size != 0 ) || + ( cur_size != 0 ) || + ( cur_num_entries != 0 ) ) { pass = FALSE; - HDsnprintf(msg, (size_t)128, - "H5Fset_mdc_config() accepted invalid_configs[%d].", i); - failure_mssg = msg; + failure_mssg = "Phantom returns from H5C_get_cache_size?\n"; + } - i++; } - /* verify that none of the above calls to H5Fset_mdc_config() changed - * the configuration in the FAPL. - */ - validate_mdc_config(file_id, &default_config, TRUE, 2); - - - /* test H5Fget_mdc_hit_rate() */ if ( pass ) { - H5E_BEGIN_TRY { - result = H5Fget_mdc_hit_rate(-1, &hit_rate); - } H5E_END_TRY; + max_size = 0; + min_clean_size = 0; + cur_size = 0; + cur_num_entries = 0; - if ( result >= 0 ) { + result = H5C_get_cache_size(cache_ptr, NULL, &min_clean_size, + NULL, NULL); + + if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5Fget_mdc_hit_rate() accepted bad file_id."; - } - } + failure_mssg = "H5C_get_cache_size failed 4.\n"; - if ( pass ) { + } else if ( min_clean_size != (512 * 1024) ) { - H5E_BEGIN_TRY { - result = H5Fget_mdc_hit_rate(file_id, NULL); - } H5E_END_TRY; + pass = FALSE; + failure_mssg = + "H5C_get_cache_size reports unexpected min_clean_size 4.\n"; - if ( result >= 0 ) { + } else if ( ( max_size != 0 ) || + ( cur_size != 0 ) || + ( cur_num_entries != 0 ) ) { pass = FALSE; - failure_mssg = "H5Fget_mdc_hit_rate() accepted NULL hit_rate_ptr."; + failure_mssg = "Phantom returns from H5C_get_cache_size?\n"; + } } - - /* test H5Freset_mdc_hit_rate_stats() */ if ( pass ) { - H5E_BEGIN_TRY { - result = H5Freset_mdc_hit_rate_stats(-1); - } H5E_END_TRY; + max_size = 0; + min_clean_size = 0; + cur_size = 0; + cur_num_entries = 0; - if ( result >= 0 ) { + result = H5C_get_cache_size(cache_ptr, NULL, NULL, &cur_size, NULL); - pass = FALSE; - failure_mssg = - "H5Freset_mdc_hit_rate_stats() accepted bad file_id."; - } - } + if ( result != SUCCEED ) { + pass = FALSE; + failure_mssg = "H5C_get_cache_size failed 5.\n"; - /* test H5Fget_mdc_size() */ - if ( pass ) { + } else if ( cur_size != + ((1500 * PICO_ENTRY_SIZE) + MONSTER_ENTRY_SIZE) ) { - H5E_BEGIN_TRY { - result = H5Fget_mdc_size(-1, &max_size, &min_clean_size, - &cur_size, &cur_num_entries); - } H5E_END_TRY; + pass = FALSE; + failure_mssg = + "H5C_get_cache_size reports unexpected cur_size 5.\n"; - if ( result >= 0 ) { + } else if ( ( max_size != 0 ) || + ( min_clean_size != 0 ) || + ( cur_num_entries != 0 ) ) { pass = FALSE; - failure_mssg = "H5Fget_mdc_size() accepted bad file_id."; + failure_mssg = "Phantom returns from H5C_get_cache_size?\n"; + } } if ( pass ) { - if ( ( H5Fget_mdc_size(file_id, &max_size, NULL, NULL, NULL) < 0 ) || - ( H5Fget_mdc_size(file_id, NULL, &min_clean_size, - NULL, NULL) < 0 ) || - ( H5Fget_mdc_size(file_id, NULL, NULL, &cur_size, NULL) < 0 ) || - ( H5Fget_mdc_size(file_id, NULL, NULL, NULL, - &cur_num_entries) < 0 ) || - ( H5Fget_mdc_size(file_id, NULL, NULL, NULL, NULL) < 0 ) ) { + max_size = 0; + min_clean_size = 0; + cur_size = 0; + cur_num_entries = 0; - pass = FALSE; - failure_mssg = "H5Fget_mdc_size() failed to handle NULL params."; - } - } + result = H5C_get_cache_size(cache_ptr, NULL, NULL, NULL, + &cur_num_entries); + if ( result != SUCCEED ) { - /* close the file and delete it */ - if ( pass ) { + pass = FALSE; + failure_mssg = "H5C_get_cache_size failed 6.\n"; - if ( H5Fclose(file_id) < 0 ) { + } else if ( cur_num_entries != 1501 ) { pass = FALSE; - failure_mssg = "H5Fclose() failed.\n"; + failure_mssg = + "H5C_get_cache_size reports unexpected cur_num_entries 2.\n"; - } else if ( HDremove(filename) < 0 ) { + } else if ( ( max_size != 0 ) || + ( min_clean_size != 0 ) || + ( cur_size != 0 ) ) { pass = FALSE; - failure_mssg = "HDremove() failed.\n"; + failure_mssg = "Phantom returns from H5C_get_cache_size?\n"; + } } + if ( pass ) { + + takedown_cache(cache_ptr, FALSE, FALSE); + } + if ( pass ) { PASSED(); } else { H5_FAILED(); } if ( ! pass ) HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", fcn_name, failure_mssg); -} /* check_file_mdc_api_errs() */ +} /* check_auto_cache_resize_aux_fcns() */ /*------------------------------------------------------------------------- @@ -20556,14 +14268,6 @@ main(void) check_auto_cache_resize_epoch_markers(); check_auto_cache_resize_input_errs(); check_auto_cache_resize_aux_fcns(); - - check_fapl_mdc_api_calls(); - check_file_mdc_api_calls(); -#endif - mdc_api_call_smoke_check(); -#if 1 - check_fapl_mdc_api_errs(); - check_file_mdc_api_errs(); #endif return(0); diff --git a/testpar/Makefile.am b/testpar/Makefile.am index 1f444e0..b100ea2 100644 --- a/testpar/Makefile.am +++ b/testpar/Makefile.am @@ -24,7 +24,7 @@ INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/test # Test programs and scripts. These are our main targets. # -TEST_PROG_PARA=t_mpi t_posix_compliant t_fphdf5 testphdf5 +TEST_PROG_PARA=t_cache t_mpi t_posix_compliant t_fphdf5 testphdf5 TEST_SCRIPT_PARA=testph5.sh check_PROGRAMS = $(TEST_PROG_PARA) diff --git a/testpar/Makefile.in b/testpar/Makefile.in index 210b79c..955cb18 100644 --- a/testpar/Makefile.in +++ b/testpar/Makefile.in @@ -29,7 +29,7 @@ # # hdf5 Parallel Library Test Makefile(.in) # -SOURCES = t_fphdf5.c t_mpi.c t_posix_compliant.c $(testphdf5_SOURCES) +SOURCES = t_cache.c t_fphdf5.c t_mpi.c t_posix_compliant.c $(testphdf5_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -65,13 +65,18 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/H5config.h CONFIG_CLEAN_FILES = testph5.sh -am__EXEEXT_1 = t_mpi$(EXEEXT) t_posix_compliant$(EXEEXT) \ - t_fphdf5$(EXEEXT) testphdf5$(EXEEXT) +am__EXEEXT_1 = t_cache$(EXEEXT) t_mpi$(EXEEXT) \ + t_posix_compliant$(EXEEXT) t_fphdf5$(EXEEXT) \ + testphdf5$(EXEEXT) +t_cache_SOURCES = t_cache.c +t_cache_OBJECTS = t_cache.$(OBJEXT) +t_cache_LDADD = $(LDADD) +am__DEPENDENCIES_1 = $(top_builddir)/test/libh5test.la +am__DEPENDENCIES_2 = $(top_builddir)/src/libhdf5.la +t_cache_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) t_fphdf5_SOURCES = t_fphdf5.c t_fphdf5_OBJECTS = t_fphdf5.$(OBJEXT) t_fphdf5_LDADD = $(LDADD) -am__DEPENDENCIES_1 = $(top_builddir)/test/libh5test.la -am__DEPENDENCIES_2 = $(top_builddir)/src/libhdf5.la t_fphdf5_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) t_mpi_SOURCES = t_mpi.c t_mpi_OBJECTS = t_mpi.$(OBJEXT) @@ -100,8 +105,9 @@ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = t_fphdf5.c t_mpi.c t_posix_compliant.c $(testphdf5_SOURCES) -DIST_SOURCES = t_fphdf5.c t_mpi.c t_posix_compliant.c \ +SOURCES = t_cache.c t_fphdf5.c t_mpi.c t_posix_compliant.c \ + $(testphdf5_SOURCES) +DIST_SOURCES = t_cache.c t_fphdf5.c t_mpi.c t_posix_compliant.c \ $(testphdf5_SOURCES) ETAGS = etags CTAGS = ctags @@ -351,7 +357,7 @@ INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/test # Test programs and scripts. These are our main targets. # -TEST_PROG_PARA = t_mpi t_posix_compliant t_fphdf5 testphdf5 +TEST_PROG_PARA = t_cache t_mpi t_posix_compliant t_fphdf5 testphdf5 TEST_SCRIPT_PARA = testph5.sh check_SCRIPTS = $(TEST_SCRIPT) testphdf5_SOURCES = testphdf5.c t_dset.c t_file.c t_mdset.c t_ph5basic.c \ @@ -420,6 +426,9 @@ clean-checkPROGRAMS: echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done +t_cache$(EXEEXT): $(t_cache_OBJECTS) $(t_cache_DEPENDENCIES) + @rm -f t_cache$(EXEEXT) + $(LINK) $(t_cache_LDFLAGS) $(t_cache_OBJECTS) $(t_cache_LDADD) $(LIBS) t_fphdf5$(EXEEXT): $(t_fphdf5_OBJECTS) $(t_fphdf5_DEPENDENCIES) @rm -f t_fphdf5$(EXEEXT) $(LINK) $(t_fphdf5_LDFLAGS) $(t_fphdf5_OBJECTS) $(t_fphdf5_LDADD) $(LIBS) @@ -439,6 +448,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_cache.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_chunk_alloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_coll_chunk.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_dset.Po@am__quote@ -- cgit v0.12