From d236e2a9926cc62048d9489a60ab0d5f4dfcd41c Mon Sep 17 00:00:00 2001 From: John Mainzer Date: Fri, 18 Jan 2008 12:52:12 -0500 Subject: [svn-r14442] Modified metadata cache to adapt more quickly to the insertion of a large entry, or to a large increases in the size of an existing entry. This required some additions to the cache configuration structure, and thus will require changes in the metadata cache documentation. The basic idea is to monitor the size of entries as they are loaded, inserted, or increased in size. If the size of the entry (or increase) exceeds some user selected fraction of the size of the cache, increase the size of the cache. Note that this fix was designed quickly -- while it deals with the use case that exposed the problem, we may have to revisit the issue later. Tested serial and parallel on Phoenix, and h5committest. --- src/H5AC.c | 23 +- src/H5ACprivate.h | 4 + src/H5ACpublic.h | 61 +- src/H5C.c | 453 ++++- src/H5Cpkg.h | 22 +- src/H5Cprivate.h | 105 +- src/H5Cpublic.h | 6 + src/H5HL.c | 4 + src/H5O.c | 11 + test/cache.c | 5427 ++++++++++++++++++++++++++++++++++----------------- test/cache_api.c | 389 +++- test/cache_common.c | 107 + test/cache_common.h | 5 + testpar/t_cache.c | 2 +- 14 files changed, 4806 insertions(+), 1813 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index 8f62095..cd79e6a 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -2546,6 +2546,10 @@ done: * switches for functions that are only tenuously related * to auto resize configuration. * + * JRM - 1/2/08 + * Added support for the new flash cache increment related + * fields. + * *------------------------------------------------------------------------- */ @@ -2625,6 +2629,9 @@ H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr, config_ptr->max_increment = internal_config.max_increment; config_ptr->decr_mode = internal_config.decr_mode; config_ptr->upper_hr_threshold = internal_config.upper_hr_threshold; + config_ptr->flash_incr_mode = internal_config.flash_incr_mode; + config_ptr->flash_multiple = internal_config.flash_multiple; + config_ptr->flash_threshold = internal_config.flash_threshold; config_ptr->decrement = internal_config.decrement; config_ptr->apply_max_decrement = internal_config.apply_max_decrement; config_ptr->max_decrement = internal_config.max_decrement; @@ -2816,6 +2823,10 @@ done: * switches for functions that are only tenuously related * to auto resize configuration. * + * John Mainzer -- 1/3/07 + * Updated trace file code to record the new flash cache + * size increase related fields. + * *------------------------------------------------------------------------- */ @@ -2969,7 +2980,7 @@ done: ( trace_file_ptr != NULL ) ) { HDfprintf(trace_file_ptr, - "%s %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %d %d %f %f %d %d %d %d %f %d %d\n", + "%s %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %f %f %d %d %d %f %f %d %d %d %d %f %d %d\n", "H5AC_set_cache_auto_resize_config", trace_config.version, (int)(trace_config.rpt_fcn_enabled), @@ -2986,6 +2997,9 @@ done: (int)(trace_config.incr_mode), trace_config.lower_hr_threshold, trace_config.increment, + (int)(trace_config.flash_incr_mode), + trace_config.flash_multiple, + trace_config.flash_threshold, (int)(trace_config.apply_max_increment), (int)(trace_config.max_increment), (int)(trace_config.decr_mode), @@ -3618,7 +3632,9 @@ done: * * Modifications: * - * None. + * Updated function for flash cache increment fields. + * + * JRM -- 1/2/08 * *------------------------------------------------------------------------- */ @@ -3661,6 +3677,9 @@ H5AC_ext_config_2_int_config(H5AC_cache_config_t * ext_conf_ptr, 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->flash_incr_mode = ext_conf_ptr->flash_incr_mode; + int_conf_ptr->flash_multiple = ext_conf_ptr->flash_multiple; + int_conf_ptr->flash_threshold = ext_conf_ptr->flash_threshold; int_conf_ptr->decr_mode = ext_conf_ptr->decr_mode; int_conf_ptr->upper_hr_threshold = ext_conf_ptr->upper_hr_threshold; diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 628a269..bbbcf11 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -213,6 +213,10 @@ extern hid_t H5AC_ind_dxpl_id; /* double increment = */ 2.0, \ /* hbool_t apply_max_increment = */ TRUE, \ /* size_t max_increment = */ (4 * 1024 * 1024), \ + /* enum H5C_cache_flash_incr_mode */ \ + /* flash_incr_mode = */ H5C_flash_incr__add_space, \ + /* double flash_multiple = */ 1.0, \ + /* double flash_threshold = */ 0.25, \ /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold,\ /* double upper_hr_threshold = */ 0.999, \ /* double decrement = */ 0.9, \ diff --git a/src/H5ACpublic.h b/src/H5ACpublic.h index 0ddef92..0e75117 100644 --- a/src/H5ACpublic.h +++ b/src/H5ACpublic.h @@ -15,7 +15,7 @@ /*------------------------------------------------------------------------- * - * Created: H5ACproto.h + * Created: H5ACpublic.h * Jul 10 1997 * Robb Matzke * @@ -208,6 +208,61 @@ extern "C" { * above, this field contains the maximum number of bytes by which the * cache size can be increased in a single re-size. * + * flash_incr_mode: Instance of the H5C_cache_flash_incr_mode enumerated + * type whose value indicates whether and by which algorithm we should + * make flash increases in the size of the cache to accomodate insertion + * of large entries and large increases in the size of a single entry. + * + * The addition of the flash increment mode was occasioned by performance + * problems that appear when a local heap is increased to a size in excess + * of the current cache size. While the existing re-size code dealt with + * this eventually, performance was very bad for the remainder of the + * epoch. + * + * At present, there are two possible values for the flash_incr_mode: + * + * H5C_flash_incr__off: Don't perform flash increases in the size of + * the cache. + * + * H5C_flash_incr__add_space: Let x be either the size of a newly + * newly inserted entry, or the number of bytes by which the + * size of an existing entry has been increased. + * + * If + * x > flash_threshold * current max cache size, + * + * increase the current maximum cache size by x * flash_multiple + * less any free space in the cache, and star a new epoch. For + * now at least, pay no attention to the maximum increment. + * + * In both of the above cases, the flash increment pays no attention to + * the maximum increment (at least in this first incarnation), but DOES + * stay within max_size. + * + * With a little thought, it should be obvious that the above flash + * cache size increase algorithm is not sufficient for all circumstances -- + * for example, suppose the user round robins through + * (1/flash_threshold) +1 groups, adding one data set to each on each + * pass. Then all will increase in size at about the same time, requiring + * the max cache size to at least double to maintain acceptable + * performance, however the above flash increment algorithm will not be + * triggered. + * + * Hopefully, the add space algorithms detailed above will be sufficient + * for the performance problems encountered to date. However, we should + * expect to revisit the issue. + * + * flash_multiple: Double containing the multiple described above in the + * H5C_flash_incr__add_space section of the discussion of the + * flash_incr_mode section. This field is ignored unless flash_incr_mode + * is H5C_flash_incr__add_space. + * + * flash_threshold: Double containing the factor by which current max cache size + * is multiplied to obtain the size threshold for the add_space flash + * increment algorithm. The field is ignored unless flash_incr_mode is + * H5C_flash_incr__add_space. + * + * * * Cache size decrease control fields: * @@ -364,6 +419,10 @@ typedef struct H5AC_cache_config_t hbool_t apply_max_increment; size_t max_increment; + enum H5C_cache_flash_incr_mode flash_incr_mode; + double flash_multiple; + double flash_threshold; + /* size decrease control fields: */ enum H5C_cache_decr_mode decr_mode; diff --git a/src/H5C.c b/src/H5C.c index 8ac9929..a865270 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -2596,6 +2596,10 @@ static herr_t H5C__autoadjust__ageout__remove_all_markers(H5C_t * cache_ptr); static herr_t H5C__autoadjust__ageout__remove_excess_markers(H5C_t * cache_ptr); +static herr_t H5C__flash_increase_cache_size(H5C_t * cache_ptr, + size_t old_entry_size, + size_t new_entry_size); + static herr_t H5C_flush_single_entry(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, @@ -2836,8 +2840,12 @@ done: * ro_ref_count fields. * * JRM -- 7/27/07 -* Added initialization for the new evictions_enabled -* field of H5C_t. + * Added initialization for the new evictions_enabled + * field of H5C_t. + * + * JRM -- 12/31/07 + * Added initialization for the new flash cache size increase + * related fields of H5C_t. * *------------------------------------------------------------------------- */ @@ -2954,6 +2962,8 @@ H5C_create(size_t max_cache_size, cache_ptr->dLRU_tail_ptr = NULL; cache_ptr->size_increase_possible = FALSE; + cache_ptr->flash_size_increase_possible = FALSE; + cache_ptr->flash_size_increase_threshold = 0; cache_ptr->size_decrease_possible = FALSE; cache_ptr->resize_enabled = FALSE; cache_ptr->cache_full = FALSE; @@ -2974,6 +2984,11 @@ H5C_create(size_t max_cache_size, (cache_ptr->resize_ctl).apply_max_increment = TRUE; (cache_ptr->resize_ctl).max_increment = H5C__DEF_AR_MAX_INCREMENT; + (cache_ptr->resize_ctl).flash_incr_mode = H5C_flash_incr__off; + (cache_ptr->resize_ctl).flash_multiple = 1.0; + (cache_ptr->resize_ctl).flash_threshold = 0.25; + + (cache_ptr->resize_ctl).decr_mode = H5C_decr__off; (cache_ptr->resize_ctl).upper_hr_threshold = H5C__DEF_AR_UPPER_THRESHHOLD; (cache_ptr->resize_ctl).decrement = H5C__DEF_AR_DECREMENT; @@ -3079,6 +3094,9 @@ done: * Updated function for display the new prefix field of * H5C_t in output. * + * JRM 12/31/07 + * Updated function to handle flash size increases. + * *------------------------------------------------------------------------- */ void @@ -3125,6 +3143,24 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, new_min_clean_size); break; + case flash_increase: + HDassert( old_max_cache_size < new_max_cache_size ); + + HDfprintf(stdout, + "%sflash cache resize(%d) -- size threshold = %Zu.\n", + cache_ptr->prefix, + (int)((cache_ptr->resize_ctl).flash_incr_mode), + cache_ptr->flash_size_increase_threshold); + + HDfprintf(stdout, + "%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: HDassert( old_max_cache_size > new_max_cache_size ); @@ -4434,6 +4470,9 @@ done: * Added code to disable evictions when the new * evictions_enabled field is FALSE. * + * JRM -- 12/31/07 + * Added code supporting flash cache size increases. + * *------------------------------------------------------------------------- */ @@ -4447,6 +4486,7 @@ H5C_insert_entry(H5F_t * f, void * thing, unsigned int flags) { + const char * fcn_name = "H5C_insert_entry()"; herr_t result; herr_t ret_value = SUCCEED; /* Return value */ hbool_t first_flush = TRUE; @@ -4524,6 +4564,18 @@ H5C_insert_entry(H5F_t * f, H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) + if ( ( cache_ptr->flash_size_increase_possible ) && + ( entry_ptr->size > cache_ptr->flash_size_increase_threshold ) ) { + + result = H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \ + "H5C__flash_increase_cache_size failed.") + } + } + if ( ( cache_ptr->evictions_enabled ) && ( (cache_ptr->index_size + entry_ptr->size) > cache_ptr->max_cache_size ) ) { @@ -4999,7 +5051,9 @@ done: * * Modifications: * - * None + * Added code to do a flash cache size increase if + * appropriate. + * JRM -- 1/11/08 * *------------------------------------------------------------------------- */ @@ -5010,6 +5064,8 @@ H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr, size_t new_size) { herr_t ret_value = SUCCEED; /* Return value */ + herr_t result; + size_t size_increase; H5C_cache_entry_t * entry_ptr; FUNC_ENTER_NOAPI(H5C_mark_pinned_entry_dirty, FAIL) @@ -5039,6 +5095,29 @@ H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr, /* update for change in entry size if necessary */ if ( ( size_changed ) && ( entry_ptr->size != new_size ) ) { + /* do a flash cache size increase if appropriate */ + if ( cache_ptr->flash_size_increase_possible ) { + + if ( new_size > entry_ptr->size ) { + + size_increase = new_size - entry_ptr->size; + + if ( size_increase >= + cache_ptr->flash_size_increase_threshold ) { + + result = H5C__flash_increase_cache_size(cache_ptr, + entry_ptr->size, + new_size); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ + "H5C__flash_increase_cache_size failed.") + } + } + } + } + /* update the protected entry list */ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pel_len), \ (cache_ptr->pel_size), \ @@ -5371,7 +5450,9 @@ done: * * Modifications: * - * None + * Added code to apply a flash cache size increment if + * appropriate. + * JRM -- 1/11/08 * *------------------------------------------------------------------------- */ @@ -5380,8 +5461,11 @@ H5C_resize_pinned_entry(H5C_t * cache_ptr, void * thing, size_t new_size) { + const char * fcn_name = "H5C_resize_pinned_entry()"; herr_t ret_value = SUCCEED; /* Return value */ + herr_t result; H5C_cache_entry_t * entry_ptr; + size_t size_increase; FUNC_ENTER_NOAPI(H5C_resize_pinned_entry, FAIL) @@ -5417,6 +5501,29 @@ H5C_resize_pinned_entry(H5C_t * cache_ptr, /* update for change in entry size if necessary */ if ( entry_ptr->size != new_size ) { + /* do a flash cache size increase if appropriate */ + if ( cache_ptr->flash_size_increase_possible ) { + + if ( new_size > entry_ptr->size ) { + + size_increase = new_size - entry_ptr->size; + + if ( size_increase >= + cache_ptr->flash_size_increase_threshold ) { + + result = H5C__flash_increase_cache_size(cache_ptr, + entry_ptr->size, + new_size); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ + "H5C__flash_increase_cache_size failed.") + } + } + } + } + /* update the protected entry list */ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pel_len), \ (cache_ptr->pel_size), \ @@ -5604,9 +5711,13 @@ done: * of cache entries. * * JRM -- 7/27/07 - * Added code supporting the new evictions_enabled fieled + * Added code supporting the new evictions_enabled field * in H5C_t. * + * JRM -- 1/3/08 + * Added to do a flash cache size increase if appropriate + * when a large entry is loaded. + * *------------------------------------------------------------------------- */ @@ -5621,6 +5732,7 @@ H5C_protect(H5F_t * f, void * udata2, unsigned flags) { + const char * fcn_name = "H5C_protect()"; hbool_t hit; hbool_t first_flush; hbool_t have_write_permitted = FALSE; @@ -5678,7 +5790,25 @@ H5C_protect(H5F_t * f, entry_ptr = (H5C_cache_entry_t *)thing; - /* try to free up some space if necessary and if evictions are permitted */ + /* If the entry is very large, and we are configured to allow it, + * we may wish to perform a flash cache size increase. + */ + if ( ( cache_ptr->flash_size_increase_possible ) && + ( entry_ptr->size > cache_ptr->flash_size_increase_threshold ) ) { + + result = H5C__flash_increase_cache_size(cache_ptr, 0, + entry_ptr->size); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \ + "H5C__flash_increase_cache_size failed.") + } + } + + /* try to free up some space if necessary and if evictions are + * permitted + */ if ( ( cache_ptr->evictions_enabled ) && ( (cache_ptr->index_size + entry_ptr->size) > cache_ptr->max_cache_size ) ) { @@ -5978,6 +6108,10 @@ done: * if the new configuration forces an immediate reduction * in cache size. * + * JRM -- 12/31/07 + * Added code supporting the new flash cache size increase + * code. + * *------------------------------------------------------------------------- */ @@ -5985,6 +6119,7 @@ herr_t H5C_set_cache_auto_resize_config(H5C_t * cache_ptr, H5C_auto_size_ctl_t *config_ptr) { + const char *fcn_name = "H5C_set_cache_auto_resize_config()"; herr_t ret_value = SUCCEED; /* Return value */ herr_t result; size_t new_max_cache_size; @@ -6039,8 +6174,10 @@ H5C_set_cache_auto_resize_config(H5C_t * cache_ptr, "conflicting threshold fields in new config.") } - cache_ptr->size_increase_possible = TRUE; /* will set to FALSE if needed */ - cache_ptr->size_decrease_possible = TRUE; /* will set to FALSE if needed */ + /* will set the increase possible fields to FALSE later if needed */ + cache_ptr->size_increase_possible = TRUE; + cache_ptr->flash_size_increase_possible = TRUE; + cache_ptr->size_decrease_possible = TRUE; switch ( config_ptr->incr_mode ) { @@ -6062,6 +6199,11 @@ H5C_set_cache_auto_resize_config(H5C_t * cache_ptr, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown incr_mode?!?!?.") } + /* logically, this is were configuration for flash cache size increases + * should go. However, this configuration depends on max_cache_size, so + * we wait until the end of the function, when this field is set. + */ + switch ( config_ptr->decr_mode ) { case H5C_decr__off: @@ -6106,9 +6248,13 @@ H5C_set_cache_auto_resize_config(H5C_t * cache_ptr, if ( config_ptr->max_size == config_ptr->min_size ) { cache_ptr->size_increase_possible = FALSE; + cache_ptr->flash_size_increase_possible = FALSE; cache_ptr->size_decrease_possible = FALSE; } + /* flash_size_increase_possible is intentionally omitted from the + * following: + */ cache_ptr->resize_enabled = cache_ptr->size_increase_possible || cache_ptr->size_decrease_possible; @@ -6196,6 +6342,37 @@ H5C_set_cache_auto_resize_config(H5C_t * cache_ptr, } } + /* configure flash size increase facility. We wait until the + * end of the function, as we need the max_cache_size set before + * we start to keep things simple. + * + * If we haven't already ruled out flash cache size increases above, + * go ahead and configure it. + */ + + if ( cache_ptr->flash_size_increase_possible ) { + + switch ( config_ptr->flash_incr_mode ) + { + case H5C_flash_incr__off: + cache_ptr->flash_size_increase_possible = FALSE; + break; + + case H5C_flash_incr__add_space: + cache_ptr->flash_size_increase_possible = TRUE; + cache_ptr->flash_size_increase_threshold = + (size_t) + (((double)(cache_ptr->max_cache_size)) * + ((cache_ptr->resize_ctl).flash_threshold)); + break; + + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "Unknown flash_incr_mode?!?!?.") + break; + } + } + done: FUNC_LEAVE_NOAPI(ret_value) @@ -7095,6 +7272,9 @@ done: * Also added sanity checks using the new is_read_only and * ro_ref_count parameters. * + * JRM -- 12/31/07 + * Modified funtion to support flash cache resizes. + * *------------------------------------------------------------------------- */ herr_t @@ -7108,6 +7288,7 @@ H5C_unprotect(H5F_t * f, unsigned int flags, size_t new_size) { + const char * fcn_name = "H5C_unprotect()"; hbool_t deleted; hbool_t dirtied; hbool_t set_flush_marker; @@ -7118,6 +7299,8 @@ H5C_unprotect(H5F_t * f, hbool_t clear_entry = FALSE; #endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ + herr_t result; + size_t size_increase = 0; H5C_cache_entry_t * entry_ptr; H5C_cache_entry_t * test_entry_ptr; @@ -7265,6 +7448,29 @@ H5C_unprotect(H5F_t * f, /* update for change in entry size if necessary */ if ( ( size_changed ) && ( entry_ptr->size != new_size ) ) { + /* do a flash cache size increase if appropriate */ + if ( cache_ptr->flash_size_increase_possible ) { + + if ( new_size > entry_ptr->size ) { + + size_increase = new_size - entry_ptr->size; + + if ( size_increase >= + cache_ptr->flash_size_increase_threshold ) { + + result = H5C__flash_increase_cache_size(cache_ptr, + entry_ptr->size, + new_size); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ + "H5C__flash_increase_cache_size failed.") + } + } + } + } + /* update the protected list */ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pl_len), \ (cache_ptr->pl_size), \ @@ -7458,7 +7664,9 @@ done: * * Modifications: * - * None. + * Added validation for the flash increment fields. + * + * JRM -- 12/31/07 * *------------------------------------------------------------------------- */ @@ -7560,7 +7768,7 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, ( config_ptr->apply_max_increment != FALSE ) ) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "apply_max_increment must be either TRUE or FALSE"); + "apply_max_increment must be either TRUE or FALSE"); } /* no need to check max_increment, as it is a size_t, @@ -7568,6 +7776,33 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, */ } /* H5C_incr__threshold */ + switch ( config_ptr->flash_incr_mode ) + { + case H5C_flash_incr__off: + /* nothing to do here */ + break; + + case H5C_flash_incr__add_space: + if ( ( config_ptr->flash_multiple < 0.1 ) || + ( config_ptr->flash_multiple > 10.0 ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "flash_multiple must be in the range [0.1, 10.0]"); + } + + if ( ( config_ptr->flash_threshold < 0.1 ) || + ( config_ptr->flash_threshold > 1.0 ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "flash_threshold must be in the range [0.1, 1.0]"); + } + break; + + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "Invalid flash_incr_mode"); + break; + } } /* H5C_RESIZE_CFG__VALIDATE_INCREMENT */ @@ -7707,6 +7942,9 @@ done: * reduction, and to adjust to changes in the * H5C_auto_size_ctl_t structure. * + * JRM -- 1/5/08 + * Added support for flash cache size increases. + * *------------------------------------------------------------------------- */ @@ -7990,6 +8228,30 @@ H5C__auto_adjust_cache_size(H5C_t * cache_ptr, cache_ptr->size_decreased = TRUE; } + + /* update flash cache size increase fields as appropriate */ + if ( cache_ptr->flash_size_increase_possible ) { + + switch ( (cache_ptr->resize_ctl).flash_incr_mode ) + { + case H5C_flash_incr__off: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "flash_size_increase_possible but H5C_flash_incr__off?!") + break; + + case H5C_flash_incr__add_space: + cache_ptr->flash_size_increase_threshold = + (size_t) + (((double)(cache_ptr->max_cache_size)) * + ((cache_ptr->resize_ctl).flash_threshold)); + break; + + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "Unknown flash_incr_mode?!?!?.") + break; + } + } } if ( (cache_ptr->resize_ctl).rpt_fcn != NULL ) { @@ -8741,6 +9003,177 @@ done: } /* H5C__autoadjust__ageout__remove_excess_markers() */ +/*------------------------------------------------------------------------- + * + * Function: H5C__flash_increase_cache_size + * + * Purpose: If there is not at least new_entry_size - old_entry_size + * bytes of free space in the cache and the current + * max_cache_size is less than (cache_ptr->resize_ctl).max_size, + * perform a flash increase in the cache size and then reset + * the full cache hit rate statistics, and exit. + * + * Return: Non-negative on success/Negative on failure. + * + * Programmer: John Mainzer, 12/31/07 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +static herr_t +H5C__flash_increase_cache_size(H5C_t * cache_ptr, + size_t old_entry_size, + size_t new_entry_size) +{ + const char * fcn_name = "H5C__flash_increase_cache_size()"; + herr_t ret_value = SUCCEED; /* Return value */ + size_t new_max_cache_size = 0; + size_t old_max_cache_size = 0; + size_t new_min_clean_size = 0; + size_t old_min_clean_size = 0; + size_t space_needed; + enum H5C_resize_status status = flash_increase; /* may change */ + double hit_rate; + + FUNC_ENTER_NOAPI_NOINIT(H5C__flash_increase_cache_size) +#if 0 + HDfprintf(stdout, "%s: old = %ld, new = %ld.\n", fcn_name, + (long)old_entry_size, (long)new_entry_size); +#endif + HDassert( cache_ptr ); + HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + HDassert( cache_ptr->flash_size_increase_possible ); + HDassert( new_entry_size > cache_ptr->flash_size_increase_threshold ); + HDassert( old_entry_size < new_entry_size ); + + if ( old_entry_size >= new_entry_size ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "old_entry_size >= new_entry_size") + } + + space_needed = new_entry_size - old_entry_size; + + if ( ( (cache_ptr->index_size + space_needed) > + cache_ptr->max_cache_size ) && + ( cache_ptr->max_cache_size < (cache_ptr->resize_ctl).max_size ) ) { + + /* we have work to do */ + + switch ( (cache_ptr->resize_ctl).flash_incr_mode ) + { + case H5C_flash_incr__off: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "flash_size_increase_possible but H5C_flash_incr__off?!") + break; + + case H5C_flash_incr__add_space: + if ( cache_ptr->index_size < cache_ptr->max_cache_size ) { + + HDassert( (cache_ptr->max_cache_size - cache_ptr->index_size) + < space_needed ); + space_needed -= cache_ptr->max_cache_size - cache_ptr->index_size; + } + space_needed = + (size_t)(((double)space_needed) * + (cache_ptr->resize_ctl).flash_multiple); + + new_max_cache_size = cache_ptr->max_cache_size + space_needed; + + break; + + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "Unknown flash_incr_mode?!?!?.") + break; + } + + if ( new_max_cache_size > (cache_ptr->resize_ctl).max_size ) { + + new_max_cache_size = (cache_ptr->resize_ctl).max_size; + } + + HDassert( new_max_cache_size > cache_ptr->max_cache_size ); + + new_min_clean_size = (size_t) + ((double)new_max_cache_size * + ((cache_ptr->resize_ctl).min_clean_fraction)); + + HDassert( new_min_clean_size <= new_max_cache_size ); + + old_max_cache_size = cache_ptr->max_cache_size; + old_min_clean_size = cache_ptr->min_clean_size; + + cache_ptr->max_cache_size = new_max_cache_size; + cache_ptr->min_clean_size = new_min_clean_size; + + /* update flash cache size increase fields as appropriate */ + HDassert ( cache_ptr->flash_size_increase_possible ); + + switch ( (cache_ptr->resize_ctl).flash_incr_mode ) + { + case H5C_flash_incr__off: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "flash_size_increase_possible but H5C_flash_incr__off?!") + break; + + case H5C_flash_incr__add_space: + cache_ptr->flash_size_increase_threshold = + (size_t) + (((double)(cache_ptr->max_cache_size)) * + ((cache_ptr->resize_ctl).flash_threshold)); + break; + + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "Unknown flash_incr_mode?!?!?.") + break; + } + + /* note that we don't cycle the epoch markers. We can + * argue either way as to whether we should, but for now + * we don't. + */ + + if ( (cache_ptr->resize_ctl).rpt_fcn != NULL ) { + + /* get the hit rate for the reporting function. Should still + * be good as we havent reset the hit rate statistics. + */ + if ( H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate.") + } + + (*((cache_ptr->resize_ctl).rpt_fcn)) + (cache_ptr, + H5C__CURR_AUTO_RESIZE_RPT_FCN_VER, + hit_rate, + status, + old_max_cache_size, + new_max_cache_size, + old_min_clean_size, + new_min_clean_size); + } + + if ( H5C_reset_cache_hit_rate_stats(cache_ptr) != SUCCEED ) { + + /* this should be impossible... */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "H5C_reset_cache_hit_rate_stats failed.") + } + } + +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5C__flash_increase_cache_size() */ + /*------------------------------------------------------------------------- * Function: H5C_flush_invalidate_cache diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 949f923..7c04ea2 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -465,6 +465,18 @@ * all the ways this can happen, we simply set this flag when * we receive a new configuration. * + * flash_size_increase_possible: Depending on the configuration data given + * in the resize_ctl field, it may or may not be possible + * for a flash size increase to occur. We set this flag + * whenever we receive a new configuration so as to avoid + * repeated calculations. + * + * flash_size_increase_threshold: If a flash cache size increase is possible, + * this field is used to store the minimum size of a new entry + * or size increase needed to trigger a flash cache size + * increase. Note that this field must be updated whenever + * the size of the cache is changed. + * * size_decrease_possible: Depending on the configuration data given * in the resize_ctl field, it may or may not be possible * to decrease the size of the cache. Rather than test for @@ -580,10 +592,10 @@ * equal to the array index has not been in cache when * requested in the current epoch. * - * write_protects: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the number of times an entry with type id - * equal to the array index has been write protected in the - * current epoch. + * write_protects: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The + * cells are used to record the number of times an entry with + * type id equal to the array index has been write protected + * in the current epoch. * * Observe that (hits + misses) = (write_protects + read_protects). * @@ -855,6 +867,8 @@ struct H5C_t H5C_cache_entry_t * dLRU_tail_ptr; hbool_t size_increase_possible; + hbool_t flash_size_increase_possible; + size_t flash_size_increase_threshold; hbool_t size_decrease_possible; hbool_t resize_enabled; hbool_t cache_full; diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index d365755..10585a3 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -37,7 +37,7 @@ #include "H5Fprivate.h" /* File access */ -#define H5C_DO_SANITY_CHECKS 0 +#define H5C_DO_SANITY_CHECKS 1 #define H5C_DO_EXTREME_SANITY_CHECKS 0 /* This sanity checking constant was picked out of the air. Increase @@ -51,7 +51,7 @@ /* H5C_COLLECT_CACHE_STATS controls overall collection of statistics * on cache activity. In general, this #define should be set to 0. */ -#define H5C_COLLECT_CACHE_STATS 0 +#define H5C_COLLECT_CACHE_STATS 1 /* H5C_COLLECT_CACHE_ENTRY_STATS controls collection of statistics * in individual cache entries. @@ -587,7 +587,58 @@ typedef struct H5C_cache_entry_t * above, this field contains the maximum number of bytes by which the * cache size can be increased in a single re-size. * - * + * flash_incr_mode: Instance of the H5C_cache_flash_incr_mode enumerated + * type whose value indicates whether and by what algorithm we should + * make flash increases in the size of the cache to accomodate insertion + * of large entries and large increases in the size of a single entry. + * + * The addition of the flash increment mode was occasioned by performance + * problems that appear when a local heap is increased to a size in excess + * of the current cache size. While the existing re-size code dealt with + * this eventually, performance was very bad for the remainder of the + * epoch. + * + * At present, there are two possible values for the flash_incr_mode: + * + * H5C_flash_incr__off: Don't perform flash increases in the size of + * the cache. + * + * H5C_flash_incr__add_space: Let x be either the size of a newly + * newly inserted entry, or the number of bytes by which the + * size of an existing entry has been increased. + * + * If + * x > flash_threshold * current max cache size, + * + * increase the current maximum cache size by x * flash_multiple + * less any free space in the cache, and start a new epoch. For + * now at least, pay no attention to the maximum increment. + * + * + * With a little thought, it should be obvious that the above flash + * cache size increase algorithm is not sufficient for all circumstances -- + * for example, suppose the user round robins through + * (1/flash_threshold) +1 groups, adding one data set to each on each + * pass. Then all will increase in size at about the same time, requiring + * the max cache size to at least double to maintain acceptable + * performance, however the above flash increment algorithm will not be + * triggered. + * + * Hopefully, the add space algorithm detailed above will be sufficient + * for the performance problems encountered to date. However, we should + * expect to revisit the issue. + * + * flash_multiple: Double containing the multiple described above in the + * H5C_flash_incr__add_space section of the discussion of the + * flash_incr_mode section. This field is ignored unless flash_incr_mode + * is H5C_flash_incr__add_space. + * + * flash_threshold: Double containing the factor by which current max cache size + * is multiplied to obtain the size threshold for the add_space flash + * increment algorithm. The field is ignored unless flash_incr_mode is + * H5C_flash_incr__add_space. + * + * * Cache size decrease control fields: * * decr_mode: Instance of the H5C_cache_decr_mode enumerated type whose @@ -701,6 +752,8 @@ typedef struct H5C_cache_entry_t #define H5C__DEF_AR_MIN_CLEAN_FRAC 0.5 #define H5C__DEF_AR_INCREMENT 2.0 #define H5C__DEF_AR_MAX_INCREMENT ((size_t)( 2 * 1024 * 1024)) +#define H5C__DEF_AR_FLASH_MULTIPLE 1.0 +#define H5C__DEV_AR_FLASH_THRESHOLD 0.25 #define H5C__DEF_AR_DECREMENT 0.9 #define H5C__DEF_AR_MAX_DECREMENT ((size_t)( 1 * 1024 * 1024)) #define H5C__DEF_AR_EPCHS_B4_EVICT 3 @@ -713,6 +766,7 @@ enum H5C_resize_status { in_spec, increase, + flash_increase, decrease, at_max_size, at_min_size, @@ -733,45 +787,48 @@ typedef void (*H5C_auto_resize_rpt_fcn)(H5C_t * cache_ptr, typedef struct H5C_auto_size_ctl_t { /* general configuration fields: */ - int32_t version; - H5C_auto_resize_rpt_fcn rpt_fcn; + int32_t version; + H5C_auto_resize_rpt_fcn rpt_fcn; - hbool_t set_initial_size; - size_t initial_size; + hbool_t set_initial_size; + size_t initial_size; - double min_clean_fraction; + double min_clean_fraction; - size_t max_size; - size_t min_size; + size_t max_size; + size_t min_size; - int64_t epoch_length; + int64_t epoch_length; /* size increase control fields: */ - enum H5C_cache_incr_mode incr_mode; + enum H5C_cache_incr_mode incr_mode; - double lower_hr_threshold; + double lower_hr_threshold; - double increment; + double increment; - hbool_t apply_max_increment; - size_t max_increment; + hbool_t apply_max_increment; + size_t max_increment; + enum H5C_cache_flash_incr_mode flash_incr_mode; + double flash_multiple; + double flash_threshold; /* size decrease control fields: */ - enum H5C_cache_decr_mode decr_mode; + enum H5C_cache_decr_mode decr_mode; - double upper_hr_threshold; + double upper_hr_threshold; - double decrement; + double decrement; - hbool_t apply_max_decrement; - size_t max_decrement; + hbool_t apply_max_decrement; + size_t max_decrement; - int32_t epochs_before_eviction; + int32_t epochs_before_eviction; - hbool_t apply_empty_reserve; - double empty_reserve; + hbool_t apply_empty_reserve; + double empty_reserve; } H5C_auto_size_ctl_t; diff --git a/src/H5Cpublic.h b/src/H5Cpublic.h index 082d512..7ef959a 100644 --- a/src/H5Cpublic.h +++ b/src/H5Cpublic.h @@ -41,6 +41,12 @@ enum H5C_cache_incr_mode H5C_incr__threshold }; +enum H5C_cache_flash_incr_mode +{ + H5C_flash_incr__off, + H5C_flash_incr__add_space +}; + enum H5C_cache_decr_mode { H5C_decr__off, diff --git a/src/H5HL.c b/src/H5HL.c index 20cac4e..358816b 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -967,6 +967,9 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * need_more = need_size; new_heap_alloc = heap->heap_alloc + need_more; +#if 0 /* JRM */ /* delete this once we are convinced that the general + * fix will do the job. + */ /* * XXX: This is a _total_ hack, a real kludge. :-/ The metadata cache currently * responds very poorly when an object is inserted into the cache (or @@ -1002,6 +1005,7 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (size_t)-1, "H5AC_set_cache_auto_resize_config() failed.") } /* end if */ } +#endif /* JRM */ HDassert(heap->heap_alloc < new_heap_alloc); H5_CHECK_OVERFLOW(heap->heap_alloc, size_t, hsize_t); H5_CHECK_OVERFLOW(new_heap_alloc, size_t, hsize_t); diff --git a/src/H5O.c b/src/H5O.c index c615437..b5c74ff 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -91,6 +91,11 @@ static herr_t H5O_visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /*********************/ /* Header message ID to class mapping */ + +/* Remember to increment H5O_MSG_TYPES in H5Opkg.h when adding a new + * message. + */ + const H5O_msg_class_t *const H5O_msg_class_g[] = { H5O_MSG_NULL, /*0x0000 Null */ H5O_MSG_SDSPACE, /*0x0001 Dataspace */ @@ -174,6 +179,10 @@ H5FL_EXTERN(H5_obj_t); * Programmer: Quincey Koziol * Thursday, January 18, 2007 * + * Changes: JRM -- 12/12/07 + * Added santity check verifying that H5O_msg_class_g + * is big enough. + * *------------------------------------------------------------------------- */ static herr_t @@ -185,6 +194,8 @@ H5O_init_interface(void) HDassert(H5O_MSG_TYPES == NELMTS(H5O_msg_class_g)); HDassert(sizeof(H5O_fheap_id_t) == H5O_FHEAP_ID_LEN); + HDassert(H5O_UNKNOWN_ID < H5O_MSG_TYPES); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_init_interface() */ diff --git a/test/cache.c b/test/cache.c index a0bc5b1..6ea92ef 100644 --- a/test/cache.c +++ b/test/cache.c @@ -965,6 +965,11 @@ smoke_check_5(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -1200,6 +1205,11 @@ smoke_check_6(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -1435,6 +1445,11 @@ smoke_check_7(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (8 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, @@ -1671,6 +1686,11 @@ smoke_check_8(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, @@ -17295,6 +17315,10 @@ check_check_evictions_enabled_err(void) * * Modifications: * + * John Mainzer 1/8/08 + * Added a basic set of tests for the flash cache size + * increment code. + * *------------------------------------------------------------------------- */ @@ -17304,7 +17328,7 @@ enum H5C_resize_status rpt_status; static void test_rpt_fcn(UNUSED H5C_t * cache_ptr, UNUSED int32_t version, UNUSED double hit_rate, - UNUSED enum H5C_resize_status status, + 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, @@ -17348,6 +17372,11 @@ check_auto_cache_resize(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -17708,7 +17737,7 @@ check_auto_cache_resize(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* the current cache configuration is unconvenient for testing cache + /* the current cache configuration is inconvenient for testing cache * size reduction, so lets change it some something easier to work * with. */ @@ -17738,6 +17767,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1000 * 1000); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -18088,6 +18121,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = FALSE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -18276,6 +18313,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -18699,6 +18740,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -19239,6 +19284,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -19663,6 +19712,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -19929,6 +19982,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -20465,96 +20522,22 @@ check_auto_cache_resize(void) 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); - } - - return; - -} /* 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; + /* now test the flash cache size increment code. At least at present, + * there should be no interaction between the regular auto-resize + * code and the flash cache size increment code other than a reset + * of the counter and stats collection used by the regular auto-resize + * code. Thus we do only limited tests of the two pieces of code + * operating together. + * + * Start with simple test to verify that the flash cache increment + * code increases the cache size when and as expected. + */ 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. + /* allocate a cache, enable the flash cache size increase code, and + * then force the flash size increase code through all its operational + * modes. Verify that all performs as expected. */ if ( pass ) { @@ -20565,36 +20548,11 @@ check_auto_cache_resize_disable(void) (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. - ******************************************************************/ + /* now repeat the above tests using the add space flash cache size + * increment algorithm. + */ if ( pass ) { @@ -20602,795 +20560,844 @@ 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 = 64 * 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 = 1024 * 1024; + auto_size_ctl.min_size = 5 * 1024; - auto_size_ctl.epoch_length = 1000; + auto_size_ctl.epoch_length = 100; auto_size_ctl.incr_mode = H5C_incr__threshold; auto_size_ctl.lower_hr_threshold = 0.75; - auto_size_ctl.increment = 1.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.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (32 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space; + auto_size_ctl.flash_multiple = 1.0; + auto_size_ctl.flash_threshold = 0.5; - auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 0.995; + auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; + + auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */ 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 * 1024); - auto_size_ctl.epochs_before_eviction = 3; + auto_size_ctl.epochs_before_eviction = 1; /* for ease of testing */ 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 2.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 12.\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 != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) || + ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->cache_accesses != 0 ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 1.\n"; + failure_mssg = "Unexpected cache config (0).\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. - */ + /* Load a huge entry into the cache */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, HUGE_ENTRY_TYPE, 0); - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; + if ( pass ) { + unprotect_entry(cache_ptr, HUGE_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); } - 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) ) ) { + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) || + ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != HUGE_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 1.\n"; - } + failure_mssg = "Unexpected cache config (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. + /* Now load a monster entry. Since a monster entry is larger than + * half the size of the cache, and there is not sufficient space + * for a monster entry in the cache, we will add space to the + * cache to make room for the entry. */ 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, 0); - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); } - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (80 * 1024) ) || + ( cache_ptr->min_clean_size != (40 * 1024) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != (HUGE_ENTRY_SIZE + + MONSTER_ENTRY_SIZE) ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 2.\n"; - } + failure_mssg = "Unexpected cache config (2).\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. + /* Load a second moster entry. Since the monster entry is larger + * than half the size of the cache yet again, and there is not + * sufficient space for the monster entry in the cache, we again + * add space to the cache to make space for the entry. */ if ( pass ) { - 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, 1); - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 1, + NO_CHANGE, H5C__NO_FLAGS_SET); - 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) ) ) { + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (144 * 1024) ) || + ( cache_ptr->min_clean_size != ( 72 * 1024) ) || + ( cache_ptr->index_len != 3 ) || + ( cache_ptr->index_size != ((2 * MONSTER_ENTRY_SIZE) + + HUGE_ENTRY_SIZE) ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 3.\n"; - } + failure_mssg = "Unexpected cache config (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. + /* Load a third moster entry. Should be no cache size increase this + * time. */ - if ( pass ) { - auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - auto_size_ctl.rpt_fcn = test_rpt_fcn; + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 2); - auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 4 * 1024 * 1024; + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 2, + NO_CHANGE, H5C__NO_FLAGS_SET); - auto_size_ctl.min_clean_fraction = 0.5; + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (144 * 1024) ) || + ( cache_ptr->min_clean_size != ( 72 * 1024) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != (2 * MONSTER_ENTRY_SIZE) ) || + ( cache_ptr->cache_accesses != 2 ) ) ) ) { - auto_size_ctl.max_size = 16 * 1024 * 1024; - auto_size_ctl.min_size = 1 * 1024 * 1024; + pass = FALSE; + failure_mssg = "Unexpected cache config (4).\n"; + } + } - auto_size_ctl.epoch_length = 1000; + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* delete existing entries to prepare for next test, and reset + * the size of the cache. + */ + if ( pass ) { - auto_size_ctl.incr_mode = H5C_incr__threshold; + expunge_entry(cache_ptr, MONSTER_ENTRY_TYPE, 1); + expunge_entry(cache_ptr, MONSTER_ENTRY_TYPE, 2); - auto_size_ctl.lower_hr_threshold = 0.0; /* disable size increases */ + if ( pass ) { - auto_size_ctl.increment = 2.0; + result = H5C_set_cache_auto_resize_config(cache_ptr, + &auto_size_ctl); - auto_size_ctl.apply_max_increment = FALSE; - auto_size_ctl.max_increment = (4 * 1024 * 1024); + if ( result != SUCCEED ) { + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 13.\n"; + } + } - auto_size_ctl.decr_mode = H5C_decr__threshold; + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) || + ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { - auto_size_ctl.upper_hr_threshold = 0.995; + pass = FALSE; + failure_mssg = "Unexpected cache config (5).\n"; + } + } - auto_size_ctl.decrement = 0.5; + /* repeat the above basic test, only this time, use inserts to add + * entries to the cache, not protects. + */ - 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 ) { - - pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 3.\n"; - } - } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* insert a huge entry into the cache */ if ( pass ) { - if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + insert_entry(cache_ptr, HUGE_ENTRY_TYPE, 1, TRUE, + H5C__NO_FLAGS_SET); + /* protect and unprotect a couple times to increment cache_accesses */ + protect_entry(cache_ptr, HUGE_ENTRY_TYPE, 1); + unprotect_entry(cache_ptr, HUGE_ENTRY_TYPE, 1, + NO_CHANGE, H5C__NO_FLAGS_SET); + protect_entry(cache_ptr, HUGE_ENTRY_TYPE, 1); + unprotect_entry(cache_ptr, HUGE_ENTRY_TYPE, 1, + NO_CHANGE, H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) || + ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != HUGE_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 2 ) ) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 2.\n"; - } + failure_mssg = "Unexpected cache config (6).\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. + /* Now insert a monster entry. Since a monster entry is larger than + * half the size of the cache, and there is not sufficient space + * for a monster entry in the cache, we will add space to the + * cache to make room for the entry. */ 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++; - } + insert_entry(cache_ptr, MONSTER_ENTRY_TYPE, 4, TRUE, + H5C__NO_FLAGS_SET); - 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) ) ) { + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (80 * 1024) ) || + ( cache_ptr->min_clean_size != (40 * 1024) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != + HUGE_ENTRY_SIZE + MONSTER_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 4.\n"; - } + failure_mssg = "Unexpected cache config (7).\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. + /* Insert a second monster entry. Cache size should increase again. */ 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++; - } + insert_entry(cache_ptr, MONSTER_ENTRY_TYPE, 5, TRUE, + H5C__NO_FLAGS_SET); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease ) || - ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (144 * 1024) ) || + ( cache_ptr->min_clean_size != ( 72 * 1024) ) || + ( cache_ptr->index_len != 3 ) || + ( cache_ptr->index_size != + 2 * MONSTER_ENTRY_SIZE + HUGE_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 5.\n"; - } + failure_mssg = "Unexpected cache config (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. + /* Insert a third monster entry. Should be no cache size increase this + * time. */ if ( pass ) { - 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, 6); - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 6, + NO_CHANGE, H5C__NO_FLAGS_SET); - 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) ) ) { + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (144 * 1024) ) || + ( cache_ptr->min_clean_size != ( 72 * 1024) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != (2 * MONSTER_ENTRY_SIZE) ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 6.\n"; - } + failure_mssg = "Unexpected cache config (9).\n"; + } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Repeat the above tests yet again, disabling increase through the - * incr_mode. - */ - + /* delete existing entries to prepare for next test, and reset + * the size of the cache. We must also change the size of the needed + * variable entries before we run the test, so will protect and + * unprotect them now so as to get the correct initial size. + */ if ( pass ) { - auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; - auto_size_ctl.rpt_fcn = test_rpt_fcn; + expunge_entry(cache_ptr, MONSTER_ENTRY_TYPE, 5); + expunge_entry(cache_ptr, MONSTER_ENTRY_TYPE, 6); - auto_size_ctl.set_initial_size = TRUE; - auto_size_ctl.initial_size = 4 * 1024 * 1024; + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1024); - auto_size_ctl.min_clean_fraction = 0.5; + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 11, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1024); - auto_size_ctl.max_size = 16 * 1024 * 1024; - auto_size_ctl.min_size = 1 * 1024 * 1024; + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 12, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1024); - auto_size_ctl.epoch_length = 1000; + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 13); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 13, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1024); + flush_cache(cache_ptr, TRUE, FALSE, FALSE); - auto_size_ctl.incr_mode = H5C_incr__off; - auto_size_ctl.lower_hr_threshold = 0.75; + if ( pass ) { - auto_size_ctl.increment = 2.0; + auto_size_ctl.initial_size = 6 * 1024; + result = H5C_set_cache_auto_resize_config(cache_ptr, + &auto_size_ctl); - auto_size_ctl.apply_max_increment = FALSE; - auto_size_ctl.max_increment = (4 * 1024 * 1024); + if ( result != SUCCEED ) { + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 13.\n"; + } + } - auto_size_ctl.decr_mode = H5C_decr__threshold; + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024) ) || + ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { - auto_size_ctl.upper_hr_threshold = 0.995; + pass = FALSE; + failure_mssg = "Unexpected cache config (10).\n"; + } + } - auto_size_ctl.decrement = 0.5; + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - auto_size_ctl.apply_max_decrement = FALSE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); + /* Now load the variable entries into the cache */ + if ( pass ) { - auto_size_ctl.epochs_before_eviction = 3; + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + H5C__NO_FLAGS_SET); - auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05; + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + H5C__NO_FLAGS_SET); - result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + H5C__NO_FLAGS_SET); - if ( result != SUCCEED ) { + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 13); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 13, NO_CHANGE, + H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 4 * 1024 ) || + ( cache_ptr->cache_accesses != 4 ) ) ) ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 4.\n"; - } + failure_mssg = "Unexpected cache config (11).\n"; + } } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* protect a variable entry, and re-size it to 3K. Should be + * no effect on the size of the cache. + */ if ( pass ) { - if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 3 * 1024); + + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 6 * 1024 ) || + ( cache_ptr->cache_accesses != 5 ) ) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 3.\n"; - } + failure_mssg = "Unexpected cache config (12).\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. + /* protect the variable entry again, and re-size it to 10K. Should + * resize the cache to 13 KB. Note that cache_accesses will be 0 + * in this case, since cache_accesses is incremented on the protect. */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 10 * 1024); - 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 != in_spec ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (13 * 1024) ) || + ( cache_ptr->min_clean_size != (13 * 512) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 13 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 7.\n"; - } + failure_mssg = "Unexpected cache config (13).\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. + /* protect a second variable entry, and re-size it to 10K. Should + * resize to 22 KB. */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 11, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 10 * 1024); - 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 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 22 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 8.\n"; - } + failure_mssg = "Unexpected cache config (14).\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. + /* protect a third variable entry, and re-size it to 10K. Should + * be no change in cache size. */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 12, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 10 * 1024); - 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 != in_spec ) || - ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 31 * 1024 ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 9.\n"; - } + failure_mssg = "Unexpected cache config (15).\n"; + } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Now, disable size decreases, and repeat the above tests. + /* re-size the variable entries back down to their initial size, and + * restore the cache to its initial size as well, in preparation + * for the next test. */ - 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; + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1 * 1024); + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 11, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1 * 1024); + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 12, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1 * 1024); - auto_size_ctl.epoch_length = 1000; + if ( pass ) { + auto_size_ctl.initial_size = 6 * 1024; + result = H5C_set_cache_auto_resize_config(cache_ptr, + &auto_size_ctl); - auto_size_ctl.incr_mode = H5C_incr__threshold; + if ( result != SUCCEED ) { - auto_size_ctl.lower_hr_threshold = 0.75; + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 14.\n"; + } + } - auto_size_ctl.increment = 2.0; + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 4 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { - auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (2 * 1024 * 1024); + pass = FALSE; + failure_mssg = "Unexpected cache config (16).\n"; + } + } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - auto_size_ctl.decr_mode = H5C_decr__threshold; + /* Now test flash cache resizes with pinned entries... + */ + if ( pass ) { - auto_size_ctl.upper_hr_threshold = 0.995; + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + H5C__PIN_ENTRY_FLAG); + resize_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024, TRUE); - auto_size_ctl.decrement = 1.0; /* disable size decreases */ + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (6 * 512) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 5 * 1024 ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { - auto_size_ctl.apply_max_decrement = TRUE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); + pass = FALSE; + failure_mssg = "Unexpected cache config (17).\n"; + } + } - auto_size_ctl.epochs_before_eviction = 3; + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - 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); + resize_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 10 * 1024, TRUE); - if ( result != SUCCEED ) { + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (13 * 1024) ) || + ( cache_ptr->min_clean_size != (13 * 512) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 13 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 5.\n"; - } + failure_mssg = "Unexpected cache config (18).\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) ) ) { + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + H5C__PIN_ENTRY_FLAG); + resize_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024, TRUE); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 22 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 4.\n"; - } + failure_mssg = "Unexpected cache config (19).\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. - */ 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++; - } + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + H5C__PIN_ENTRY_FLAG); + resize_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024, TRUE); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease_disabled ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 31 * 1024 ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 10.\n"; - } + failure_mssg = "Unexpected cache config (20).\n"; + } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate -- cache size should increase from 4 to 6 Meg. + /* Unpin the entries. Note that no entries are evicted as we don't + * load any entries. */ 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 11.\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 ) { + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + H5C__UNPIN_ENTRY_FLAG); - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + H5C__UNPIN_ENTRY_FLAG); - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + H5C__UNPIN_ENTRY_FLAG); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != decrease_disabled ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 31 * 1024 ) || + ( cache_ptr->cache_accesses != 4 ) ) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 12.\n"; - } + failure_mssg = "Unexpected cache config (21).\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. + /* re-size the variable entries back down to their initial size, and + * restore the cache to its initial size as well, in preparation + * for the next test. */ - 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; + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1 * 1024); + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 11, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1 * 1024); + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 12, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1 * 1024); + if ( pass ) { - auto_size_ctl.incr_mode = H5C_incr__threshold; + auto_size_ctl.initial_size = 6 * 1024; + result = H5C_set_cache_auto_resize_config(cache_ptr, + &auto_size_ctl); - auto_size_ctl.lower_hr_threshold = 0.75; + if ( result != SUCCEED ) { - auto_size_ctl.increment = 2.0; + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 15.\n"; + } + } - auto_size_ctl.apply_max_increment = TRUE; - auto_size_ctl.max_increment = (2 * 1024 * 1024); + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 4 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + pass = FALSE; + failure_mssg = "Unexpected cache config (22).\n"; + } + } - auto_size_ctl.decr_mode = H5C_decr__threshold; + if ( pass ) { - auto_size_ctl.upper_hr_threshold = 1.0; /* disable size decreases */ + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + H5C__PIN_ENTRY_FLAG); + resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024); - auto_size_ctl.decrement = 0.5; + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (6 * 512) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 5 * 1024 ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { - auto_size_ctl.apply_max_decrement = TRUE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); + pass = FALSE; + failure_mssg = "Unexpected cache config (23).\n"; + } + } - auto_size_ctl.epochs_before_eviction = 3; + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - 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); + resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 10 * 1024); - if ( result != SUCCEED ) { + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (13 * 1024) ) || + ( cache_ptr->min_clean_size != (13 * 512) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 13 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 6.\n"; - } + failure_mssg = "Unexpected cache config (24).\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) ) ) { + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + H5C__PIN_ENTRY_FLAG); + resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 22 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 5.\n"; - } + failure_mssg = "Unexpected cache config (25).\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 ) { - 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++; - } + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + H5C__PIN_ENTRY_FLAG); + resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024); - 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) ) ) { + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 31 * 1024 ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 13.\n"; - } + failure_mssg = "Unexpected cache config (26).\n"; + } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate -- cache size should increase from 4 to 6 Meg. + /* Unpin the entries. Note that no entries are evicted as we don't + * load any entries. */ if ( pass ) { - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + H5C__UNPIN_ENTRY_FLAG); - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, - NO_CHANGE, H5C__NO_FLAGS_SET); - } - i++; - } + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + H5C__UNPIN_ENTRY_FLAG); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != increase ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + H5C__UNPIN_ENTRY_FLAG); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 31 * 1024 ) || + ( cache_ptr->cache_accesses != 4 ) ) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 14.\n"; - } + failure_mssg = "Unexpected cache config (27).\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. + /* We have finished a basic check of the flash cache size increment + * code. Tidy up for a more extensive 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++; - } + expunge_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + expunge_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + expunge_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + expunge_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 13); - 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) ) ) { + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->cache_accesses != 4 ) ) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 15.\n"; - } + failure_mssg = "Unexpected cache config (28).\n"; + } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Repeat the above tests, disabling decrease through the decr_mode. + /* ...and then reconfigure. Note that we change the flash_multiple + * and flash_threshold just to make sure that such changed perform + * as expected. */ - 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.initial_size = 4 * 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 = 20 * 1024; + auto_size_ctl.min_size = 4 * 1024; - auto_size_ctl.epoch_length = 1000; + auto_size_ctl.epoch_length = 100; auto_size_ctl.incr_mode = H5C_incr__threshold; @@ -21400,106 +21407,137 @@ 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); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.4; - auto_size_ctl.decr_mode = H5C_decr__off; - auto_size_ctl.upper_hr_threshold = 0.995; + auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; + + 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 = (2 * 1024); - auto_size_ctl.epochs_before_eviction = 3; + auto_size_ctl.epochs_before_eviction = 1; /* for ease of testing */ 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 7.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 15.\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 != (4 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 512) ) || + ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->cache_accesses != 0 ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 6.\n"; + failure_mssg = "bad cache after initialization 15.\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. + /* protect and unprotect a large entry -- no change in cache size since + * a large entry will just fill the available space in the cache. */ 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++; - } + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0, NO_CHANGE, + H5C__NO_FLAGS_SET); - 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) ) ) { + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (4 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 512) ) || + ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != LARGE_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 1 ) || + ( rpt_fcn_called == TRUE ) ) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 16.\n"; - } + failure_mssg = "Unexpected cache config (29).\n"; + } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate -- cache size should increase from 4 to 6 Meg. + /* protect and unprotect another a large entry -- should trigger a + * flash cache size increase to 12 KB (remember that flash_multiple is + * set to 2.0). */ 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++; - } + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 1); + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 1, NO_CHANGE, + H5C__NO_FLAGS_SET); - if ( ( ! rpt_fcn_called ) || - ( rpt_status != increase ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (12 * 1024) ) || + ( cache_ptr->min_clean_size != (12 * 512) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != 2 * LARGE_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 1 ) || + ( rpt_fcn_called != TRUE ) ) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 17.\n"; - } + failure_mssg = "Unexpected cache config (30).\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. + /* protect and unprotect two more large entries -- shouldnt trigger a + * flash cache size increase. + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 2); + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 2, NO_CHANGE, + H5C__NO_FLAGS_SET); + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3); + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3, NO_CHANGE, + H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (12 * 1024) ) || + ( cache_ptr->min_clean_size != (12 * 512) ) || + ( cache_ptr->index_len != 3 ) || + ( cache_ptr->index_size != 3 * LARGE_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 3 ) || + ( rpt_fcn_called != FALSE ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (31).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* do many accesses of a single entry to talk the cache into reducing + * its size to the minimum. */ if ( pass ) { @@ -21507,35 +21545,229 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(cache_ptr, TINY_ENTRY_TYPE, 0); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(cache_ptr, TINY_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) ) ) { + ( cache_ptr->max_cache_size != (4 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024) ) || + ( cache_ptr->index_size != (1 * TINY_ENTRY_SIZE) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 18.\n"; + failure_mssg = "Unexpected cache config (32).\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Now do tests disabling size decrement in age out mode. - * - * Start by disabling size decrement by setting max_decrement to zero. + /* Force another flash increase */ + if ( pass ) { + + rpt_fcn_called = FALSE; + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0, NO_CHANGE, + H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (4 * 1024 + 128) ) || + ( cache_ptr->min_clean_size != (2 * 1024 + 64) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != + LARGE_ENTRY_SIZE + TINY_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 1 ) || + ( rpt_fcn_called == FALSE ) || + ( rpt_status != flash_increase ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (33).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* force regular size increase up to maximum */ + if ( pass ) { + + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 500 ) ) + { + protect_entry(cache_ptr, TINY_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, TINY_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( cache_ptr->max_cache_size != (20 * 1024) ) || + ( cache_ptr->min_clean_size != (10 * 1024) ) || + ( rpt_fcn_called == FALSE ) || + ( rpt_status != at_max_size ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (34).\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); + } + + return; + +} /* 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: + * + * Added code to include the flash cache size increment + * code in this test. + * JRM -- 1/10/08 + * + *------------------------------------------------------------------------- + */ + +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_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 1.0, + /* double flash_threshold = */ 0.25, + + + /* 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 ) { + auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; auto_size_ctl.rpt_fcn = test_rpt_fcn; @@ -21554,22 +21786,26 @@ check_auto_cache_resize_disable(void) 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.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; - auto_size_ctl.decr_mode = H5C_decr__age_out; + + 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 = 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 = 3; auto_size_ctl.apply_empty_reserve = TRUE; auto_size_ctl.empty_reserve = 0.05; @@ -21579,7 +21815,7 @@ 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 2.\n"; } } @@ -21589,19 +21825,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 7.\n"; + failure_mssg = "bad cache size after set resize re-config 1.\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. + /* 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 ) { @@ -21609,91 +21840,60 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_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->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 19.\n"; + failure_mssg = "Unexpected cache size change results 1.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Load up some more small entries. + /* 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 ) { 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, 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 ) || - ( 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 20.\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. - */ - if ( pass ) { - - 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) ) ) { + ( 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 21.\n"; + failure_mssg = "Unexpected cache size change results 2.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate -- cache size should increase from 4 to 6 Meg. + /* force low hit rate again -- increase disabled so should + * be no change in cache size, and result should be increase_disabled. */ if ( pass ) { @@ -21711,51 +21911,20 @@ check_auto_cache_resize_disable(void) } 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 22.\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. - */ - 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->size_decrease_possible ) || - ( rpt_status != decrease_disabled ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + ( 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) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 23.\n"; + failure_mssg = "Unexpected cache size change results 3.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Now disable size decrement in age out mode via the empty reserve. + /* Repeat the above tests, disabling increase through the lower + * threshold instead of the increment. */ if ( pass ) { @@ -21776,34 +21945,38 @@ check_auto_cache_resize_disable(void) 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 = 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.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; - auto_size_ctl.decr_mode = H5C_decr__age_out; + + 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 = TRUE; + 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 = 3; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 1.0; /* disable decrement */ + 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 9.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 3.\n"; } } @@ -21813,19 +21986,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 8.\n"; + failure_mssg = "bad cache size after set resize re-config 2.\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. + /* 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 ) { @@ -21833,61 +22001,30 @@ check_auto_cache_resize_disable(void) 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 cache size change results 24.\n"; - } - } - - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* Load up some more small entries. - */ - if ( pass ) { - - rpt_fcn_called = FALSE; - i = 1000; - while ( ( pass ) && ( i < 2000 ) ) - { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_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->size_increase_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 25.\n"; + failure_mssg = "Unexpected cache size change results 4.\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. + /* 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 ) { @@ -21895,29 +22032,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, 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 ) || - ( 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 != 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 26.\n"; + failure_mssg = "Unexpected cache size change results 5.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate -- cache size should increase from 4 to 6 Meg. + /* force low hit rate again -- increase disabled so should + * be no change in cache size, and result should be increase_disabled. */ if ( pass ) { @@ -21935,58 +22072,20 @@ check_auto_cache_resize_disable(void) } 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 27.\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. - */ - 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->size_decrease_possible ) || - ( rpt_status != decrease_disabled ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + ( 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) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 28.\n"; + failure_mssg = "Unexpected cache size change results 6.\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. + /* Repeat the above tests yet again, disabling increase through the + * incr_mode. */ if ( pass ) { @@ -22005,26 +22104,30 @@ check_auto_cache_resize_disable(void) 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.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; - auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; - auto_size_ctl.upper_hr_threshold = 1.0; + 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 = TRUE; + 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 = 3; auto_size_ctl.apply_empty_reserve = TRUE; auto_size_ctl.empty_reserve = 0.05; @@ -22034,7 +22137,7 @@ check_auto_cache_resize_disable(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 10.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 4.\n"; } } @@ -22044,19 +22147,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 9.\n"; + failure_mssg = "bad cache size after set resize re-config 3.\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. + /* 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 ) { @@ -22064,63 +22162,30 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); + protect_entry(cache_ptr, MONSTER_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 29.\n"; - } - } - - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - /* Load up some more small entries. - */ - if ( pass ) { - - 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, + unprotect_entry(cache_ptr, MONSTER_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->size_increase_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 30.\n"; + failure_mssg = "Unexpected cache size change results 7.\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. + /* 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 ) { @@ -22128,31 +22193,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, 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 ) || - ( 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 != (2 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 31.\n"; + failure_mssg = "Unexpected cache size change results 8.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* force low hit rate -- cache size should increase from 4 to 6 Meg. + /* force low hit rate again -- increase disabled so should + * be no change in cache size, and result should be increase_disabled. */ if ( pass ) { @@ -22170,59 +22233,20 @@ check_auto_cache_resize_disable(void) } if ( ( ! rpt_fcn_called ) || - ( rpt_status != increase ) || - ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { + ( 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) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 32.\n"; + failure_mssg = "Unexpected cache size change results 9.\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. + /* Now, disable size decreases, and repeat the above tests. */ - if ( pass ) { - - rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) - { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 999); - - if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 999, - 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 cache size change results 33.\n"; - } - } - - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - - /********************************************************************* - * 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 ) { @@ -22230,31 +22254,35 @@ 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.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + 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.decrement = 1.0; /* disable size decreases */ auto_size_ctl.apply_max_decrement = TRUE; auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -22269,24 +22297,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 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 != (2 * 1024 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "bad cache size after set resize re-config 4.\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. + */ if ( pass ) { - if ( ( cache_ptr->max_cache_size != (2 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 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 ) || + ( rpt_status != decrease_disabled ) || + ( 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 = "Unexpected cache size change results 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. + /* force low hit rate -- cache size should increase from 4 to 6 Meg. */ if ( pass ) { @@ -22303,22 +22362,20 @@ 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 != (2 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 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 = "Unexpected cache size change results 34.\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 ) { @@ -22335,20 +22392,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 != (2 * 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 35.\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; @@ -22357,10 +22416,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; @@ -22369,17 +22428,21 @@ 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); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + 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); @@ -22394,24 +22457,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 6.\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 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 ) { @@ -22419,31 +22482,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 ) || + 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 != (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 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 ) { @@ -22451,41 +22512,73 @@ 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 ) || - ( 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 != 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 37.\n"; + 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 ) { + + 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 = "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; 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; @@ -22499,8 +22592,12 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; - auto_size_ctl.decr_mode = H5C_decr__threshold; + + auto_size_ctl.decr_mode = H5C_decr__off; auto_size_ctl.upper_hr_threshold = 0.995; @@ -22519,24 +22616,54 @@ 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 7.\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 6.\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 ) { + + 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 != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + + pass = FALSE; + 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 ) { @@ -22553,22 +22680,20 @@ 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 ) || + 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 38.\n"; + failure_mssg = "Unexpected cache size change results 17.\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 in_spec. */ if ( pass ) { @@ -22585,20 +22710,24 @@ 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 != (6 * 1024 * 1024) ) || ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 39.\n"; + failure_mssg = "Unexpected cache size change results 18.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* Now do tests disabling size decrement in age out mode. + * + * Start by disabling size decrement by setting max_decrement to zero. + */ + if ( pass ) { auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; @@ -22607,10 +22736,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; @@ -22619,22 +22748,26 @@ 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); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; - auto_size_ctl.decr_mode = H5C_decr__threshold; - auto_size_ctl.upper_hr_threshold = 1.0; /* disable size decrement */ + 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 = TRUE; - auto_size_ctl.max_decrement = (1 * 1024 * 1024); + auto_size_ctl.max_decrement = 0; /* disable decrement */ - auto_size_ctl.epochs_before_eviction = 3; + auto_size_ctl.epochs_before_eviction = 1; auto_size_ctl.apply_empty_reserve = TRUE; auto_size_ctl.empty_reserve = 0.05; @@ -22644,24 +22777,29 @@ 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 8.\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 13.\n"; + failure_mssg = "bad cache size after set resize re-config 7.\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. + /* 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 ) { @@ -22669,125 +22807,61 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, 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 != not_full ) || ( 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 40.\n"; + failure_mssg = "Unexpected cache size change results 19.\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. + /* Load up some more small entries. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 1000; + while ( ( pass ) && ( i < 2000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, 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 != not_full ) || ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { - - pass = FALSE; - failure_mssg = "Unexpected cache size change results 41.\n"; - } - } - - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - - 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 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.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.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 ) { - - pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 15.\n"; - } - } - - 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 14.\n"; + failure_mssg = "Unexpected cache size change results 20.\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. + /* 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 ) { @@ -22795,31 +22869,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, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, 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 != 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 42.\n"; + failure_mssg = "Unexpected cache size change results 21.\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 ) { @@ -22827,29 +22899,63 @@ 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 ) || - ( cache_ptr->size_increase_possible ) || + 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 22.\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. + */ + 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->size_decrease_possible ) || - ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || - ( cache_ptr->min_clean_size != (2 * 1024 * 1024) ) ) { + ( 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 43.\n"; + failure_mssg = "Unexpected cache size change results 23.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* Now disable size decrement in age out mode via the empty reserve. + */ + if ( pass ) { auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; @@ -22861,12 +22967,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; @@ -22875,8 +22981,12 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; - auto_size_ctl.decr_mode = H5C_decr__off; + + auto_size_ctl.decr_mode = H5C_decr__age_out; auto_size_ctl.upper_hr_threshold = 0.995; @@ -22885,18 +22995,17 @@ check_auto_cache_resize_disable(void) 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.epochs_before_eviction = 1; auto_size_ctl.apply_empty_reserve = TRUE; - auto_size_ctl.empty_reserve = 0.05; - + 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 16.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 9.\n"; } } @@ -22906,14 +23015,19 @@ 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"; + failure_mssg = "bad cache size after set resize re-config 8.\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. + /* 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 ) { @@ -22921,400 +23035,443 @@ check_auto_cache_resize_disable(void) i = 0; while ( ( pass ) && ( i < 1000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, 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 != 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 44.\n"; + failure_mssg = "Unexpected cache size change results 24.\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. + /* Load up some more small entries. */ if ( pass ) { rpt_fcn_called = FALSE; - i = 0; - while ( ( pass ) && ( i < 1000 ) ) + i = 1000; + while ( ( pass ) && ( i < 2000 ) ) { - protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + protect_entry(cache_ptr, SMALL_ENTRY_TYPE, i); if ( pass ) { - unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, 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 != 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 45.\n"; + failure_mssg = "Unexpected cache size change results 25.\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. + */ 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) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 26.\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 ) { + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); + 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 27.\n"; + } } - return; + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); -} /* check_auto_cache_resize_disable() */ + /* 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 ) { - -/*------------------------------------------------------------------------- - * 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: - * - *------------------------------------------------------------------------- - */ + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); -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, + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (512 * 1024), + 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) ) ) { - /* double min_clean_fraction = */ 0.5, + pass = FALSE; + failure_mssg = "Unexpected cache size change results 28.\n"; + } + } - /* size_t max_size = */ (14 * 1024 * 1024), - /* size_t min_size = */ (512 * 1024), + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* int64_t epoch_length = */ 1000, + /* 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 ) { - /* 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 = 4 * 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 = 16 * 1024 * 1024; + auto_size_ctl.min_size = 1 * 1024 * 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 = (2 * 1024 * 1024); - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05 - }; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; - TESTING("automatic cache resize epoch marker management"); - pass = TRUE; + auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + auto_size_ctl.upper_hr_threshold = 1.0; - 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 = 1; - if ( pass ) { + 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 1.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 10.\n"; } } if ( pass ) { - if ( ( cache_ptr->max_cache_size != (512 * 1024) ) || - ( cache_ptr->min_clean_size != (256 * 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 initialization.\n"; + 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); - /* Now make sure that we are managing the epoch markers correctly. - */ + 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 ) { - 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 = 10; - - 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, SMALL_ENTRY_TYPE, i); - pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 2.\n"; + if ( pass ) { + unprotect_entry(cache_ptr, SMALL_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 ) || + ( 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 = "bad cache size after set resize re-config 1.\n"; + failure_mssg = "Unexpected cache size change results 29.\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. + /* Load up some more small entries. */ - if ( pass ) { - if ( cache_ptr->epoch_markers_active != 0 ) { + 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 # of epoch markers 1.\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 ) { 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 != 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 0.\n"; + failure_mssg = "Unexpected cache size change results 31.\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 ) { - j = 2; - 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 - 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, 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 2.\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 32.\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. + /* 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 ) { 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, 999); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_ENTRY_TYPE, i, + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 999, NO_CHANGE, H5C__NO_FLAGS_SET); } i++; } 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 != (6 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected cache size change results 1.\n"; + failure_mssg = "Unexpected cache size change results 33.\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 - */ + + /********************************************************************* + * 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 = 8 * 1024 * 1024; + auto_size_ctl.initial_size = 2 * 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.lower_hr_threshold = 0.0; /* disable size increases */ 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.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; - auto_size_ctl.decr_mode = H5C_decr__age_out; - auto_size_ctl.upper_hr_threshold = 0.995; + auto_size_ctl.decr_mode = H5C_decr__threshold; + + auto_size_ctl.upper_hr_threshold = 1.0; /* disable size decreases */ 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.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); @@ -23322,117 +23479,128 @@ check_auto_cache_resize_epoch_markers(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_set_cache_auto_resize_config failed 3.\n"; + failure_mssg = "H5C_set_cache_auto_resize_config failed 11.\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 != (2 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "bad cache size after set resize re-config 2.\n"; + failure_mssg = "bad cache size after set resize re-config 10.\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. + /* force low hit rate -- should be no response as the auto-resize + * code should be 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, i); if ( pass ) { - unprotect_entry(cache_ptr, SMALL_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 != (512 * 1024) ) || - ( cache_ptr->min_clean_size != (256 * 1024) ) || - ( cache_ptr->index_size != (1 * 1000 * SMALL_ENTRY_SIZE) ) ) { + 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 cache size change results 2.\n"; + failure_mssg = "Unexpected cache size change results 34.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* There should be exactly one active epoch marker at present... + /* force high hit rate -- should be no response as the auto-resize + * code should be disabled. */ if ( pass ) { - if ( cache_ptr->epoch_markers_active != 1 ) { + 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 != (2 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected # of epoch markers 4.\n"; + failure_mssg = "Unexpected cache size change results 35.\n"; } } - /* shift the decrement mode to threshold, and verify that we remove - * all epoch markers. - */ + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + 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.min_clean_fraction = 0.25; - 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.increment = 1.0; /* disable size increment */ 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.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; 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.decrement = 1.0; /* disable size decrement */ - 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.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); @@ -23440,74 +23608,128 @@ check_auto_cache_resize_epoch_markers(void) 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 12.\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 != (1 * 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 11.\n"; } } - /* ... and now there should be none. + 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->epoch_markers_active != 0 ) { + 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 = "Unexpected # of epoch markers 5.\n"; + failure_mssg = "Unexpected cache size change results 36.\n"; } } 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. + /* 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 cache size change results 37.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + 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.set_initial_size = FALSE; + auto_size_ctl.initial_size = 2 * 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 = 6 * 1024 * 1024; /* no resize */ + auto_size_ctl.min_size = 6 * 1024 * 1024; /* no resize */ 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.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; - 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.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 = 10; + 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); @@ -23515,298 +23737,1892 @@ check_auto_cache_resize_epoch_markers(void) 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 13.\n"; } } - /* Verify that there are no active epoch markers. - */ if ( pass ) { - if ( cache_ptr->epoch_markers_active != 0 ) { + if ( ( cache_ptr->max_cache_size != (6 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024 * 1024) ) ) { pass = FALSE; - failure_mssg = "Unexpected # of epoch markers 6.\n"; + failure_mssg = "bad cache size after set resize re-config 12.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* build up a full set of epoch markers. */ + /* force low hit rate -- should be no response as the auto-resize + * code should be disabled. + */ 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 ) || + ( 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) ) ) { - j++; + pass = FALSE; + failure_mssg = "Unexpected cache size change results 38.\n"; } } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* Verify that there are now 10 active epoch markers. + /* force high hit rate -- should be no response as the auto-resize + * code should be 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->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 # of epoch markers 8.\n"; + failure_mssg = "Unexpected cache size change results 39.\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++); + + 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.25; + + 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 = 1.0; /* disable size increment */ + + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (2 * 1024 * 1024); + + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + + + auto_size_ctl.decr_mode = H5C_decr__threshold; + + auto_size_ctl.upper_hr_threshold = 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); + + 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 ) { + + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 14.\n"; + } + } + + if ( pass ) { + + if ( ( cache_ptr->max_cache_size != (4 * 1024 * 1024) ) || + ( cache_ptr->min_clean_size != (1 * 1024 * 1024) ) ) { + + 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 = "Unexpected cache size change results 40.\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. */ 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 cache size change results 41.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + 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.lower_hr_threshold = 0.0; /* disable size increment */ 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.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; - auto_size_ctl.decr_mode = H5C_decr__off; + + 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.decrement = 1.0; /* disable size decrement */ - 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 = 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); 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 15.\n"; + } + } + + 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 14.\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 42.\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. + */ + 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 != (2 * 1024 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 43.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + 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; + + 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.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + + + 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 ) { + + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 16.\n"; + } + } + + 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 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"; + } + } + + 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 != (2 * 1024 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 45.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Now test the flash cache size increment code to verify that it + * is disabled when it should be. + * + * Since the flash size increase code doesn't look at hit rate, or + * use epochs (other than to start a new epoch if a flash cache size + * increase is triggered), we go about these tests somewhat differently + * than the rest of the tests in this function. + * + * As of this writing, there is only one flash cache size increment + * mode (add space), which is triggered whenever the size of a newly + * loaded or inserted entry, or the delta between old and new entry + * sizes exceeds some fraction of the current maximum cache size, and + * the cache doesn't have enough free space to accomodate the new/ + * resize entry without performing evictions. The range of permissible + * values for the flash_threshold (0.1 to 1.0 as of this writing), and + * for the flash_multiple (0.1 to 10.0) do not permit the facility to + * be turned off by configuration. Thus, flash cache size increases + * can be disabled only via the flash_incr_mode, and by setting the + * current max_cache_size equal to max_size. + * + * We have already tested the latter in check_auto_cache_resize(), so + * we need only thest the former here. Do this by disabling flash + * cache size increments via the flash_incr_mode, and then creating + * situations that would trigger flash cache size increases were that + * code 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 = 64 * 1024; + + auto_size_ctl.min_clean_fraction = 0.5; + + auto_size_ctl.max_size = 256 * 1024; + auto_size_ctl.min_size = 32 * 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); + + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 1.0; + auto_size_ctl.flash_threshold = 0.25; + + + auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; + + 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); + + 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 ) { + + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 17.\n"; + } + } + + if ( pass ) { + + if ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "bad cache size after set resize re-config 16.\n"; + } + } + + /* We have reduced the max cache size to well below the current index + * size. Protect and unprotect an entry to allow the cache to evict + * entries and get within bounds + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) || + ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != LARGE_ENTRY_SIZE ) || + ( rpt_fcn_called != FALSE ) ) ) ) { + + HDfprintf(stdout, "\nmax_cache_size = %ld.\n", + (long)(cache_ptr->max_cache_size)); + HDfprintf(stdout, "min_clean_size = %ld.\n", + (long)(cache_ptr->min_clean_size)); + HDfprintf(stdout, "index_len = %ld.\n", + (long)(cache_ptr->index_len)); + HDfprintf(stdout, "index_size = %ld.\n", + (long)(cache_ptr->index_size)); + HDfprintf(stdout, "rpt_fcn_called = %ld.\n", + (long)(rpt_fcn_called)); + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 46.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Now protect and unprotect a monster entry. If the flash cache + * size increment code was active, this would trigger an increase. + * Verify that it doesn't. + * + * This finishes the additional tests needed for the flash cache + * size increase code. + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) || + ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != MONSTER_ENTRY_SIZE ) || + ( rpt_fcn_called != FALSE ) ) ) ) { + + HDfprintf(stdout, "\nmax_cache_size = %ld.\n", + (long)(cache_ptr->max_cache_size)); + HDfprintf(stdout, "min_clean_size = %ld.\n", + (long)(cache_ptr->min_clean_size)); + HDfprintf(stdout, "index_len = %ld.\n", + (long)(cache_ptr->index_len)); + HDfprintf(stdout, "index_size = %ld.\n", + (long)(cache_ptr->index_size)); + HDfprintf(stdout, "rpt_fcn_called = %ld.\n", + (long)(rpt_fcn_called)); + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 47.\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); + } + + return; + +} /* 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_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + + + /* 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); + + 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++); + + + /* Now make sure that we are managing the epoch markers correctly. + */ + + 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.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + + + 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 = 10; + + 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 ( 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 1.\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 ) { + + pass = FALSE; + failure_mssg = "Unexpected # of epoch markers 1.\n"; + } + } + + 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 != 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) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 0.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + + if ( pass ) { + + j = 2; + while ( ( pass ) && ( j <= 10 ) ) + { + + 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 ( ( ! rpt_fcn_called ) || + ( rpt_status != in_spec ) || + ( cache_ptr->epoch_markers_active != j ) ) { + + pass = FALSE; + failure_mssg = "Unexpected # of epoch markers 2.\n"; + } + + j++; + } + } + + 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. + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + i = 9000; + while ( ( pass ) && ( i < 10000 ) ) + { + 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 ) || + ( 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 = "Unexpected cache size change results 1.\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 + */ + 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.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + + + 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 ) { + + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 3.\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 2.\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. + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + i = 9000; + while ( ( pass ) && ( i < 10000 ) ) + { + 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 ) || + ( 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 = "Unexpected cache size change results 2.\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 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.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.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + + + 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 = 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 ) { + + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 4.\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 3.\n"; + } + } + + /* ... and now there should be none. + */ + if ( pass ) { + + if ( cache_ptr->epoch_markers_active != 0 ) { + + pass = FALSE; + failure_mssg = "Unexpected # of epoch markers 5.\n"; + } + } + + 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. + */ + 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.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + + + auto_size_ctl.decr_mode = H5C_decr__age_out_with_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 = 10; + + 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 5.\n"; + } + } + + /* Verify that there are no active epoch markers. + */ + if ( pass ) { + + if ( cache_ptr->epoch_markers_active != 0 ) { + + pass = FALSE; + 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 ) { + + j = 1; + while ( ( pass ) && ( j <= 10 ) ) + { + + 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 ( ( ! rpt_fcn_called ) || + ( rpt_status != in_spec ) || + ( cache_ptr->epoch_markers_active != j ) ) { + + pass = FALSE; + failure_mssg = "Unexpected # of epoch markers 7.\n"; + } + + j++; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Verify that there are now 10 active epoch markers. + */ + if ( pass ) { + + if ( cache_ptr->epoch_markers_active != 10 ) { + + 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 ) { + + 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.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + + + 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 = FALSE; + auto_size_ctl.max_decrement = (1 * 1024 * 1024); + + auto_size_ctl.epochs_before_eviction = 10; + + 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 6.\n"; + } + } + + /* 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"; + } + } + + 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. + */ + 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 ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 3.\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); + } + + return; + +} /* check_auto_cache_resize_epoch_markers() */ + + +/*------------------------------------------------------------------------- + * 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: + * + * Added code to verify that errors in the flash cache size + * increment related fields are caught as well. + * + * JRM -- 1/17/08 + * + *------------------------------------------------------------------------- + */ + +#define RESIZE_CONFIGS_ARE_EQUAL(a, b, compare_init) \ +( ( (a).version == (b).version ) && \ + ( (a).rpt_fcn == (b).rpt_fcn ) && \ + ( ( ! compare_init ) || \ + ( (a).set_initial_size == (b).set_initial_size ) ) && \ + ( ( ! compare_init ) || \ + ( (a).initial_size == (b).initial_size ) ) && \ + ( (a).min_clean_fraction == (b).min_clean_fraction ) && \ + ( (a).max_size == (b).max_size ) && \ + ( (a).min_size == (b).min_size ) && \ + ( (a).epoch_length == (b).epoch_length ) && \ + ( (a).incr_mode == (b).incr_mode ) && \ + ( (a).lower_hr_threshold == (b).lower_hr_threshold ) && \ + ( (a).increment == (b).increment ) && \ + ( (a).apply_max_increment == (b).apply_max_increment ) && \ + ( (a).max_increment == (b).max_increment ) && \ + ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ + ( (a).flash_multiple == (b).flash_multiple ) && \ + ( (a).flash_threshold == (b).flash_threshold ) && \ + ( (a).decr_mode == (b).decr_mode ) && \ + ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \ + ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ + ( (a).flash_multiple == (b).flash_multiple ) && \ + ( (a).flash_threshold == (b).flash_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 ) ) + +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, + + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (512 * 1024), + + /* double min_clean_fraction = */ 0.5, + + /* size_t max_size = */ (16 * 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_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + + + /* 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 + }; + + H5C_auto_size_ctl_t invalid_auto_size_ctl; + H5C_auto_size_ctl_t test_auto_size_ctl; + + TESTING("automatic cache resize input errors"); + + 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. + */ + + 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, + &ref_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 ( 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 1."; + + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { + + pass = FALSE; + failure_mssg = "Unexpected auto resize config 1."; + } + } + + 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 = 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); + + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + + + 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); + + 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(NULL, + &invalid_auto_size_ctl); + + if ( result != FAIL ) { + + pass = FALSE; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted NULL cache_ptr.\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) ) { + + pass = FALSE; + failure_mssg = "Unexpected auto resize config 2."; + } + } + + + /* check bad version rejection. */ + + 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); + + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + + + 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); + + 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_set_cache_auto_resize_config accepted bad version.\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 3."; + + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { + + pass = FALSE; + failure_mssg = "Unexpected auto resize config 3."; + } + } + + + /* check bad initial size rejection */ + + 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 = 16 * 1024 * 1024 + 1; + /* INVALID */ + + 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.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.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + + + 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); + + 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_set_cache_auto_resize_config accepted bad init size 1.\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 4."; + + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { + + pass = FALSE; + failure_mssg = "Unexpected auto resize config 4."; } } - /* Verify that there are now no active epoch markers. - */ if ( pass ) { - if ( cache_ptr->epoch_markers_active != 0 ) { + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; - pass = FALSE; - failure_mssg = "Unexpected # of epoch markers 9.\n"; - } - } + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 1 * 1024 * 1024 - 1; + /* INVALID */ - if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + invalid_auto_size_ctl.min_clean_fraction = 0.5; - /* 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.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; - 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.epoch_length = 5000; - 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.incr_mode = H5C_incr__threshold; - if ( pass ) { + invalid_auto_size_ctl.lower_hr_threshold = 0.75; - takedown_cache(cache_ptr, FALSE, FALSE); - } + 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); - if ( pass ) { PASSED(); } else { H5_FAILED(); } + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; - if ( ! pass ) { - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", - fcn_name, failure_mssg); - } + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - return; + invalid_auto_size_ctl.upper_hr_threshold = 0.999; -} /* check_auto_cache_resize_epoch_markers() */ + invalid_auto_size_ctl.decrement = 0.5; - -/*------------------------------------------------------------------------- - * 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: - * - *------------------------------------------------------------------------- - */ + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 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 ) ) + invalid_auto_size_ctl.epochs_before_eviction = 3; -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, + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (512 * 1024), + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); - /* double min_clean_fraction = */ 0.5, + if ( result != FAIL ) { - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ (512 * 1024), + pass = FALSE; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad init size 2.\n"; + } + } - /* int64_t epoch_length = */ 1000, + if ( pass ) { + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); - /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, + if ( result != SUCCEED ) { - /* double lower_hr_threshold = */ 0.75, + pass = FALSE; + failure_mssg = "H5C_get_cache_auto_resize_config failed 5."; - /* double increment = */ 2.0, + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), + pass = FALSE; + failure_mssg = "Unexpected auto resize config 5."; + } + } - /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, + /* test for invalid min clean fraction rejection. */ - /* double upper_hr_threshold = */ 0.995, + if ( pass ) { - /* double decrement = */ 0.1, + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; - /* int32_t epochs_before_eviction = */ 3, + invalid_auto_size_ctl.min_clean_fraction = 1.00001; /* INVALID */ - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05 - }; + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; - H5C_auto_size_ctl_t invalid_auto_size_ctl; - H5C_auto_size_ctl_t test_auto_size_ctl; + invalid_auto_size_ctl.epoch_length = 5000; - TESTING("automatic cache resize input errors"); - pass = TRUE; + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - /* 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.lower_hr_threshold = 0.75; - if ( pass ) { + invalid_auto_size_ctl.increment = 2.0; - reset_entries(); + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - cache_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); - } + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; - if ( pass ) { - result = H5C_set_cache_auto_resize_config(cache_ptr, - &ref_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 1.\n"; - } - } + invalid_auto_size_ctl.decrement = 0.5; - 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 != (512 * 1024) ) || - ( cache_ptr->min_clean_size != (256 * 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 = "bad cache size after initialization.\n"; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad min clean frac 1.\n"; } } @@ -23818,13 +25634,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 1."; + 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 1."; + failure_mssg = "Unexpected auto resize config 6."; } } @@ -23836,7 +25652,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.5; + 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; @@ -23846,13 +25662,17 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.7; + 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.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -23868,14 +25688,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(NULL, + 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 NULL cache_ptr.\n"; + "H5C_set_cache_auto_resize_config accepted bad min clean frac 2.\n"; } } @@ -23887,22 +25707,22 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 2."; + 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 2."; + failure_mssg = "Unexpected auto resize config 7."; } } - /* check bad version rejection. */ + /* test for invalid max_size and/or min_size rejection */ if ( pass ) { - invalid_auto_size_ctl.version = -1; /* INVALID */ + 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; @@ -23910,7 +25730,8 @@ check_auto_cache_resize_input_errs(void) 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; @@ -23918,13 +25739,17 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.7; + 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.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -23947,7 +25772,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad version.\n"; + "H5C_set_cache_auto_resize_config accepted bad max_size.\n"; } } @@ -23959,32 +25784,28 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 3."; + 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 3."; + failure_mssg = "Unexpected auto resize config 8."; } } - - /* check bad initial size rejection */ - 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 = 16 * 1024 * 1024 + 1; - /* INVALID */ + 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.max_size = 1 * 1024 * 1024;/* INVALID */ + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024 + 1;/*PAIR */ invalid_auto_size_ctl.epoch_length = 5000; @@ -23998,6 +25819,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24020,7 +25845,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad init size 1.\n"; + "H5C_set_cache_auto_resize_config accepted bad size pair.\n"; } } @@ -24032,13 +25857,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 4."; + 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 4."; + failure_mssg = "Unexpected auto resize config 9."; } } @@ -24047,15 +25872,14 @@ check_auto_cache_resize_input_errs(void) 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 = 1 * 1024 * 1024 - 1; - /* INVALID */ + 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.min_size = H5C__MIN_MAX_CACHE_SIZE - 1; + /* INVALID */ invalid_auto_size_ctl.epoch_length = 5000; @@ -24068,6 +25892,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24090,7 +25918,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad init size 2.\n"; + "H5C_set_cache_auto_resize_config accepted bad min_size.\n"; } } @@ -24102,18 +25930,18 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 5."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 10."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 5."; + failure_mssg = "Unexpected auto resize config 10."; } } - /* test for invalid min clean fraction rejection. */ + /* test for invalid epoch_length rejection */ if ( pass ) { @@ -24123,13 +25951,13 @@ 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 = 1.00001; /* INVALID */ + 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; - + invalid_auto_size_ctl.epoch_length = H5C__MAX_AR_EPOCH_LENGTH + 1; + /* INVALID */ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; @@ -24140,12 +25968,16 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + 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.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24162,7 +25994,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad min clean frac 1.\n"; + "H5C_set_cache_auto_resize_config accepted bad epoch len 1.\n"; } } @@ -24174,13 +26006,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 6."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 11."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 6."; + failure_mssg = "Unexpected auto resize config 11."; } } @@ -24192,13 +26024,13 @@ 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.00001; /* INVALID */ + 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; - + invalid_auto_size_ctl.epoch_length = H5C__MIN_AR_EPOCH_LENGTH - 1; + /* INVALID */ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; @@ -24209,12 +26041,16 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + 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.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24231,7 +26067,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad min clean frac 2.\n"; + "H5C_set_cache_auto_resize_config accepted bad epoch len 2.\n"; } } @@ -24243,18 +26079,18 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 7."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 12."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 7."; + failure_mssg = "Unexpected auto resize config 12."; } } - /* test for invalid max_size and/or min_size rejection */ + /* test for bad incr_mode rejection */ if ( pass ) { @@ -24264,16 +26100,16 @@ 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.5; + invalid_auto_size_ctl.min_clean_fraction = 0.1; - invalid_auto_size_ctl.max_size = H5C__MAX_MAX_CACHE_SIZE + 1; - /* 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.incr_mode = + (enum H5C_cache_incr_mode) -1; /* INVALID */ invalid_auto_size_ctl.lower_hr_threshold = 0.75; @@ -24282,12 +26118,16 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + 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.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24304,7 +26144,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad max_size.\n"; + "H5C_set_cache_auto_resize_config accepted bad incr_mode 1.\n"; } } @@ -24316,13 +26156,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 8."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 13."; } 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 = "Unexpected auto resize config 13."; } } @@ -24334,15 +26174,16 @@ 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.5; + invalid_auto_size_ctl.min_clean_fraction = 0.1; - 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.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.incr_mode = + (enum H5C_cache_incr_mode) 2; /* INVALID */ invalid_auto_size_ctl.lower_hr_threshold = 0.75; @@ -24351,12 +26192,16 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + 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.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24373,7 +26218,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad size pair.\n"; + "H5C_set_cache_auto_resize_config accepted bad incr_mode 2.\n"; } } @@ -24385,16 +26230,19 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 9."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 14."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 9."; + failure_mssg = "Unexpected auto resize config 14."; } } + + /* check for bad upper and/or lower threshold rejection */ + if ( pass ) { invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; @@ -24406,24 +26254,28 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.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.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.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); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999; + invalid_auto_size_ctl.upper_hr_threshold = 1.01; /* INVALID */ invalid_auto_size_ctl.decrement = 0.5; @@ -24442,7 +26294,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad min_size.\n"; + "H5C_set_cache_auto_resize_config accepted bad upper threshold.\n"; } } @@ -24454,19 +26306,16 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 10."; + 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) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 10."; + failure_mssg = "Unexpected auto resize config 15."; } } - - /* test for invalid epoch_length rejection */ - if ( pass ) { invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; @@ -24475,29 +26324,33 @@ 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.epoch_length = H5C__MAX_AR_EPOCH_LENGTH + 1; - /* INVALID */ + 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.lower_hr_threshold = 0.8; /* INVALID */ 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.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.999; + invalid_auto_size_ctl.upper_hr_threshold = 0.7; /* INVALID */ - 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); @@ -24514,7 +26367,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad epoch len 1.\n"; + "H5C_set_cache_auto_resize_config accepted bad threshold pair.\n"; } } @@ -24526,13 +26379,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 11."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 16."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 11."; + failure_mssg = "Unexpected auto resize config 16."; } } @@ -24544,29 +26397,33 @@ 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.epoch_length = H5C__MIN_AR_EPOCH_LENGTH - 1; - /* INVALID */ + 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.lower_hr_threshold = -0.0001; /* INVALID */ 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.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + 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); @@ -24583,7 +26440,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad epoch len 2.\n"; + "H5C_set_cache_auto_resize_config accepted bad lower threshold.\n"; } } @@ -24595,18 +26452,18 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 12."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 17."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 12."; + failure_mssg = "Unexpected auto resize config 17."; } } - /* test for bad incr_mode rejection */ + /* test for bad increment rejection */ if ( pass ) { @@ -24624,22 +26481,25 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.epoch_length = 5000; - invalid_auto_size_ctl.incr_mode = - (enum H5C_cache_incr_mode) -1; /* INVALID */ + 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.increment = 0.99999; /* INVALID */ invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + 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); @@ -24649,6 +26509,7 @@ 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, &invalid_auto_size_ctl); @@ -24656,7 +26517,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad incr_mode 1.\n"; + "H5C_set_cache_auto_resize_config accepted bad increment.\n"; } } @@ -24668,16 +26529,19 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 13."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 18."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 13."; + failure_mssg = "Unexpected auto resize config 18."; } } + + /* test for bad flash_incr_mode rejection */ + if ( pass ) { invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; @@ -24694,8 +26558,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.epoch_length = 5000; - invalid_auto_size_ctl.incr_mode = - (enum H5C_cache_incr_mode) 2; /* INVALID */ + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; invalid_auto_size_ctl.lower_hr_threshold = 0.75; @@ -24704,6 +26567,11 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = + (enum H5C_cache_flash_incr_mode) -1; /* INVALID */ + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24726,7 +26594,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad incr_mode 2.\n"; + "H5C_set_cache_auto_resize_config accepted bad flash_incr_mode.\n"; } } @@ -24738,18 +26606,17 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 14."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 19."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 14."; + failure_mssg = "Unexpected auto resize config 19."; } } - - /* check for bad upper and/or lower threshold rejection */ + /* test for bad flash_multiple rejection */ if ( pass ) { @@ -24759,7 +26626,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.5; + 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; @@ -24769,19 +26636,24 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.7; + 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.flash_incr_mode = + H5C_flash_incr__add_space; + invalid_auto_size_ctl.flash_multiple = 0.09; /* INVALID */ + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 1.01; /* INVALID */ + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.5; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24798,7 +26670,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad upper threshold.\n"; + "H5C_set_cache_auto_resize_config accepted bad flash_multiple(1).\n"; } } @@ -24810,13 +26682,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 15."; + 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 = "Unexpected auto resize config 15."; + failure_mssg = "Unexpected auto resize config 20."; } } @@ -24828,7 +26700,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.5; + 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; @@ -24838,19 +26710,24 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = 0.8; /* INVALID */ + 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.flash_incr_mode = + H5C_flash_incr__add_space; + invalid_auto_size_ctl.flash_multiple = 10.01; /* INVALID */ + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; - invalid_auto_size_ctl.upper_hr_threshold = 0.7; /* INVALID */ + invalid_auto_size_ctl.upper_hr_threshold = 0.999; - invalid_auto_size_ctl.decrement = 0.5; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24867,7 +26744,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad threshold pair.\n"; + "H5C_set_cache_auto_resize_config accepted bad flash_multiple(2).\n"; } } @@ -24879,16 +26756,18 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 16."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 21."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 16."; + failure_mssg = "Unexpected auto resize config 21."; } } + /* test for bad flash_threshold rejection */ + if ( pass ) { invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; @@ -24897,7 +26776,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.5; + 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; @@ -24907,19 +26786,24 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; - invalid_auto_size_ctl.lower_hr_threshold = -0.0001; /* INVALID */ + 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.flash_incr_mode = + H5C_flash_incr__add_space; + invalid_auto_size_ctl.flash_multiple = 1.0; + invalid_auto_size_ctl.flash_threshold = 0.09; /* 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.5; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -24936,7 +26820,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad lower threshold.\n"; + "H5C_set_cache_auto_resize_config accepted bad flash_threshold(1).\n"; } } @@ -24948,19 +26832,16 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 17."; + 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 = "Unexpected auto resize config 17."; + failure_mssg = "Unexpected auto resize config 22."; } } - - /* test for bad increment rejection */ - if ( pass ) { invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; @@ -24981,17 +26862,22 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.lower_hr_threshold = 0.75; - invalid_auto_size_ctl.increment = 0.99999; /* INVALID */ + 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.flash_incr_mode = + H5C_flash_incr__add_space; + invalid_auto_size_ctl.flash_multiple = 1.0; + invalid_auto_size_ctl.flash_threshold = 1.001; /* 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.5; + invalid_auto_size_ctl.decrement = 0.9; invalid_auto_size_ctl.apply_max_decrement = TRUE; invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); @@ -25001,7 +26887,6 @@ 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, &invalid_auto_size_ctl); @@ -25009,7 +26894,7 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = - "H5C_set_cache_auto_resize_config accepted bad increment.\n"; + "H5C_set_cache_auto_resize_config accepted bad flash_threshold(2).\n"; } } @@ -25021,17 +26906,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 23."; } 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 23."; } } - /* test for bad decr_mode rejection */ if ( pass ) { @@ -25059,6 +26943,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = (enum H5C_cache_decr_mode) -1; /* INVALID */ @@ -25094,13 +26982,13 @@ 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 24."; } 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 24."; } } @@ -25129,6 +27017,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = (enum H5C_cache_decr_mode) 4; /* INVALID */ @@ -25164,13 +27056,13 @@ 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 25."; } 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 25."; } } @@ -25202,6 +27094,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -25236,13 +27132,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 26."; } 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 26."; } } @@ -25271,6 +27167,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -25305,13 +27205,13 @@ 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 27."; } 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 27."; } } @@ -25343,6 +27243,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -25376,13 +27280,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 28."; } 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 28."; } } @@ -25411,6 +27315,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -25445,13 +27353,13 @@ 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 29."; } 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 29."; } } @@ -25483,6 +27391,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -25516,13 +27428,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 30."; } 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 30."; } } @@ -25551,6 +27463,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -25585,13 +27501,13 @@ 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 31."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 26."; + failure_mssg = "Unexpected auto resize config 31."; } } @@ -25716,6 +27632,11 @@ check_auto_cache_resize_aux_fcns(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, diff --git a/test/cache_api.c b/test/cache_api.c index a1da62f..6a75d11 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -50,6 +50,9 @@ const char *FILENAME[] = { ( (a).increment == (b).increment ) && \ ( (a).apply_max_increment == (b).apply_max_increment ) && \ ( (a).max_increment == (b).max_increment ) && \ + ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ + ( (a).flash_multiple == (b).flash_multiple ) && \ + ( (a).flash_threshold == (b).flash_threshold ) && \ ( (a).decr_mode == (b).decr_mode ) && \ ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \ ( (a).decrement == (b).decrement ) && \ @@ -139,6 +142,9 @@ static void check_file_mdc_api_errs(void); ( (a).increment == (b).increment ) && \ ( (a).apply_max_increment == (b).apply_max_increment ) && \ ( (a).max_increment == (b).max_increment ) && \ + ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ + ( (a).flash_multiple == (b).flash_multiple ) && \ + ( (a).flash_threshold == (b).flash_threshold ) && \ ( (a).decr_mode == (b).decr_mode ) && \ ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \ ( (a).decrement == (b).decrement ) && \ @@ -166,8 +172,14 @@ static void check_file_mdc_api_errs(void); (i).increment = (e).increment; \ (i).apply_max_increment = (e).apply_max_increment; \ (i).max_increment = (e).max_increment; \ + (i).flash_incr_mode = (e).flash_incr_mode; \ + (i).flash_multiple = (e).flash_multiple; \ + (i).flash_threshold = (e).flash_threshold; \ (i).decr_mode = (e).decr_mode; \ (i).upper_hr_threshold = (e).upper_hr_threshold; \ + (i).flash_incr_mode = (e).flash_incr_mode; \ + (i).flash_multiple = (e).flash_multiple; \ + (i).flash_threshold = (e).flash_threshold; \ (i).decrement = (e).decrement; \ (i).apply_max_decrement = (e).apply_max_decrement; \ (i).max_decrement = (e).max_decrement; \ @@ -208,6 +220,10 @@ check_fapl_mdc_api_calls(void) /* double increment = */ 2.1, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024 + 1), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out, /* double upper_hr_threshold = */ 0.998, /* double decrement = */ 0.91, @@ -695,7 +711,7 @@ validate_mdc_config(hid_t file_id, /* 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 + * always presume that this field need not match that of * the supplied external configuration. * * The cache also sets the initial_size field to the current @@ -773,6 +789,10 @@ check_file_mdc_api_calls(void) /* double increment = */ 2.1, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024 + 1), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out, /* double upper_hr_threshold = */ 0.998, /* double decrement = */ 0.91, @@ -802,6 +822,10 @@ check_file_mdc_api_calls(void) /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (2 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 1.5, + /* double flash_threshold = */ 0.4, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, /* double upper_hr_threshold = */ 0.9995, /* double decrement = */ 0.95, @@ -831,6 +855,10 @@ check_file_mdc_api_calls(void) /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.1, + /* double flash_threshold = */ 0.6, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -860,6 +888,10 @@ check_file_mdc_api_calls(void) /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (2 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 1.1, + /* double flash_threshold = */ 0.3, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, @@ -1389,6 +1421,10 @@ mdc_api_call_smoke_check(void) /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ FALSE, /* size_t max_increment = */ 4000000, + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -1418,6 +1454,10 @@ mdc_api_call_smoke_check(void) /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ FALSE, /* size_t max_increment = */ 4000000, + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -1447,6 +1487,10 @@ mdc_api_call_smoke_check(void) /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ FALSE, /* size_t max_increment = */ 4000000, + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2092,7 +2136,7 @@ mdc_api_call_smoke_check(void) * used to test error rejection in the MDC related API calls. */ -#define NUM_INVALID_CONFIGS 36 +#define NUM_INVALID_CONFIGS 41 H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = { @@ -2115,6 +2159,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2143,6 +2191,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double lower_hr_threshold = */ 0.9, /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* 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, @@ -2173,6 +2225,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2202,6 +2258,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2231,6 +2291,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2260,6 +2324,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2289,6 +2357,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2318,6 +2390,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2347,6 +2423,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2376,6 +2456,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2405,6 +2489,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2434,6 +2522,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2463,6 +2555,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2492,6 +2588,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2521,6 +2621,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2550,6 +2654,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2579,6 +2687,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2608,6 +2720,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2637,6 +2753,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 0.999999999999, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2666,6 +2786,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ (hbool_t)-1, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2677,7 +2801,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 20 -- bad decr_mode */ + /* 20 -- invalid flash_incr_mode */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2695,6 +2819,175 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ -1, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* 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, + /* int dirty_bytes_threshold = */ (256 * 1024) + }, + { + /* 21 -- flash_multiple too small */ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* 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_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__add_space, + /* double flash_multiple = */ 0.09, + /* double flash_threshold = */ 0.5, + /* 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, + /* int dirty_bytes_threshold = */ (256 * 1024) + }, + { + /* 22 -- flash_multiple too big */ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* 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_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__add_space, + /* double flash_multiple = */ 10.001, + /* double flash_threshold = */ 0.5, + /* 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, + /* int dirty_bytes_threshold = */ (256 * 1024) + }, + { + /* 23 -- flash_threshold too small */ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* 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_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__add_space, + /* double flash_multiple = */ 1.0, + /* double flash_threshold = */ 0.099, + /* 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, + /* int dirty_bytes_threshold = */ (256 * 1024) + }, + { + /* 24 -- flash_threshold too big */ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* 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_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__add_space, + /* double flash_multiple = */ 1.0, + /* double flash_threshold = */ 1.001, + /* 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, + /* int dirty_bytes_threshold = */ (256 * 1024) + }, + { + /* 25 -- bad decr_mode */ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* 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_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ -1, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2706,7 +2999,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 21 -- upper_hr_threshold too big */ + /* 26 -- upper_hr_threshold too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2724,6 +3017,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, /* double upper_hr_threshold = */ 1.00001, /* double decrement = */ 0.9, @@ -2735,7 +3032,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 22 -- decrement too small */ + /* 27 -- decrement too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2753,6 +3050,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ -0.0000000001, @@ -2764,7 +3065,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 23 -- decrement too big */ + /* 28 -- decrement too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2782,6 +3083,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 1.0000000001, @@ -2793,7 +3098,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 24 -- epochs_before_eviction too small */ + /* 29 -- epochs_before_eviction too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2811,6 +3116,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2822,7 +3131,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 24 -- epochs_before_eviction too big */ + /* 30 -- epochs_before_eviction too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2840,6 +3149,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2851,7 +3164,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 26 -- invalid apply_empty_reserve */ + /* 31 -- invalid apply_empty_reserve */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2869,6 +3182,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2880,7 +3197,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 27 -- empty_reserve too small */ + /* 32 -- empty_reserve too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2898,6 +3215,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2909,7 +3230,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 28 -- empty_reserve too big */ + /* 33 -- empty_reserve too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2927,6 +3248,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2938,7 +3263,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 29 -- upper_hr_threshold too small */ + /* 34 -- upper_hr_threshold too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2956,6 +3281,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ -0.000000001, /* double decrement = */ 0.9, @@ -2967,7 +3296,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 30 -- upper_hr_threshold too big */ + /* 35 -- upper_hr_threshold too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2985,6 +3314,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 1.00000001, /* double decrement = */ 0.9, @@ -2996,7 +3329,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 31 -- upper_hr_threshold <= lower_hr_threshold */ + /* 36 -- upper_hr_threshold <= lower_hr_threshold */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -3014,6 +3347,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.9, /* double decrement = */ 0.9, @@ -3025,7 +3362,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 32 -- dirty_bytes_threshold too small */ + /* 37 -- dirty_bytes_threshold too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -3043,6 +3380,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -3054,7 +3395,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (H5C__MIN_MAX_CACHE_SIZE / 2) - 1 }, { - /* 33 -- dirty_bytes_threshold too big */ + /* 38 -- dirty_bytes_threshold too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -3072,6 +3413,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.9, /* double decrement = */ 0.9, @@ -3083,7 +3428,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (H5C__MAX_MAX_CACHE_SIZE / 4) + 1 }, { - /* 34 -- attempt to disable evictions when auto incr enabled */ + /* 39 -- attempt to disable evictions when auto incr enabled */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -3101,6 +3446,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, /* double upper_hr_threshold = */ 0.9, /* double decrement = */ 0.9, @@ -3112,7 +3461,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 35 -- attempt to disable evictions when auto decr enabled */ + /* 40 -- attempt to disable evictions when auto decr enabled */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -3130,6 +3479,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out, /* double upper_hr_threshold = */ 0.9, /* double decrement = */ 0.9, diff --git a/test/cache_common.c b/test/cache_common.c index d2be959..25eb988 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -1722,6 +1722,91 @@ resize_entry(H5C_t * cache_ptr, /*------------------------------------------------------------------------- + * Function: resize_pinned_entry + * + * Purpose: Given a pointer to a cache, an entry type, an index, and + * a new size, change the size of the target pinned entry + * to match the supplied new size. + * + * Do nothing if pass is false on entry. + * + * Return: void + * + * Programmer: John Mainzer + * 1/11/08 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +void +resize_pinned_entry(H5C_t * cache_ptr, + int32_t type, + int32_t idx, + size_t new_size) +{ + herr_t result; + test_entry_t * base_addr; + test_entry_t * entry_ptr; + + HDassert( cache_ptr ); + HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); + HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); + HDassert( type = VARIABLE_ENTRY_TYPE ) ; + HDassert( ( 0 < new_size ) && ( new_size <= entry_sizes[type] ) ); + + if ( pass ) { + + if ( ! entry_in_cache(cache_ptr, type, idx) ) { + + pass = FALSE; + failure_mssg = "entry not in cache."; + + } else { + + base_addr = entries[type]; + entry_ptr = &(base_addr[idx]); + + HDassert( entry_ptr->index == idx ); + HDassert( entry_ptr->type == type ); + HDassert( entry_ptr == entry_ptr->self ); + + if ( ! ( (entry_ptr->header).is_pinned ) ) { + + pass = FALSE; + failure_mssg = "entry to be resized is not pinned."; + + } else { + + entry_ptr->size = new_size; + + result = H5C_resize_pinned_entry(cache_ptr, + (void *)entry_ptr, + new_size); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "error(s) in H5C_resize_pinned_entry()."; + + } else { + + HDassert( entry_ptr->size = (entry_ptr->header).size ); + + } + } + } + } + + return; + +} /* resize_pinned_entry() */ + + +/*------------------------------------------------------------------------- * Function: verify_clean * * Purpose: Verify that all cache entries are marked as clean. If any @@ -2460,6 +2545,12 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr, entry_ptr->is_dirty = TRUE; + if ( size_changed ) { + + /* update entry size now to keep the sanity checks happy */ + entry_ptr->size = new_size; + } + result = H5C_mark_pinned_entry_dirty(cache_ptr, (void *)entry_ptr, size_changed, @@ -2472,6 +2563,22 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr, ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { +#if 0 /* This is useful debugging code -- keep it around */ + HDfprintf(stdout, "result = %ld.\n", (long)result); + HDfprintf(stdout, "entry_ptr->header.is_dirty = %d.\n", + (int)(entry_ptr->header.is_dirty)); + HDfprintf(stdout, "entry_ptr->header.is_pinned = %d.\n", + (int)(entry_ptr->header.is_pinned)); + HDfprintf(stdout, + "(entry_ptr->header.type != &(types[type])) = %d.\n", + (int)(entry_ptr->header.type != &(types[type]))); + HDfprintf(stdout, + "entry_ptr->size = %ld, entry_ptr->header.size = %ld.\n", + (long)(entry_ptr->size), (long)(entry_ptr->header.size)); + HDfprintf(stdout, + "entry_ptr->addr = %ld, entry_ptr->header.addr = %ld.\n", + (long)(entry_ptr->addr), (long)(entry_ptr->header.addr)); +#endif pass = FALSE; failure_mssg = "error in H5C_mark_pinned_entry_dirty()."; diff --git a/test/cache_common.h b/test/cache_common.h index 23832dc..e1d33f2 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -655,6 +655,11 @@ void resize_entry(H5C_t * cache_ptr, size_t new_size, hbool_t resize_pin); +void resize_pinned_entry(H5C_t * cache_ptr, + int32_t type, + int32_t idx, + size_t new_size); + H5C_t * setup_cache(size_t max_cache_size, size_t min_clean_size); void row_major_scan_forward(H5C_t * cache_ptr, diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 243caa1..c5f8aae 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -5281,7 +5281,7 @@ trace_file_check(void) const char * expected_output[] = { "### HDF5 metadata cache trace file version 1 ###\n", - "H5AC_set_cache_auto_resize_config 1 0 1 0 \"t_cache_trace.txt\" 1 0 1048576 0.500000 16777216 1048576 50000 1 0.900000 2.000000 1 4194304 3 0.999000 0.900000 1 1048576 3 1 0.100000 262144 0\n", + "H5AC_set_cache_auto_resize_config 1 0 1 0 \"t_cache_trace.txt\" 1 0 1048576 0.500000 16777216 1048576 50000 1 0.900000 2.000000 1 1.000000 0.250000 1 4194304 3 0.999000 0.900000 1 1048576 3 1 0.100000 262144 0\n", "H5AC_set 0x0 15 0x0 2 0\n", "H5AC_set 0x2 15 0x0 2 0\n", "H5AC_set 0x4 15 0x0 4 0\n", -- cgit v0.12