diff options
Diffstat (limited to 'src/H5Cdbg.c')
-rw-r--r-- | src/H5Cdbg.c | 1028 |
1 files changed, 422 insertions, 606 deletions
diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c index dae735d..a8917ea 100644 --- a/src/H5Cdbg.c +++ b/src/H5Cdbg.c @@ -26,50 +26,42 @@ /* Module Setup */ /****************/ -#include "H5Cmodule.h" /* This source code file is part of the H5C module */ - +#include "H5Cmodule.h" /* This source code file is part of the H5C module */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata Cache */ -#include "H5Cpkg.h" /* Cache */ -#include "H5Eprivate.h" /* Error Handling */ - +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata Cache */ +#include "H5Cpkg.h" /* Cache */ +#include "H5Eprivate.h" /* Error Handling */ /****************/ /* Local Macros */ /****************/ - /******************/ /* Local Typedefs */ /******************/ - /********************/ /* Local Prototypes */ /********************/ - /*********************/ /* Package Variables */ /*********************/ - /*****************************/ /* Library Private Variables */ /*****************************/ - /*******************/ /* Local Variables */ /*******************/ - #ifndef NDEBUG - + /*------------------------------------------------------------------------- * Function: H5C_dump_cache * @@ -84,39 +76,39 @@ *------------------------------------------------------------------------- */ herr_t -H5C_dump_cache(H5C_t * cache_ptr, const char * cache_name) +H5C_dump_cache(H5C_t *cache_ptr, const char *cache_name) { - H5C_cache_entry_t * entry_ptr; - H5SL_t * slist_ptr = NULL; - int i; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + H5C_cache_entry_t *entry_ptr; + H5SL_t * slist_ptr = NULL; + int i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ HDassert(cache_ptr != NULL); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_name != NULL ); + HDassert(cache_name != NULL); /* First, create a skip list */ - if(NULL == (slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) + if (NULL == (slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create skip list") /* Next, scan the index, and insert all entries in the skip list. * Do this, as we want to display cache entries in increasing address * order. */ - for(i = 0; i < H5C__HASH_TABLE_LEN; i++) { + for (i = 0; i < H5C__HASH_TABLE_LEN; i++) { entry_ptr = cache_ptr->index[i]; - while(entry_ptr != NULL) { + while (entry_ptr != NULL) { HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - if(H5SL_insert(slist_ptr, entry_ptr, &(entry_ptr->addr)) < 0) + if (H5SL_insert(slist_ptr, entry_ptr, &(entry_ptr->addr)) < 0) HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "can't insert entry in skip list") entry_ptr = entry_ptr->ht_next; } /* end while */ - } /* end for */ + } /* end for */ /* If we get this far, all entries in the cache are listed in the * skip list -- scan the skip list generating the desired output. @@ -134,17 +126,18 @@ H5C_dump_cache(H5C_t * cache_ptr, const char * cache_name) HDfprintf(stdout, "| Prot/Pin/Dirty"); HDfprintf(stdout, "\n"); - HDfprintf(stdout, "----------------------------------------------------------------------------------------------------------------\n"); + HDfprintf(stdout, "--------------------------------------------------------------------------------------" + "--------------------------\n"); - i = 0; + i = 0; entry_ptr = (H5C_cache_entry_t *)H5SL_remove_first(slist_ptr); - while(entry_ptr != NULL) { + while (entry_ptr != NULL) { HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); /* Print entry */ HDfprintf(stdout, "%s%5d ", cache_ptr->prefix, i); HDfprintf(stdout, " 0x%16llx ", (long long)(entry_ptr->addr)); - if(NULL == entry_ptr->tag_info) + if (NULL == entry_ptr->tag_info) HDfprintf(stdout, " %16s ", "N/A"); else HDfprintf(stdout, " 0x%16llx ", (long long)(entry_ptr->tag_info->tag)); @@ -169,7 +162,7 @@ H5C_dump_cache(H5C_t * cache_ptr, const char * cache_name) done: /* Discard the skip list */ - if(slist_ptr) + if (slist_ptr) H5SL_close(slist_ptr); FUNC_LEAVE_NOAPI(ret_value) @@ -177,7 +170,7 @@ done: #endif /* NDEBUG */ #ifndef NDEBUG - + /*------------------------------------------------------------------------- * Function: H5C_dump_cache_LRU * @@ -194,21 +187,21 @@ done: herr_t H5C_dump_cache_LRU(H5C_t *cache_ptr, const char *cache_name) { - H5C_cache_entry_t * entry_ptr; - int i = 0; + H5C_cache_entry_t *entry_ptr; + int i = 0; FUNC_ENTER_NOAPI_NOERR /* Sanity check */ HDassert(cache_ptr != NULL); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_name != NULL ); + HDassert(cache_name != NULL); HDfprintf(stdout, "\n\nDump of metadata cache LRU \"%s\"\n", cache_name); - HDfprintf(stdout, "LRU len = %d, LRU size = %d\n", - cache_ptr->LRU_list_len, (int)(cache_ptr->LRU_list_size)); - HDfprintf(stdout, "index_size = %d, max_cache_size = %d, delta = %d\n\n", - (int)(cache_ptr->index_size), (int)(cache_ptr->max_cache_size), + HDfprintf(stdout, "LRU len = %d, LRU size = %d\n", cache_ptr->LRU_list_len, + (int)(cache_ptr->LRU_list_size)); + HDfprintf(stdout, "index_size = %d, max_cache_size = %d, delta = %d\n\n", (int)(cache_ptr->index_size), + (int)(cache_ptr->max_cache_size), (int)(cache_ptr->max_cache_size) - (int)(cache_ptr->index_size)); /* Print header */ @@ -221,26 +214,25 @@ H5C_dump_cache_LRU(H5C_t *cache_ptr, const char *cache_name) HDfprintf(stdout, "| Dirty"); HDfprintf(stdout, "\n"); - HDfprintf(stdout, "----------------------------------------------------------------------------------------------------------------\n"); + HDfprintf(stdout, "--------------------------------------------------------------------------------------" + "--------------------------\n"); entry_ptr = cache_ptr->LRU_head_ptr; - while(entry_ptr != NULL) { + while (entry_ptr != NULL) { HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); /* Print entry */ HDfprintf(stdout, "%s%5d ", cache_ptr->prefix, i); HDfprintf(stdout, " 0x%16llx ", (long long)(entry_ptr->addr)); - if(NULL == entry_ptr->tag_info) + if (NULL == entry_ptr->tag_info) HDfprintf(stdout, " %16s ", "N/A"); else - HDfprintf(stdout, " 0x%16llx ", - (long long)(entry_ptr->tag_info->tag)); + HDfprintf(stdout, " 0x%16llx ", (long long)(entry_ptr->tag_info->tag)); HDfprintf(stdout, " %5lld ", (long long)(entry_ptr->size)); HDfprintf(stdout, " %d ", (int)(entry_ptr->ring)); - HDfprintf(stdout, " %2d %-32s ", (int)(entry_ptr->type->id), - (entry_ptr->type->name)); + HDfprintf(stdout, " %2d %-32s ", (int)(entry_ptr->type->id), (entry_ptr->type->name)); HDfprintf(stdout, " %d", (int)(entry_ptr->is_dirty)); HDfprintf(stdout, "\n"); @@ -248,13 +240,13 @@ H5C_dump_cache_LRU(H5C_t *cache_ptr, const char *cache_name) entry_ptr = entry_ptr->next; } /* end while */ - HDfprintf(stdout, "----------------------------------------------------------------------------------------------------------------\n"); + HDfprintf(stdout, "--------------------------------------------------------------------------------------" + "--------------------------\n"); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5C_dump_cache_LRU() */ #endif /* NDEBUG */ - /*------------------------------------------------------------------------- * * Function: H5C_dump_cache_skip_list @@ -269,7 +261,7 @@ H5C_dump_cache_LRU(H5C_t *cache_ptr, const char *cache_name) * 11/15/14 * * Changes: Updated function for the slist_enabled field in H5C_t. - * Recall that to minimize slist overhead, the slist is + * Recall that to minimize slist overhead, the slist is * empty and not maintained if cache_ptr->slist_enabled is * false. * JRM -- 5/6/20 @@ -278,12 +270,12 @@ H5C_dump_cache_LRU(H5C_t *cache_ptr, const char *cache_name) */ #ifndef NDEBUG herr_t -H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn) +H5C_dump_cache_skip_list(H5C_t *cache_ptr, char *calling_fcn) { - herr_t ret_value = SUCCEED; /* Return value */ - int i; - H5C_cache_entry_t * entry_ptr = NULL; - H5SL_node_t * node_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + int i; + H5C_cache_entry_t *entry_ptr = NULL; + H5SL_node_t * node_ptr = NULL; FUNC_ENTER_NOAPI_NOERR @@ -291,60 +283,51 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn) HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(calling_fcn != NULL); - HDfprintf(stdout, "\n\nDumping metadata cache skip list from %s.\n", - calling_fcn); - HDfprintf(stdout, " slist %s.\n", - cache_ptr->slist_enabled ? "enabled" : "disabled"); + HDfprintf(stdout, "\n\nDumping metadata cache skip list from %s.\n", calling_fcn); + HDfprintf(stdout, " slist %s.\n", cache_ptr->slist_enabled ? "enabled" : "disabled"); HDfprintf(stdout, " slist len = %" PRIu32 ".\n", cache_ptr->slist_len); HDfprintf(stdout, " slist size = %zu.\n", cache_ptr->slist_size); - if(cache_ptr->slist_len > 0) { + if (cache_ptr->slist_len > 0) { /* If we get this far, all entries in the cache are listed in the * skip list -- scan the skip list generating the desired output. */ - HDfprintf(stdout, - "Num: Addr: Len: Prot/Pind: Dirty: Type:\n"); + HDfprintf(stdout, "Num: Addr: Len: Prot/Pind: Dirty: Type:\n"); i = 0; node_ptr = H5SL_first(cache_ptr->slist_ptr); - if ( node_ptr != NULL ) { + if (node_ptr != NULL) { entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - - } else { + } + else { entry_ptr = NULL; } - while ( entry_ptr != NULL ) { + while (entry_ptr != NULL) { - HDassert( entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDfprintf(stdout, - "%s%d 0x%016llx %4lld %d/%d %d %s\n", - cache_ptr->prefix, i, - (long long)(entry_ptr->addr), - (long long)(entry_ptr->size), - (int)(entry_ptr->is_protected), - (int)(entry_ptr->is_pinned), - (int)(entry_ptr->is_dirty), - entry_ptr->type->name); + HDfprintf(stdout, "%s%d 0x%016llx %4lld %d/%d %d %s\n", cache_ptr->prefix, i, + (long long)(entry_ptr->addr), (long long)(entry_ptr->size), + (int)(entry_ptr->is_protected), (int)(entry_ptr->is_pinned), (int)(entry_ptr->is_dirty), + entry_ptr->type->name); - HDfprintf(stdout, " node_ptr = %p, item = %p\n", - (void *)node_ptr, H5SL_item(node_ptr)); + HDfprintf(stdout, " node_ptr = %p, item = %p\n", (void *)node_ptr, H5SL_item(node_ptr)); /* increment node_ptr before we delete its target */ node_ptr = H5SL_next(node_ptr); - if ( node_ptr != NULL ) { + if (node_ptr != NULL) { entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - - } else { + } + else { entry_ptr = NULL; } @@ -352,7 +335,7 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn) i++; } /* end while */ - } /* end if */ + } /* end if */ HDfprintf(stdout, "\n\n"); @@ -361,7 +344,6 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn) } /* H5C_dump_cache_skip_list() */ #endif /* NDEBUG */ - /*------------------------------------------------------------------------- * Function: H5C_set_prefix * @@ -376,14 +358,14 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn) *------------------------------------------------------------------------- */ herr_t -H5C_set_prefix(H5C_t * cache_ptr, char * prefix) +H5C_set_prefix(H5C_t *cache_ptr, char *prefix) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC) || - (prefix == NULL) || (HDstrlen(prefix) >= H5C__PREFIX_LEN)) + if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC) || (prefix == NULL) || + (HDstrlen(prefix) >= H5C__PREFIX_LEN)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry") HDstrncpy(&(cache_ptr->prefix[0]), prefix, (size_t)(H5C__PREFIX_LEN)); @@ -394,7 +376,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_set_prefix() */ - /*------------------------------------------------------------------------- * Function: H5C_stats * @@ -408,479 +389,328 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_stats(H5C_t * cache_ptr, - const char * cache_name, +H5C_stats(H5C_t *cache_ptr, const char *cache_name, hbool_t #if !H5C_COLLECT_CACHE_STATS - H5_ATTR_UNUSED + H5_ATTR_UNUSED #endif /* H5C_COLLECT_CACHE_STATS */ - display_detailed_stats) + display_detailed_stats) { #if H5C_COLLECT_CACHE_STATS - int i; - int64_t total_hits = 0; - int64_t total_misses = 0; - int64_t total_write_protects = 0; - int64_t total_read_protects = 0; - int64_t max_read_protects = 0; - int64_t total_insertions = 0; - int64_t total_pinned_insertions = 0; - int64_t total_clears = 0; - int64_t total_flushes = 0; - int64_t total_evictions = 0; - int64_t total_take_ownerships = 0; - int64_t total_moves = 0; - int64_t total_entry_flush_moves = 0; - int64_t total_cache_flush_moves = 0; - int64_t total_size_increases = 0; - int64_t total_size_decreases = 0; - int64_t total_entry_flush_size_changes = 0; - int64_t total_cache_flush_size_changes = 0; - int64_t total_pins = 0; - int64_t total_unpins = 0; - int64_t total_dirty_pins = 0; - int64_t total_pinned_flushes = 0; - int64_t total_pinned_clears = 0; - int32_t aggregate_max_accesses = 0; - int32_t aggregate_min_accesses = 1000000; - int32_t aggregate_max_clears = 0; - int32_t aggregate_max_flushes = 0; - size_t aggregate_max_size = 0; - int32_t aggregate_max_pins = 0; - double hit_rate; - double prefetch_use_rate; - double average_successful_search_depth = 0.0f; - double average_failed_search_depth = 0.0f; - double average_entries_skipped_per_calls_to_msic = 0.0f; - double average_dirty_pf_entries_skipped_per_call_to_msic = 0.0f; - double average_entries_scanned_per_calls_to_msic = 0.0f; -#endif /* H5C_COLLECT_CACHE_STATS */ - herr_t ret_value = SUCCEED; /* Return value */ + int i; + int64_t total_hits = 0; + int64_t total_misses = 0; + int64_t total_write_protects = 0; + int64_t total_read_protects = 0; + int64_t max_read_protects = 0; + int64_t total_insertions = 0; + int64_t total_pinned_insertions = 0; + int64_t total_clears = 0; + int64_t total_flushes = 0; + int64_t total_evictions = 0; + int64_t total_take_ownerships = 0; + int64_t total_moves = 0; + int64_t total_entry_flush_moves = 0; + int64_t total_cache_flush_moves = 0; + int64_t total_size_increases = 0; + int64_t total_size_decreases = 0; + int64_t total_entry_flush_size_changes = 0; + int64_t total_cache_flush_size_changes = 0; + int64_t total_pins = 0; + int64_t total_unpins = 0; + int64_t total_dirty_pins = 0; + int64_t total_pinned_flushes = 0; + int64_t total_pinned_clears = 0; + int32_t aggregate_max_accesses = 0; + int32_t aggregate_min_accesses = 1000000; + int32_t aggregate_max_clears = 0; + int32_t aggregate_max_flushes = 0; + size_t aggregate_max_size = 0; + int32_t aggregate_max_pins = 0; + double hit_rate; + double prefetch_use_rate; + double average_successful_search_depth = 0.0f; + double average_failed_search_depth = 0.0f; + double average_entries_skipped_per_calls_to_msic = 0.0f; + double average_dirty_pf_entries_skipped_per_call_to_msic = 0.0f; + double average_entries_scanned_per_calls_to_msic = 0.0f; +#endif /* H5C_COLLECT_CACHE_STATS */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); /* This would normally be an assert, but we need to use an HGOTO_ERROR * call to shut up the compiler. */ - if((NULL == cache_ptr) || (cache_ptr->magic != H5C__H5C_T_MAGIC) || - (NULL == cache_name)) + if ((NULL == cache_ptr) || (cache_ptr->magic != H5C__H5C_T_MAGIC) || (NULL == cache_name)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr or cache_name") #if H5C_COLLECT_CACHE_STATS - for(i = 0; i <= cache_ptr->max_type_id; i++ ) { - total_hits += cache_ptr->hits[i]; - total_misses += cache_ptr->misses[i]; - total_write_protects += cache_ptr->write_protects[i]; - total_read_protects += cache_ptr->read_protects[i]; - if(max_read_protects < cache_ptr->max_read_protects[i]) - max_read_protects = cache_ptr->max_read_protects[i]; - total_insertions += cache_ptr->insertions[i]; + for (i = 0; i <= cache_ptr->max_type_id; i++) { + total_hits += cache_ptr->hits[i]; + total_misses += cache_ptr->misses[i]; + total_write_protects += cache_ptr->write_protects[i]; + total_read_protects += cache_ptr->read_protects[i]; + if (max_read_protects < cache_ptr->max_read_protects[i]) + max_read_protects = cache_ptr->max_read_protects[i]; + total_insertions += cache_ptr->insertions[i]; total_pinned_insertions += cache_ptr->pinned_insertions[i]; - total_clears += cache_ptr->clears[i]; - total_flushes += cache_ptr->flushes[i]; - total_evictions += cache_ptr->evictions[i]; - total_take_ownerships += cache_ptr->take_ownerships[i]; - total_moves += cache_ptr->moves[i]; - total_entry_flush_moves += cache_ptr->entry_flush_moves[i]; - total_cache_flush_moves += cache_ptr->cache_flush_moves[i]; - total_size_increases += cache_ptr->size_increases[i]; - total_size_decreases += cache_ptr->size_decreases[i]; - total_entry_flush_size_changes - += cache_ptr->entry_flush_size_changes[i]; - total_cache_flush_size_changes - += cache_ptr->cache_flush_size_changes[i]; - total_pins += cache_ptr->pins[i]; - total_unpins += cache_ptr->unpins[i]; - total_dirty_pins += cache_ptr->dirty_pins[i]; - total_pinned_flushes += cache_ptr->pinned_flushes[i]; - total_pinned_clears += cache_ptr->pinned_clears[i]; + total_clears += cache_ptr->clears[i]; + total_flushes += cache_ptr->flushes[i]; + total_evictions += cache_ptr->evictions[i]; + total_take_ownerships += cache_ptr->take_ownerships[i]; + total_moves += cache_ptr->moves[i]; + total_entry_flush_moves += cache_ptr->entry_flush_moves[i]; + total_cache_flush_moves += cache_ptr->cache_flush_moves[i]; + total_size_increases += cache_ptr->size_increases[i]; + total_size_decreases += cache_ptr->size_decreases[i]; + total_entry_flush_size_changes += cache_ptr->entry_flush_size_changes[i]; + total_cache_flush_size_changes += cache_ptr->cache_flush_size_changes[i]; + total_pins += cache_ptr->pins[i]; + total_unpins += cache_ptr->unpins[i]; + total_dirty_pins += cache_ptr->dirty_pins[i]; + total_pinned_flushes += cache_ptr->pinned_flushes[i]; + total_pinned_clears += cache_ptr->pinned_clears[i]; #if H5C_COLLECT_CACHE_ENTRY_STATS - if(aggregate_max_accesses < cache_ptr->max_accesses[i]) + if (aggregate_max_accesses < cache_ptr->max_accesses[i]) aggregate_max_accesses = cache_ptr->max_accesses[i]; - if(aggregate_min_accesses > aggregate_max_accesses) + if (aggregate_min_accesses > aggregate_max_accesses) aggregate_min_accesses = aggregate_max_accesses; - if(aggregate_min_accesses > cache_ptr->min_accesses[i]) + if (aggregate_min_accesses > cache_ptr->min_accesses[i]) aggregate_min_accesses = cache_ptr->min_accesses[i]; - if(aggregate_max_clears < cache_ptr->max_clears[i]) + if (aggregate_max_clears < cache_ptr->max_clears[i]) aggregate_max_clears = cache_ptr->max_clears[i]; - if(aggregate_max_flushes < cache_ptr->max_flushes[i]) + if (aggregate_max_flushes < cache_ptr->max_flushes[i]) aggregate_max_flushes = cache_ptr->max_flushes[i]; - if(aggregate_max_size < cache_ptr->max_size[i]) + if (aggregate_max_size < cache_ptr->max_size[i]) aggregate_max_size = cache_ptr->max_size[i]; - if(aggregate_max_pins < cache_ptr->max_pins[i]) + if (aggregate_max_pins < cache_ptr->max_pins[i]) aggregate_max_pins = cache_ptr->max_pins[i]; #endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ - } /* end for */ + } /* end for */ - if((total_hits > 0) || (total_misses > 0)) - hit_rate = (double)100.0f * ((double)(total_hits)) / - ((double)(total_hits + total_misses)); + if ((total_hits > 0) || (total_misses > 0)) + hit_rate = (double)100.0f * ((double)(total_hits)) / ((double)(total_hits + total_misses)); else hit_rate = 0.0f; - if(cache_ptr->successful_ht_searches > 0) - average_successful_search_depth = - ((double)(cache_ptr->total_successful_ht_search_depth)) / - ((double)(cache_ptr->successful_ht_searches)); + if (cache_ptr->successful_ht_searches > 0) + average_successful_search_depth = ((double)(cache_ptr->total_successful_ht_search_depth)) / + ((double)(cache_ptr->successful_ht_searches)); - if(cache_ptr->failed_ht_searches > 0) + if (cache_ptr->failed_ht_searches > 0) average_failed_search_depth = - ((double)(cache_ptr->total_failed_ht_search_depth)) / - ((double)(cache_ptr->failed_ht_searches)); + ((double)(cache_ptr->total_failed_ht_search_depth)) / ((double)(cache_ptr->failed_ht_searches)); - - HDfprintf(stdout, "\n%sH5C: cache statistics for %s\n", - cache_ptr->prefix, cache_name); + HDfprintf(stdout, "\n%sH5C: cache statistics for %s\n", cache_ptr->prefix, cache_name); HDfprintf(stdout, "\n"); - HDfprintf(stdout, - "%s hash table insertion / deletions = %ld / %ld\n", - cache_ptr->prefix, - (long)(cache_ptr->total_ht_insertions), - (long)(cache_ptr->total_ht_deletions)); - - HDfprintf(stdout, - "%s HT successful / failed searches = %ld / %ld\n", - cache_ptr->prefix, - (long)(cache_ptr->successful_ht_searches), - (long)(cache_ptr->failed_ht_searches)); - - HDfprintf(stdout, - "%s Av. HT suc / failed search depth = %f / %f\n", - cache_ptr->prefix, - average_successful_search_depth, - average_failed_search_depth); - - HDfprintf(stdout, - "%s current (max) index size / length = %ld (%ld) / %lu (%lu)\n", - cache_ptr->prefix, - (long)(cache_ptr->index_size), - (long)(cache_ptr->max_index_size), - (unsigned long)(cache_ptr->index_len), - (unsigned long)(cache_ptr->max_index_len)); - - HDfprintf(stdout, - "%s current (max) clean/dirty idx size = %ld (%ld) / %ld (%ld)\n", - cache_ptr->prefix, - (long)(cache_ptr->clean_index_size), - (long)(cache_ptr->max_clean_index_size), - (long)(cache_ptr->dirty_index_size), - (long)(cache_ptr->max_dirty_index_size)); - - HDfprintf(stdout, - "%s current (max) slist size / length = %ld (%ld) / %lu (%lu)\n", - cache_ptr->prefix, - (long)(cache_ptr->slist_size), - (long)(cache_ptr->max_slist_size), - (unsigned long)(cache_ptr->slist_len), - (unsigned long)(cache_ptr->max_slist_len)); - - HDfprintf(stdout, - "%s current (max) PL size / length = %ld (%ld) / %lu (%lu)\n", - cache_ptr->prefix, - (long)(cache_ptr->pl_size), - (long)(cache_ptr->max_pl_size), - (unsigned long)(cache_ptr->pl_len), + HDfprintf(stdout, "%s hash table insertion / deletions = %ld / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->total_ht_insertions), (long)(cache_ptr->total_ht_deletions)); + + HDfprintf(stdout, "%s HT successful / failed searches = %ld / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->successful_ht_searches), (long)(cache_ptr->failed_ht_searches)); + + HDfprintf(stdout, "%s Av. HT suc / failed search depth = %f / %f\n", cache_ptr->prefix, + average_successful_search_depth, average_failed_search_depth); + + HDfprintf(stdout, "%s current (max) index size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix, + (long)(cache_ptr->index_size), (long)(cache_ptr->max_index_size), + (unsigned long)(cache_ptr->index_len), (unsigned long)(cache_ptr->max_index_len)); + + HDfprintf(stdout, "%s current (max) clean/dirty idx size = %ld (%ld) / %ld (%ld)\n", cache_ptr->prefix, + (long)(cache_ptr->clean_index_size), (long)(cache_ptr->max_clean_index_size), + (long)(cache_ptr->dirty_index_size), (long)(cache_ptr->max_dirty_index_size)); + + HDfprintf(stdout, "%s current (max) slist size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix, + (long)(cache_ptr->slist_size), (long)(cache_ptr->max_slist_size), + (unsigned long)(cache_ptr->slist_len), (unsigned long)(cache_ptr->max_slist_len)); + + HDfprintf(stdout, "%s current (max) PL size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix, + (long)(cache_ptr->pl_size), (long)(cache_ptr->max_pl_size), (unsigned long)(cache_ptr->pl_len), (unsigned long)(cache_ptr->max_pl_len)); - HDfprintf(stdout, - "%s current (max) PEL size / length = %ld (%ld) / %lu (%lu)\n", - cache_ptr->prefix, - (long)(cache_ptr->pel_size), - (long)(cache_ptr->max_pel_size), - (unsigned long)(cache_ptr->pel_len), - (unsigned long)(cache_ptr->max_pel_len)); + HDfprintf(stdout, "%s current (max) PEL size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix, + (long)(cache_ptr->pel_size), (long)(cache_ptr->max_pel_size), + (unsigned long)(cache_ptr->pel_len), (unsigned long)(cache_ptr->max_pel_len)); - HDfprintf(stdout, - "%s current LRU list size / length = %ld / %lu\n", - cache_ptr->prefix, - (long)(cache_ptr->LRU_list_size), - (unsigned long)(cache_ptr->LRU_list_len)); + HDfprintf(stdout, "%s current LRU list size / length = %ld / %lu\n", cache_ptr->prefix, + (long)(cache_ptr->LRU_list_size), (unsigned long)(cache_ptr->LRU_list_len)); #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - HDfprintf(stdout, - "%s current clean LRU size / length = %ld / %lu\n", - cache_ptr->prefix, - (long)(cache_ptr->cLRU_list_size), - (unsigned long)(cache_ptr->cLRU_list_len)); - - HDfprintf(stdout, - "%s current dirty LRU size / length = %ld / %lu\n", - cache_ptr->prefix, - (long)(cache_ptr->dLRU_list_size), - (unsigned long)(cache_ptr->dLRU_list_len)); + HDfprintf(stdout, "%s current clean LRU size / length = %ld / %lu\n", cache_ptr->prefix, + (long)(cache_ptr->cLRU_list_size), (unsigned long)(cache_ptr->cLRU_list_len)); + + HDfprintf(stdout, "%s current dirty LRU size / length = %ld / %lu\n", cache_ptr->prefix, + (long)(cache_ptr->dLRU_list_size), (unsigned long)(cache_ptr->dLRU_list_len)); #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - HDfprintf(stdout, - "%s Total hits / misses / hit_rate = %ld / %ld / %f\n", - cache_ptr->prefix, - (long)total_hits, - (long)total_misses, - hit_rate); - - HDfprintf(stdout, - "%s Total write / read (max) protects = %ld / %ld (%ld)\n", - cache_ptr->prefix, - (long)total_write_protects, - (long)total_read_protects, - (long)max_read_protects); - - HDfprintf(stdout, - "%s Total clears / flushes = %ld / %ld\n", - cache_ptr->prefix, - (long)total_clears, - (long)total_flushes); - - HDfprintf(stdout, - "%s Total evictions / take ownerships = %ld / %ld\n", - cache_ptr->prefix, - (long)total_evictions, - (long)total_take_ownerships); - - HDfprintf(stdout, - "%s Total insertions(pinned) / moves = %ld(%ld) / %ld\n", - cache_ptr->prefix, - (long)total_insertions, - (long)total_pinned_insertions, - (long)total_moves); - - HDfprintf(stdout, - "%s Total entry / cache flush moves = %ld / %ld\n", - cache_ptr->prefix, - (long)total_entry_flush_moves, - (long)total_cache_flush_moves); - - HDfprintf(stdout, "%s Total entry size incrs / decrs = %ld / %ld\n", - cache_ptr->prefix, - (long)total_size_increases, - (long)total_size_decreases); - - HDfprintf(stdout, "%s Ttl entry/cache flush size changes = %ld / %ld\n", - cache_ptr->prefix, - (long)total_entry_flush_size_changes, - (long)total_cache_flush_size_changes); - - HDfprintf(stdout, - "%s Total entry pins (dirty) / unpins = %ld (%ld) / %ld\n", - cache_ptr->prefix, - (long)total_pins, - (long)total_dirty_pins, - (long)total_unpins); - - HDfprintf(stdout, "%s Total pinned flushes / clears = %ld / %ld\n", - cache_ptr->prefix, - (long)total_pinned_flushes, - (long)total_pinned_clears); - - HDfprintf(stdout, "%s MSIC: (make space in cache) calls = %lld\n", - cache_ptr->prefix, + HDfprintf(stdout, "%s Total hits / misses / hit_rate = %ld / %ld / %f\n", cache_ptr->prefix, + (long)total_hits, (long)total_misses, hit_rate); + + HDfprintf(stdout, "%s Total write / read (max) protects = %ld / %ld (%ld)\n", cache_ptr->prefix, + (long)total_write_protects, (long)total_read_protects, (long)max_read_protects); + + HDfprintf(stdout, "%s Total clears / flushes = %ld / %ld\n", cache_ptr->prefix, + (long)total_clears, (long)total_flushes); + + HDfprintf(stdout, "%s Total evictions / take ownerships = %ld / %ld\n", cache_ptr->prefix, + (long)total_evictions, (long)total_take_ownerships); + + HDfprintf(stdout, "%s Total insertions(pinned) / moves = %ld(%ld) / %ld\n", cache_ptr->prefix, + (long)total_insertions, (long)total_pinned_insertions, (long)total_moves); + + HDfprintf(stdout, "%s Total entry / cache flush moves = %ld / %ld\n", cache_ptr->prefix, + (long)total_entry_flush_moves, (long)total_cache_flush_moves); + + HDfprintf(stdout, "%s Total entry size incrs / decrs = %ld / %ld\n", cache_ptr->prefix, + (long)total_size_increases, (long)total_size_decreases); + + HDfprintf(stdout, "%s Ttl entry/cache flush size changes = %ld / %ld\n", cache_ptr->prefix, + (long)total_entry_flush_size_changes, (long)total_cache_flush_size_changes); + + HDfprintf(stdout, "%s Total entry pins (dirty) / unpins = %ld (%ld) / %ld\n", cache_ptr->prefix, + (long)total_pins, (long)total_dirty_pins, (long)total_unpins); + + HDfprintf(stdout, "%s Total pinned flushes / clears = %ld / %ld\n", cache_ptr->prefix, + (long)total_pinned_flushes, (long)total_pinned_clears); + + HDfprintf(stdout, "%s MSIC: (make space in cache) calls = %lld\n", cache_ptr->prefix, (long long)(cache_ptr->calls_to_msic)); if (cache_ptr->calls_to_msic > 0) average_entries_skipped_per_calls_to_msic = - (((double)(cache_ptr->total_entries_skipped_in_msic)) / - ((double)(cache_ptr->calls_to_msic))); + (((double)(cache_ptr->total_entries_skipped_in_msic)) / ((double)(cache_ptr->calls_to_msic))); - HDfprintf(stdout, "%s MSIC: Average/max entries skipped = %lf / %ld\n", - cache_ptr->prefix, + HDfprintf(stdout, "%s MSIC: Average/max entries skipped = %lf / %ld\n", cache_ptr->prefix, (double)average_entries_skipped_per_calls_to_msic, (long)(cache_ptr->max_entries_skipped_in_msic)); - if(cache_ptr->calls_to_msic > 0) + if (cache_ptr->calls_to_msic > 0) average_dirty_pf_entries_skipped_per_call_to_msic = (((double)(cache_ptr->total_dirty_pf_entries_skipped_in_msic)) / - ((double)(cache_ptr->calls_to_msic))); + ((double)(cache_ptr->calls_to_msic))); - HDfprintf(stdout, - "%s MSIC: Average/max dirty pf entries skipped = %lf / %ld\n", - cache_ptr->prefix, + HDfprintf(stdout, "%s MSIC: Average/max dirty pf entries skipped = %lf / %ld\n", cache_ptr->prefix, average_dirty_pf_entries_skipped_per_call_to_msic, (long)(cache_ptr->max_dirty_pf_entries_skipped_in_msic)); - if(cache_ptr->calls_to_msic > 0) + if (cache_ptr->calls_to_msic > 0) average_entries_scanned_per_calls_to_msic = - (((double)(cache_ptr->total_entries_scanned_in_msic)) / - ((double)(cache_ptr->calls_to_msic))); + (((double)(cache_ptr->total_entries_scanned_in_msic)) / ((double)(cache_ptr->calls_to_msic))); - HDfprintf(stdout, "%s MSIC: Average/max entries scanned = %lf / %ld\n", - cache_ptr->prefix, + HDfprintf(stdout, "%s MSIC: Average/max entries scanned = %lf / %ld\n", cache_ptr->prefix, (double)average_entries_scanned_per_calls_to_msic, (long)(cache_ptr->max_entries_scanned_in_msic)); - HDfprintf(stdout, "%s MSIC: Scanned to make space(evict) = %lld\n", - cache_ptr->prefix, + HDfprintf(stdout, "%s MSIC: Scanned to make space(evict) = %lld\n", cache_ptr->prefix, (long long)(cache_ptr->entries_scanned_to_make_space)); - HDfprintf(stdout, "%s MSIC: Scanned to satisfy min_clean = %lld\n", - cache_ptr->prefix, - (long long)(cache_ptr->total_entries_scanned_in_msic - - cache_ptr->entries_scanned_to_make_space)); + HDfprintf( + stdout, "%s MSIC: Scanned to satisfy min_clean = %lld\n", cache_ptr->prefix, + (long long)(cache_ptr->total_entries_scanned_in_msic - cache_ptr->entries_scanned_to_make_space)); - HDfprintf(stdout, - "%s slist/LRU/index scan restarts = %lld / %lld / %lld.\n", - cache_ptr->prefix, - (long long)(cache_ptr->slist_scan_restarts), - (long long)(cache_ptr->LRU_scan_restarts), + HDfprintf(stdout, "%s slist/LRU/index scan restarts = %lld / %lld / %lld.\n", cache_ptr->prefix, + (long long)(cache_ptr->slist_scan_restarts), (long long)(cache_ptr->LRU_scan_restarts), (long long)(cache_ptr->index_scan_restarts)); - HDfprintf(stdout, - "%s cache image creations/reads/loads/size = %d / %d /%d / %" PRIuHSIZE "\n", - cache_ptr->prefix, - cache_ptr->images_created, - cache_ptr->images_read, - cache_ptr->images_loaded, + HDfprintf(stdout, "%s cache image creations/reads/loads/size = %d / %d /%d / %" PRIuHSIZE "\n", + cache_ptr->prefix, cache_ptr->images_created, cache_ptr->images_read, cache_ptr->images_loaded, cache_ptr->last_image_size); - HDfprintf(stdout, - "%s prefetches / dirty prefetches = %lld / %lld\n", - cache_ptr->prefix, - (long long)(cache_ptr->prefetches), - (long long)(cache_ptr->dirty_prefetches)); + HDfprintf(stdout, "%s prefetches / dirty prefetches = %lld / %lld\n", cache_ptr->prefix, + (long long)(cache_ptr->prefetches), (long long)(cache_ptr->dirty_prefetches)); - HDfprintf(stdout, - "%s prefetch hits/flushes/evictions = %lld / %lld / %lld\n", - cache_ptr->prefix, + HDfprintf(stdout, "%s prefetch hits/flushes/evictions = %lld / %lld / %lld\n", cache_ptr->prefix, (long long)(cache_ptr->prefetch_hits), (long long)(cache_ptr->flushes[H5AC_PREFETCHED_ENTRY_ID]), (long long)(cache_ptr->evictions[H5AC_PREFETCHED_ENTRY_ID])); - if(cache_ptr->prefetches > 0) + if (cache_ptr->prefetches > 0) prefetch_use_rate = - (double)100.0f * ((double)(cache_ptr->prefetch_hits)) / - ((double)(cache_ptr->prefetches)); + (double)100.0f * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches)); else prefetch_use_rate = 0.0f; - HDfprintf(stdout, - "%s prefetched entry use rate = %lf\n", - cache_ptr->prefix, - prefetch_use_rate); + HDfprintf(stdout, "%s prefetched entry use rate = %lf\n", cache_ptr->prefix, prefetch_use_rate); #if H5C_COLLECT_CACHE_ENTRY_STATS - HDfprintf(stdout, "%s aggregate max / min accesses = %d / %d\n", - cache_ptr->prefix, - (int)aggregate_max_accesses, - (int)aggregate_min_accesses); + HDfprintf(stdout, "%s aggregate max / min accesses = %d / %d\n", cache_ptr->prefix, + (int)aggregate_max_accesses, (int)aggregate_min_accesses); - HDfprintf(stdout, "%s aggregate max_clears / max_flushes = %d / %d\n", - cache_ptr->prefix, - (int)aggregate_max_clears, - (int)aggregate_max_flushes); + HDfprintf(stdout, "%s aggregate max_clears / max_flushes = %d / %d\n", cache_ptr->prefix, + (int)aggregate_max_clears, (int)aggregate_max_flushes); - HDfprintf(stdout, "%s aggregate max_size / max_pins = %d / %d\n", - cache_ptr->prefix, - (int)aggregate_max_size, - (int)aggregate_max_pins); + HDfprintf(stdout, "%s aggregate max_size / max_pins = %d / %d\n", cache_ptr->prefix, + (int)aggregate_max_size, (int)aggregate_max_pins); #endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ - if(display_detailed_stats) { - for(i = 0; i <= cache_ptr->max_type_id; i++) { + if (display_detailed_stats) { + for (i = 0; i <= cache_ptr->max_type_id; i++) { HDfprintf(stdout, "\n"); - HDfprintf(stdout, "%s Stats on %s:\n", - cache_ptr->prefix, + HDfprintf(stdout, "%s Stats on %s:\n", cache_ptr->prefix, ((cache_ptr->class_table_ptr))[i]->name); - if((cache_ptr->hits[i] > 0) || (cache_ptr->misses[i] > 0)) + if ((cache_ptr->hits[i] > 0) || (cache_ptr->misses[i] > 0)) hit_rate = (double)100.0f * ((double)(cache_ptr->hits[i])) / - ((double)(cache_ptr->hits[i] + cache_ptr->misses[i])); + ((double)(cache_ptr->hits[i] + cache_ptr->misses[i])); else hit_rate = 0.0f; - HDfprintf(stdout, - "%s hits / misses / hit_rate = %ld / %ld / %f\n", - cache_ptr->prefix, - (long)(cache_ptr->hits[i]), - (long)(cache_ptr->misses[i]), - hit_rate); - - HDfprintf(stdout, - "%s write / read (max) protects = %ld / %ld (%d)\n", - cache_ptr->prefix, - (long)(cache_ptr->write_protects[i]), - (long)(cache_ptr->read_protects[i]), + HDfprintf(stdout, "%s hits / misses / hit_rate = %ld / %ld / %f\n", cache_ptr->prefix, + (long)(cache_ptr->hits[i]), (long)(cache_ptr->misses[i]), hit_rate); + + HDfprintf(stdout, "%s write / read (max) protects = %ld / %ld (%d)\n", cache_ptr->prefix, + (long)(cache_ptr->write_protects[i]), (long)(cache_ptr->read_protects[i]), (int)(cache_ptr->max_read_protects[i])); - HDfprintf(stdout, - "%s clears / flushes = %ld / %ld\n", - cache_ptr->prefix, - (long)(cache_ptr->clears[i]), - (long)(cache_ptr->flushes[i])); - - HDfprintf(stdout, - "%s evictions / take ownerships = %ld / %ld\n", - cache_ptr->prefix, - (long)(cache_ptr->evictions[i]), - (long)(cache_ptr->take_ownerships[i])); - - HDfprintf(stdout, - "%s insertions(pinned) / moves = %ld(%ld) / %ld\n", - cache_ptr->prefix, - (long)(cache_ptr->insertions[i]), - (long)(cache_ptr->pinned_insertions[i]), + HDfprintf(stdout, "%s clears / flushes = %ld / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->clears[i]), (long)(cache_ptr->flushes[i])); + + HDfprintf(stdout, "%s evictions / take ownerships = %ld / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->evictions[i]), (long)(cache_ptr->take_ownerships[i])); + + HDfprintf(stdout, "%s insertions(pinned) / moves = %ld(%ld) / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->insertions[i]), (long)(cache_ptr->pinned_insertions[i]), (long)(cache_ptr->moves[i])); - HDfprintf(stdout, - "%s entry / cache flush moves = %ld / %ld\n", - cache_ptr->prefix, - (long)(cache_ptr->entry_flush_moves[i]), - (long)(cache_ptr->cache_flush_moves[i])); - - HDfprintf(stdout, - "%s size increases / decreases = %ld / %ld\n", - cache_ptr->prefix, - (long)(cache_ptr->size_increases[i]), - (long)(cache_ptr->size_decreases[i])); - - HDfprintf(stdout, - "%s entry/cache flush size changes = %ld / %ld\n", - cache_ptr->prefix, + HDfprintf(stdout, "%s entry / cache flush moves = %ld / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->entry_flush_moves[i]), (long)(cache_ptr->cache_flush_moves[i])); + + HDfprintf(stdout, "%s size increases / decreases = %ld / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->size_increases[i]), (long)(cache_ptr->size_decreases[i])); + + HDfprintf(stdout, "%s entry/cache flush size changes = %ld / %ld\n", cache_ptr->prefix, (long)(cache_ptr->entry_flush_size_changes[i]), (long)(cache_ptr->cache_flush_size_changes[i])); + HDfprintf(stdout, "%s entry pins / unpins = %ld / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->pins[i]), (long)(cache_ptr->unpins[i])); - HDfprintf(stdout, - "%s entry pins / unpins = %ld / %ld\n", - cache_ptr->prefix, - (long)(cache_ptr->pins[i]), - (long)(cache_ptr->unpins[i])); - - HDfprintf(stdout, - "%s entry dirty pins/pin'd flushes = %ld / %ld\n", - cache_ptr->prefix, - (long)(cache_ptr->dirty_pins[i]), - (long)(cache_ptr->pinned_flushes[i])); + HDfprintf(stdout, "%s entry dirty pins/pin'd flushes = %ld / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->dirty_pins[i]), (long)(cache_ptr->pinned_flushes[i])); #if H5C_COLLECT_CACHE_ENTRY_STATS - HDfprintf(stdout, - "%s entry max / min accesses = %d / %d\n", - cache_ptr->prefix, - cache_ptr->max_accesses[i], - cache_ptr->min_accesses[i]); + HDfprintf(stdout, "%s entry max / min accesses = %d / %d\n", cache_ptr->prefix, + cache_ptr->max_accesses[i], cache_ptr->min_accesses[i]); - HDfprintf(stdout, - "%s entry max_clears / max_flushes = %d / %d\n", - cache_ptr->prefix, - cache_ptr->max_clears[i], - cache_ptr->max_flushes[i]); - - HDfprintf(stdout, - "%s entry max_size / max_pins = %d / %d\n", - cache_ptr->prefix, - (int)(cache_ptr->max_size[i]), - (int)(cache_ptr->max_pins[i])); + HDfprintf(stdout, "%s entry max_clears / max_flushes = %d / %d\n", cache_ptr->prefix, + cache_ptr->max_clears[i], cache_ptr->max_flushes[i]); + HDfprintf(stdout, "%s entry max_size / max_pins = %d / %d\n", cache_ptr->prefix, + (int)(cache_ptr->max_size[i]), (int)(cache_ptr->max_pins[i])); #endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ } /* end for */ - } /* end if */ + } /* end if */ HDfprintf(stdout, "\n"); @@ -890,7 +720,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_stats() */ - /*------------------------------------------------------------------------- * * Function: H5C_stats__reset @@ -905,12 +734,12 @@ done: */ void #ifndef NDEBUG -H5C_stats__reset(H5C_t * cache_ptr) +H5C_stats__reset(H5C_t *cache_ptr) #else /* NDEBUG */ #if H5C_COLLECT_CACHE_STATS -H5C_stats__reset(H5C_t * cache_ptr) -#else /* H5C_COLLECT_CACHE_STATS */ -H5C_stats__reset(H5C_t H5_ATTR_UNUSED * cache_ptr) +H5C_stats__reset(H5C_t *cache_ptr) +#else /* H5C_COLLECT_CACHE_STATS */ +H5C_stats__reset(H5C_t H5_ATTR_UNUSED *cache_ptr) #endif /* H5C_COLLECT_CACHE_STATS */ #endif /* NDEBUG */ { @@ -922,52 +751,52 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED * cache_ptr) HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); #if H5C_COLLECT_CACHE_STATS - for(i = 0; i <= cache_ptr->max_type_id; i++) { - cache_ptr->hits[i] = 0; - cache_ptr->misses[i] = 0; - cache_ptr->write_protects[i] = 0; - cache_ptr->read_protects[i] = 0; - cache_ptr->max_read_protects[i] = 0; - cache_ptr->insertions[i] = 0; - cache_ptr->pinned_insertions[i] = 0; - cache_ptr->clears[i] = 0; - cache_ptr->flushes[i] = 0; - cache_ptr->evictions[i] = 0; - cache_ptr->take_ownerships[i] = 0; - cache_ptr->moves[i] = 0; - cache_ptr->entry_flush_moves[i] = 0; - cache_ptr->cache_flush_moves[i] = 0; - cache_ptr->pins[i] = 0; - cache_ptr->unpins[i] = 0; - cache_ptr->dirty_pins[i] = 0; - cache_ptr->pinned_flushes[i] = 0; - cache_ptr->pinned_clears[i] = 0; - cache_ptr->size_increases[i] = 0; - cache_ptr->size_decreases[i] = 0; - cache_ptr->entry_flush_size_changes[i] = 0; - cache_ptr->cache_flush_size_changes[i] = 0; + for (i = 0; i <= cache_ptr->max_type_id; i++) { + cache_ptr->hits[i] = 0; + cache_ptr->misses[i] = 0; + cache_ptr->write_protects[i] = 0; + cache_ptr->read_protects[i] = 0; + cache_ptr->max_read_protects[i] = 0; + cache_ptr->insertions[i] = 0; + cache_ptr->pinned_insertions[i] = 0; + cache_ptr->clears[i] = 0; + cache_ptr->flushes[i] = 0; + cache_ptr->evictions[i] = 0; + cache_ptr->take_ownerships[i] = 0; + cache_ptr->moves[i] = 0; + cache_ptr->entry_flush_moves[i] = 0; + cache_ptr->cache_flush_moves[i] = 0; + cache_ptr->pins[i] = 0; + cache_ptr->unpins[i] = 0; + cache_ptr->dirty_pins[i] = 0; + cache_ptr->pinned_flushes[i] = 0; + cache_ptr->pinned_clears[i] = 0; + cache_ptr->size_increases[i] = 0; + cache_ptr->size_decreases[i] = 0; + cache_ptr->entry_flush_size_changes[i] = 0; + cache_ptr->cache_flush_size_changes[i] = 0; } /* end for */ - cache_ptr->total_ht_insertions = 0; - cache_ptr->total_ht_deletions = 0; - cache_ptr->successful_ht_searches = 0; - cache_ptr->total_successful_ht_search_depth = 0; - cache_ptr->failed_ht_searches = 0; - cache_ptr->total_failed_ht_search_depth = 0; + cache_ptr->total_ht_insertions = 0; + cache_ptr->total_ht_deletions = 0; + cache_ptr->successful_ht_searches = 0; + cache_ptr->total_successful_ht_search_depth = 0; + cache_ptr->failed_ht_searches = 0; + cache_ptr->total_failed_ht_search_depth = 0; - cache_ptr->max_index_len = 0; - cache_ptr->max_index_size = (size_t)0; - cache_ptr->max_clean_index_size = (size_t)0; - cache_ptr->max_dirty_index_size = (size_t)0; + cache_ptr->max_index_len = 0; + cache_ptr->max_index_size = (size_t)0; + cache_ptr->max_clean_index_size = (size_t)0; + cache_ptr->max_dirty_index_size = (size_t)0; - cache_ptr->max_slist_len = 0; - cache_ptr->max_slist_size = (size_t)0; + cache_ptr->max_slist_len = 0; + cache_ptr->max_slist_size = (size_t)0; - cache_ptr->max_pl_len = 0; - cache_ptr->max_pl_size = (size_t)0; + cache_ptr->max_pl_len = 0; + cache_ptr->max_pl_size = (size_t)0; - cache_ptr->max_pel_len = 0; - cache_ptr->max_pel_size = (size_t)0; + cache_ptr->max_pel_len = 0; + cache_ptr->max_pel_size = (size_t)0; cache_ptr->calls_to_msic = 0; cache_ptr->total_entries_skipped_in_msic = 0; @@ -978,27 +807,27 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED * cache_ptr) cache_ptr->max_entries_scanned_in_msic = 0; cache_ptr->entries_scanned_to_make_space = 0; - cache_ptr->slist_scan_restarts = 0; - cache_ptr->LRU_scan_restarts = 0; - cache_ptr->index_scan_restarts = 0; + cache_ptr->slist_scan_restarts = 0; + cache_ptr->LRU_scan_restarts = 0; + cache_ptr->index_scan_restarts = 0; - cache_ptr->images_created = 0; - cache_ptr->images_read = 0; - cache_ptr->images_loaded = 0; - cache_ptr->last_image_size = (hsize_t)0; + cache_ptr->images_created = 0; + cache_ptr->images_read = 0; + cache_ptr->images_loaded = 0; + cache_ptr->last_image_size = (hsize_t)0; - cache_ptr->prefetches = 0; - cache_ptr->dirty_prefetches = 0; - cache_ptr->prefetch_hits = 0; + cache_ptr->prefetches = 0; + cache_ptr->dirty_prefetches = 0; + cache_ptr->prefetch_hits = 0; #if H5C_COLLECT_CACHE_ENTRY_STATS - for(i = 0; i <= cache_ptr->max_type_id; i++) { - cache_ptr->max_accesses[i] = 0; - cache_ptr->min_accesses[i] = 1000000; - cache_ptr->max_clears[i] = 0; - cache_ptr->max_flushes[i] = 0; - cache_ptr->max_size[i] = (size_t)0; - cache_ptr->max_pins[i] = 0; + for (i = 0; i <= cache_ptr->max_type_id; i++) { + cache_ptr->max_accesses[i] = 0; + cache_ptr->min_accesses[i] = 1000000; + cache_ptr->max_clears[i] = 0; + cache_ptr->max_flushes[i] = 0; + cache_ptr->max_size[i] = (size_t)0; + cache_ptr->max_pins[i] = 0; } /* end for */ #endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ @@ -1007,7 +836,6 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED * cache_ptr) return; } /* H5C_stats__reset() */ - /*------------------------------------------------------------------------- * Function: H5C_flush_dependency_exists() * @@ -1035,13 +863,12 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED * cache_ptr) */ #ifndef NDEBUG herr_t -H5C_flush_dependency_exists(H5C_t *cache_ptr, haddr_t parent_addr, haddr_t child_addr, - hbool_t *fd_exists_ptr) +H5C_flush_dependency_exists(H5C_t *cache_ptr, haddr_t parent_addr, haddr_t child_addr, hbool_t *fd_exists_ptr) { - hbool_t fd_exists = FALSE; /* whether flush dependency exists */ - H5C_cache_entry_t * parent_ptr; /* Ptr to parent entry */ - H5C_cache_entry_t * child_ptr; /* Ptr to child entry */ - hbool_t ret_value = FALSE; /* Return value */ + hbool_t fd_exists = FALSE; /* whether flush dependency exists */ + H5C_cache_entry_t *parent_ptr; /* Ptr to parent entry */ + H5C_cache_entry_t *child_ptr; /* Ptr to child entry */ + hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1055,25 +882,25 @@ H5C_flush_dependency_exists(H5C_t *cache_ptr, haddr_t parent_addr, haddr_t child H5C__SEARCH_INDEX(cache_ptr, parent_addr, parent_ptr, FAIL) H5C__SEARCH_INDEX(cache_ptr, child_addr, child_ptr, FAIL) - if(parent_ptr && child_ptr) { + if (parent_ptr && child_ptr) { HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(child_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - if(child_ptr->flush_dep_nparents > 0) { - unsigned u; /* Local index variable */ + if (child_ptr->flush_dep_nparents > 0) { + unsigned u; /* Local index variable */ HDassert(child_ptr->flush_dep_parent); HDassert(child_ptr->flush_dep_parent_nalloc >= child_ptr->flush_dep_nparents); - for(u = 0; u < child_ptr->flush_dep_nparents; u++) { - if(child_ptr->flush_dep_parent[u] == parent_ptr) { + for (u = 0; u < child_ptr->flush_dep_nparents; u++) { + if (child_ptr->flush_dep_parent[u] == parent_ptr) { fd_exists = TRUE; HDassert(parent_ptr->flush_dep_nchildren > 0); break; } /* end if */ - } /* end for */ - } /* end if */ - } /* end if */ + } /* end for */ + } /* end if */ + } /* end if */ *fd_exists_ptr = fd_exists; @@ -1082,7 +909,6 @@ done: } /* H5C_flush_dependency_exists() */ #endif /* NDEBUG */ - /*------------------------------------------------------------------------- * * Function: H5C_validate_index_list @@ -1103,17 +929,17 @@ done: herr_t H5C_validate_index_list(H5C_t *cache_ptr) { - H5C_cache_entry_t * entry_ptr = NULL; - uint32_t len = 0; - int32_t index_ring_len[H5C_RING_NTYPES]; - size_t size = 0; - size_t clean_size = 0; - size_t dirty_size = 0; - size_t index_ring_size[H5C_RING_NTYPES]; - size_t clean_index_ring_size[H5C_RING_NTYPES]; - size_t dirty_index_ring_size[H5C_RING_NTYPES]; - int i; - herr_t ret_value = SUCCEED; /* Return value */ + H5C_cache_entry_t *entry_ptr = NULL; + uint32_t len = 0; + int32_t index_ring_len[H5C_RING_NTYPES]; + size_t size = 0; + size_t clean_size = 0; + size_t dirty_size = 0; + size_t index_ring_size[H5C_RING_NTYPES]; + size_t clean_index_ring_size[H5C_RING_NTYPES]; + size_t dirty_index_ring_size[H5C_RING_NTYPES]; + int i; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1121,89 +947,84 @@ H5C_validate_index_list(H5C_t *cache_ptr) HDassert(cache_ptr); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - for(i = 0; i < H5C_RING_NTYPES; i++) { - index_ring_len[i] = 0; - index_ring_size[i] = 0; - clean_index_ring_size[i] = 0; - dirty_index_ring_size[i] = 0; + for (i = 0; i < H5C_RING_NTYPES; i++) { + index_ring_len[i] = 0; + index_ring_size[i] = 0; + clean_index_ring_size[i] = 0; + dirty_index_ring_size[i] = 0; } /* end if */ - if(((cache_ptr->il_head == NULL) || (cache_ptr->il_tail == NULL)) - && (cache_ptr->il_head != cache_ptr->il_tail)) + if (((cache_ptr->il_head == NULL) || (cache_ptr->il_tail == NULL)) && + (cache_ptr->il_head != cache_ptr->il_tail)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointer validation failed") - if((cache_ptr->index_len == 1) && ((cache_ptr->il_head != cache_ptr->il_tail) - || (cache_ptr->il_head == NULL) || (cache_ptr->il_head->size != cache_ptr->index_size))) + if ((cache_ptr->index_len == 1) && + ((cache_ptr->il_head != cache_ptr->il_tail) || (cache_ptr->il_head == NULL) || + (cache_ptr->il_head->size != cache_ptr->index_size))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointer sanity checks failed") - if((cache_ptr->index_len >= 1) - && ((cache_ptr->il_head == NULL) - || (cache_ptr->il_head->il_prev != NULL) - || (cache_ptr->il_tail == NULL) - || (cache_ptr->il_tail->il_next != NULL))) + if ((cache_ptr->index_len >= 1) && + ((cache_ptr->il_head == NULL) || (cache_ptr->il_head->il_prev != NULL) || + (cache_ptr->il_tail == NULL) || (cache_ptr->il_tail->il_next != NULL))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list length sanity checks failed") entry_ptr = cache_ptr->il_head; - while(entry_ptr != NULL) { - if((entry_ptr != cache_ptr->il_head) - && ((entry_ptr->il_prev == NULL) || (entry_ptr->il_prev->il_next != entry_ptr))) + while (entry_ptr != NULL) { + if ((entry_ptr != cache_ptr->il_head) && + ((entry_ptr->il_prev == NULL) || (entry_ptr->il_prev->il_next != entry_ptr))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointers for entry are invalid") - if((entry_ptr != cache_ptr->il_tail) - && ((entry_ptr->il_next == NULL) || (entry_ptr->il_next->il_prev != entry_ptr))) + if ((entry_ptr != cache_ptr->il_tail) && + ((entry_ptr->il_next == NULL) || (entry_ptr->il_next->il_prev != entry_ptr))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointers for entry are invalid") - HDassert(entry_ptr->ring > 0); - HDassert(entry_ptr->ring < H5C_RING_NTYPES); + HDassert(entry_ptr->ring > 0); + HDassert(entry_ptr->ring < H5C_RING_NTYPES); len++; - index_ring_len[entry_ptr->ring] += 1; + index_ring_len[entry_ptr->ring] += 1; size += entry_ptr->size; index_ring_size[entry_ptr->ring] += entry_ptr->size; - if(entry_ptr->is_dirty) { - dirty_size += entry_ptr->size; - dirty_index_ring_size[entry_ptr->ring] += entry_ptr->size; - } /* end if */ + if (entry_ptr->is_dirty) { + dirty_size += entry_ptr->size; + dirty_index_ring_size[entry_ptr->ring] += entry_ptr->size; + } /* end if */ else { - clean_size += entry_ptr->size; - clean_index_ring_size[entry_ptr->ring] += entry_ptr->size; - } /* end else */ + clean_size += entry_ptr->size; + clean_index_ring_size[entry_ptr->ring] += entry_ptr->size; + } /* end else */ entry_ptr = entry_ptr->il_next; } /* end while */ - if((cache_ptr->index_len != len) || (cache_ptr->il_len != len) - || (cache_ptr->index_size != size) || (cache_ptr->il_size != size) - || (cache_ptr->clean_index_size != clean_size) - || (cache_ptr->dirty_index_size != dirty_size) - || (clean_size + dirty_size != size)) + if ((cache_ptr->index_len != len) || (cache_ptr->il_len != len) || (cache_ptr->index_size != size) || + (cache_ptr->il_size != size) || (cache_ptr->clean_index_size != clean_size) || + (cache_ptr->dirty_index_size != dirty_size) || (clean_size + dirty_size != size)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index, clean and dirty sizes for cache are invalid") - size = 0; + size = 0; clean_size = 0; dirty_size = 0; - for(i = 0; i < H5C_RING_NTYPES; i++) { - size += clean_index_ring_size[i] + dirty_index_ring_size[i]; - clean_size += clean_index_ring_size[i]; - dirty_size += dirty_index_ring_size[i]; + for (i = 0; i < H5C_RING_NTYPES; i++) { + size += clean_index_ring_size[i] + dirty_index_ring_size[i]; + clean_size += clean_index_ring_size[i]; + dirty_size += dirty_index_ring_size[i]; } /* end for */ - if((cache_ptr->index_size != size) - || (cache_ptr->clean_index_size != clean_size) - || (cache_ptr->dirty_index_size != dirty_size)) + if ((cache_ptr->index_size != size) || (cache_ptr->clean_index_size != clean_size) || + (cache_ptr->dirty_index_size != dirty_size)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index, clean and dirty sizes for cache are invalid") done: - if(ret_value != SUCCEED) + if (ret_value != SUCCEED) HDassert(0); FUNC_LEAVE_NOAPI(ret_value) } /* H5C_validate_index_list() */ #endif /* NDEBUG */ - /*------------------------------------------------------------------------- * * Function: H5C_get_entry_ptr_from_addr() @@ -1244,8 +1065,8 @@ done: herr_t H5C_get_entry_ptr_from_addr(H5C_t *cache_ptr, haddr_t addr, void **entry_ptr_ptr) { - H5C_cache_entry_t * entry_ptr = NULL; - herr_t ret_value = SUCCEED; /* Return value */ + H5C_cache_entry_t *entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1257,7 +1078,7 @@ H5C_get_entry_ptr_from_addr(H5C_t *cache_ptr, haddr_t addr, void **entry_ptr_ptr H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) - if(entry_ptr == NULL) + if (entry_ptr == NULL) /* the entry doesn't exist in the cache -- report this * and quit. */ @@ -1265,8 +1086,8 @@ H5C_get_entry_ptr_from_addr(H5C_t *cache_ptr, haddr_t addr, void **entry_ptr_ptr else { *entry_ptr_ptr = entry_ptr; - /* increment call counter */ - (cache_ptr->get_entry_ptr_from_addr_counter)++; + /* increment call counter */ + (cache_ptr->get_entry_ptr_from_addr_counter)++; } /* end else */ done: @@ -1274,7 +1095,6 @@ done: } /* H5C_get_entry_ptr_from_addr() */ #endif /* NDEBUG */ - /*------------------------------------------------------------------------- * Function: H5C_get_serialization_in_progress * @@ -1302,7 +1122,6 @@ H5C_get_serialization_in_progress(const H5C_t *cache_ptr) } /* H5C_get_serialization_in_progress() */ #endif /* NDEBUG */ - /*------------------------------------------------------------------------- * * Function: H5C_cache_is_clean() @@ -1324,8 +1143,8 @@ H5C_get_serialization_in_progress(const H5C_t *cache_ptr) hbool_t H5C_cache_is_clean(const H5C_t *cache_ptr, H5C_ring_t inner_ring) { - H5C_ring_t ring = H5C_RING_USER; - hbool_t ret_value = TRUE; /* Return value */ + H5C_ring_t ring = H5C_RING_USER; + hbool_t ret_value = TRUE; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1335,11 +1154,11 @@ H5C_cache_is_clean(const H5C_t *cache_ptr, H5C_ring_t inner_ring) HDassert(inner_ring >= H5C_RING_USER); HDassert(inner_ring <= H5C_RING_SB); - while(ring <= inner_ring) { - if(cache_ptr->dirty_index_ring_size[ring] > 0) + while (ring <= inner_ring) { + if (cache_ptr->dirty_index_ring_size[ring] > 0) HGOTO_DONE(FALSE) - ring++; + ring++; } /* end while */ done: @@ -1347,7 +1166,6 @@ done: } /* H5C_cache_is_clean() */ #endif /* NDEBUG */ - /*------------------------------------------------------------------------- * * Function: H5C_verify_entry_type() @@ -1375,12 +1193,11 @@ done: */ #ifndef NDEBUG herr_t -H5C_verify_entry_type(H5C_t *cache_ptr, haddr_t addr, - const H5C_class_t *expected_type, hbool_t *in_cache_ptr, - hbool_t *type_ok_ptr) +H5C_verify_entry_type(H5C_t *cache_ptr, haddr_t addr, const H5C_class_t *expected_type, hbool_t *in_cache_ptr, + hbool_t *type_ok_ptr) { - H5C_cache_entry_t * entry_ptr = NULL; - herr_t ret_value = SUCCEED; /* Return value */ + H5C_cache_entry_t *entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1394,7 +1211,7 @@ H5C_verify_entry_type(H5C_t *cache_ptr, haddr_t addr, H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) - if(entry_ptr == NULL) + if (entry_ptr == NULL) /* the entry doesn't exist in the cache -- report this * and quit. */ @@ -1402,14 +1219,13 @@ H5C_verify_entry_type(H5C_t *cache_ptr, haddr_t addr, else { *in_cache_ptr = TRUE; - if(entry_ptr->prefetched) - *type_ok_ptr = (expected_type->id == entry_ptr->prefetch_type_id); - else - *type_ok_ptr = (expected_type == entry_ptr->type); + if (entry_ptr->prefetched) + *type_ok_ptr = (expected_type->id == entry_ptr->prefetch_type_id); + else + *type_ok_ptr = (expected_type == entry_ptr->type); } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_verify_entry_type() */ #endif /* NDEBUG */ - |