diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-03-26 22:06:57 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-03-26 22:06:57 (GMT) |
commit | 383f266ef1df526ea3ebeadd1b49099361ada7a9 (patch) | |
tree | a2246a7cffcdfdb362e914b09a9c63730f357ee0 /src | |
parent | f842a26c63ffe3fa24e6ab031f49c1aafcbc6ad2 (diff) | |
download | hdf5-383f266ef1df526ea3ebeadd1b49099361ada7a9.zip hdf5-383f266ef1df526ea3ebeadd1b49099361ada7a9.tar.gz hdf5-383f266ef1df526ea3ebeadd1b49099361ada7a9.tar.bz2 |
[svn-r16623] Description:
Revise how code for array statistics works.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.6 (amazon) in debug mode
Mac OS X/32 10.5.6 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'src')
-rw-r--r-- | src/H5EA.c | 33 | ||||
-rw-r--r-- | src/H5EAcache.c | 34 | ||||
-rw-r--r-- | src/H5EAdbg.c | 8 | ||||
-rw-r--r-- | src/H5EAdblock.c | 14 | ||||
-rw-r--r-- | src/H5EAhdr.c | 2 | ||||
-rw-r--r-- | src/H5EAiblock.c | 18 | ||||
-rw-r--r-- | src/H5EApkg.h | 14 | ||||
-rw-r--r-- | src/H5EAprivate.h | 25 | ||||
-rw-r--r-- | src/H5EAsblock.c | 12 |
9 files changed, 87 insertions, 73 deletions
@@ -265,7 +265,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); HDassert(nelmts); /* Retrieve the max. index set */ - *nelmts = ea->hdr->stats.max_idx_set; + *nelmts = ea->hdr->stats.stored.max_idx_set; END_FUNC(PRIV) /* end H5EA_get_nelmts() */ @@ -333,7 +333,8 @@ H5EA_set(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, const void *elmt)) unsigned sblock_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting super block */ unsigned dblock_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting data block */ unsigned dblk_page_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting data block page */ - hbool_t hdr_dirty = FALSE; /* Whether header information changed */ + hbool_t stats_changed = FALSE; /* Whether array statistics changed */ + hbool_t hdr_dirty = FALSE; /* Whether the array header changed */ #ifdef QAK HDfprintf(stderr, "%s: Called\n", FUNC); @@ -355,9 +356,10 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); HDfprintf(stderr, "%s: Index block address not defined!\n", FUNC, idx); #endif /* QAK */ /* Create the index block */ - hdr->idx_blk_addr = H5EA__iblock_create(hdr, dxpl_id, &hdr_dirty); + hdr->idx_blk_addr = H5EA__iblock_create(hdr, dxpl_id, &stats_changed); if(!H5F_addr_defined(hdr->idx_blk_addr)) H5E_THROW(H5E_CANTCREATE, "unable to create index block") + hdr_dirty = TRUE; } /* end if */ #ifdef QAK HDfprintf(stderr, "%s: Index block address is: %a\n", FUNC, hdr->idx_blk_addr); @@ -371,7 +373,7 @@ HDfprintf(stderr, "%s: Index block address is: %a\n", FUNC, hdr->idx_blk_addr); if(idx < hdr->cparam.idx_blk_elmts) { /* Set element in index block */ HDmemcpy(((uint8_t *)iblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), elmt, hdr->cparam.cls->nat_elmt_size); - iblock_cache_flags |= H5AC__DIRTIED_FLAG; + dblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else { unsigned sblk_idx; /* Which superblock does this index fall in? */ @@ -409,13 +411,13 @@ HDfprintf(stderr, "%s: dblk_idx = %u, iblock->ndblk_addrs = %Zu\n", FUNC, dblk_i /* Create data block */ dblk_off = hdr->sblk_info[sblk_idx].start_idx + (dblk_idx * hdr->sblk_info[sblk_idx].dblk_nelmts); - dblk_addr = H5EA__dblock_create(hdr, dxpl_id, &hdr_dirty, dblk_off, hdr->sblk_info[sblk_idx].dblk_nelmts); + dblk_addr = H5EA__dblock_create(hdr, dxpl_id, &stats_changed, dblk_off, hdr->sblk_info[sblk_idx].dblk_nelmts); if(!H5F_addr_defined(dblk_addr)) H5E_THROW(H5E_CANTCREATE, "unable to create extensible array data block") /* Set data block address in index block */ iblock->dblk_addrs[dblk_idx] = dblk_addr; - iblock_cache_flags |= H5AC__DIRTIED_FLAG; + dblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ /* Protect data block */ @@ -441,7 +443,7 @@ HDfprintf(stderr, "%s: dblk_idx = %u, iblock->ndblk_addrs = %Zu\n", FUNC, dblk_i haddr_t sblk_addr; /* Address of data block created */ /* Create super block */ - sblk_addr = H5EA__sblock_create(hdr, dxpl_id, &hdr_dirty, sblk_idx); + sblk_addr = H5EA__sblock_create(hdr, dxpl_id, &stats_changed, sblk_idx); #ifdef QAK HDfprintf(stderr, "%s: New super block address is: %a\n", FUNC, sblk_addr); #endif /* QAK */ @@ -450,7 +452,7 @@ HDfprintf(stderr, "%s: New super block address is: %a\n", FUNC, sblk_addr); /* Set super block address in index block */ iblock->sblk_addrs[sblk_off] = sblk_addr; - iblock_cache_flags |= H5AC__DIRTIED_FLAG; + dblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ /* Protect super block */ @@ -471,7 +473,7 @@ HDfprintf(stderr, "%s: dblk_idx = %u, sblock->ndblks = %Zu\n", FUNC, dblk_idx, s /* Create data block */ dblk_off = hdr->sblk_info[sblk_idx].start_idx + (dblk_idx * hdr->sblk_info[sblk_idx].dblk_nelmts); - dblk_addr = H5EA__dblock_create(hdr, dxpl_id, &hdr_dirty, dblk_off, sblock->dblk_nelmts); + dblk_addr = H5EA__dblock_create(hdr, dxpl_id, &stats_changed, dblk_off, sblock->dblk_nelmts); if(!H5F_addr_defined(dblk_addr)) H5E_THROW(H5E_CANTCREATE, "unable to create extensible array data block") @@ -561,12 +563,17 @@ HDfprintf(stderr, "%s: sblock->dblk_page_size = %Zu\n", FUNC, sblock->dblk_page_ #ifdef QAK HDfprintf(stderr, "%s: idx = %Hu, hdr->stats.max_idx_set = %Hu\n", FUNC, idx, hdr->stats.max_idx_set); #endif /* QAK */ - if(idx >= hdr->stats.max_idx_set) { - hdr->stats.max_idx_set = idx + 1; - hdr_dirty = TRUE; + if(idx >= hdr->stats.stored.max_idx_set) { + HDassert(iblock); + hdr->stats.stored.max_idx_set = idx + 1; + stats_changed = TRUE; } /* end if */ CATCH + /* Check for updating array statistics */ + if(stats_changed) + hdr_dirty = TRUE; + /* Check for header modified */ if(hdr_dirty) if(H5EA__hdr_modified(hdr) < 0) @@ -624,7 +631,7 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); hdr->f = ea->f; /* Check for element beyond max. element in array */ - if(idx >= hdr->stats.max_idx_set) { + if(idx >= hdr->stats.stored.max_idx_set) { #ifdef QAK HDfprintf(stderr, "%s: Element beyond max. index set, hdr->stats.max_idx_set = %Hu, idx = %Hu\n", FUNC, hdr->stats.max_idx_set, idx); #endif /* QAK */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index 286c6a5..f7a7962 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -254,13 +254,13 @@ H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls, hdr->cparam.max_dblk_page_nelmts_bits = *p++; /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ /* Array statistics */ - hdr->stats.hdr_size = size; /* Size of header in file */ - H5F_DECODE_LENGTH(f, p, hdr->stats.nsuper_blks); /* Number of super blocks created */ - H5F_DECODE_LENGTH(f, p, hdr->stats.super_blk_size); /* Size of super blocks created */ - H5F_DECODE_LENGTH(f, p, hdr->stats.ndata_blks); /* Number of data blocks created */ - H5F_DECODE_LENGTH(f, p, hdr->stats.data_blk_size); /* Size of data blocks created */ - H5F_DECODE_LENGTH(f, p, hdr->stats.max_idx_set); /* Max. index set (+1) */ - H5F_DECODE_LENGTH(f, p, hdr->stats.nelmts); /* Number of elements 'realized' */ + hdr->stats.computed.hdr_size = size; /* Size of header in file */ + H5F_DECODE_LENGTH(f, p, hdr->stats.stored.nsuper_blks); /* Number of super blocks created */ + H5F_DECODE_LENGTH(f, p, hdr->stats.stored.super_blk_size); /* Size of super blocks created */ + H5F_DECODE_LENGTH(f, p, hdr->stats.stored.ndata_blks); /* Number of data blocks created */ + H5F_DECODE_LENGTH(f, p, hdr->stats.stored.data_blk_size); /* Size of data blocks created */ + H5F_DECODE_LENGTH(f, p, hdr->stats.stored.max_idx_set); /* Max. index set (+1) */ + H5F_DECODE_LENGTH(f, p, hdr->stats.stored.nelmts); /* Number of elements 'realized' */ /* Internal information */ H5F_addr_decode(f, &p, &hdr->idx_blk_addr); /* Address of index block */ @@ -270,7 +270,7 @@ H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls, H5EA_iblock_t iblock; /* Fake index block for computing size */ /* Set index block count for file */ - hdr->stats.nindex_blks = 1; + hdr->stats.computed.nindex_blks = 1; /* Set up fake index block for computing size on disk */ iblock.hdr = hdr; @@ -279,11 +279,11 @@ H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls, iblock.nsblk_addrs = hdr->nsblks - iblock.nsblks; /* Compute size of index block in file */ - hdr->stats.index_blk_size = H5EA_IBLOCK_SIZE(&iblock); + hdr->stats.computed.index_blk_size = H5EA_IBLOCK_SIZE(&iblock); } /* end if */ else { - hdr->stats.nindex_blks = 0; /* Number of index blocks in file */ - hdr->stats.index_blk_size = 0; /* Size of index blocks in file */ + hdr->stats.computed.nindex_blks = 0; /* Number of index blocks in file */ + hdr->stats.computed.index_blk_size = 0; /* Size of index blocks in file */ } /* end else */ /* Sanity check */ @@ -389,12 +389,12 @@ H5EA__cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, *p++ = hdr->cparam.max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ /* Array statistics */ - H5F_ENCODE_LENGTH(f, p, hdr->stats.nsuper_blks); /* Number of super blocks created */ - H5F_ENCODE_LENGTH(f, p, hdr->stats.super_blk_size); /* Size of super blocks created */ - H5F_ENCODE_LENGTH(f, p, hdr->stats.ndata_blks); /* Number of data blocks created */ - H5F_ENCODE_LENGTH(f, p, hdr->stats.data_blk_size); /* Size of data blocks created */ - H5F_ENCODE_LENGTH(f, p, hdr->stats.max_idx_set); /* Max. index set (+1) */ - H5F_ENCODE_LENGTH(f, p, hdr->stats.nelmts); /* Number of elements 'realized' */ + H5F_ENCODE_LENGTH(f, p, hdr->stats.stored.nsuper_blks); /* Number of super blocks created */ + H5F_ENCODE_LENGTH(f, p, hdr->stats.stored.super_blk_size); /* Size of super blocks created */ + H5F_ENCODE_LENGTH(f, p, hdr->stats.stored.ndata_blks); /* Number of data blocks created */ + H5F_ENCODE_LENGTH(f, p, hdr->stats.stored.data_blk_size); /* Size of data blocks created */ + H5F_ENCODE_LENGTH(f, p, hdr->stats.stored.max_idx_set); /* Max. index set (+1) */ + H5F_ENCODE_LENGTH(f, p, hdr->stats.stored.nelmts); /* Number of elements 'realized' */ /* Internal information */ H5F_addr_encode(f, &p, hdr->idx_blk_addr); /* Address of index block */ diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c index 2c903b2..0acef62 100644 --- a/src/H5EAdbg.c +++ b/src/H5EAdbg.c @@ -147,16 +147,16 @@ H5EA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, (unsigned)hdr->cparam.max_dblk_page_nelmts_bits); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Highest element index stored (+1):", - hdr->stats.max_idx_set); + hdr->stats.stored.max_idx_set); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Number of super blocks created:", - hdr->stats.nsuper_blks); + hdr->stats.stored.nsuper_blks); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Number of data blocks created:", - hdr->stats.ndata_blks); + hdr->stats.stored.ndata_blks); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Number of elements 'realized':", - hdr->stats.nelmts); + hdr->stats.stored.nelmts); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Index Block Address:", hdr->idx_blk_addr); diff --git a/src/H5EAdblock.c b/src/H5EAdblock.c index af2828a..07ba3d1 100644 --- a/src/H5EAdblock.c +++ b/src/H5EAdblock.c @@ -160,7 +160,7 @@ END_FUNC(PKG) /* end H5EA__dblock_alloc() */ */ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, -H5EA__dblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, hbool_t *hdr_dirty, +H5EA__dblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, hbool_t *stats_changed, hsize_t dblk_off, size_t nelmts)) /* Local variables */ @@ -173,7 +173,7 @@ HDfprintf(stderr, "%s: Called, hdr->dblk_page_nelmts = %Zu, nelmts = %Zu\n", FUN /* Sanity check */ HDassert(hdr); - HDassert(hdr_dirty); + HDassert(stats_changed); HDassert(nelmts > 0); /* Allocate the data block */ @@ -208,14 +208,14 @@ HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block to cache") /* Update extensible array data block statistics */ - hdr->stats.ndata_blks++; - hdr->stats.data_blk_size += dblock->size; + hdr->stats.stored.ndata_blks++; + hdr->stats.stored.data_blk_size += dblock->size; /* Increment count of elements "realized" */ - hdr->stats.nelmts += nelmts; + hdr->stats.stored.nelmts += nelmts; - /* Mark the header dirty (for updating statistics) */ - *hdr_dirty = TRUE; + /* Mark the statistics as changed */ + *stats_changed = TRUE; /* Set address of data block to return */ ret_value = dblock_addr; diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index 998e169..0a7ddef 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -236,7 +236,7 @@ HDfprintf(stderr, "%s: hdr->sblk_info[%Zu] = {%Zu, %Zu, %Hu, %Hu}\n", FUNC, u, h } /* end for */ /* Set size of header on disk (locally and in statistics) */ - hdr->stats.hdr_size = hdr->size = H5EA_HEADER_SIZE(hdr); + hdr->stats.computed.hdr_size = hdr->size = H5EA_HEADER_SIZE(hdr); CATCH diff --git a/src/H5EAiblock.c b/src/H5EAiblock.c index 2d93015..b931661 100644 --- a/src/H5EAiblock.c +++ b/src/H5EAiblock.c @@ -178,7 +178,7 @@ END_FUNC(PKG) /* end H5EA__iblock_alloc() */ */ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, -H5EA__iblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, hbool_t *hdr_dirty)) +H5EA__iblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, hbool_t *stats_changed)) /* Local variables */ H5EA_iblock_t *iblock = NULL; /* Extensible array index block */ @@ -190,7 +190,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Sanity check */ HDassert(hdr); - HDassert(hdr_dirty); + HDassert(stats_changed); /* Allocate the index block */ if(NULL == (iblock = H5EA__iblock_alloc(hdr))) @@ -235,16 +235,16 @@ HDfprintf(stderr, "%s: iblock->size = %Zu\n", FUNC, iblock->size); H5E_THROW(H5E_CANTINSERT, "can't add extensible array index block to cache") /* Update extensible array index block statistics */ - HDassert(0 == hdr->stats.nindex_blks); - HDassert(0 == hdr->stats.index_blk_size); - hdr->stats.nindex_blks = 1; - hdr->stats.index_blk_size = iblock->size; + HDassert(0 == hdr->stats.computed.nindex_blks); + HDassert(0 == hdr->stats.computed.index_blk_size); + hdr->stats.computed.nindex_blks = 1; + hdr->stats.computed.index_blk_size = iblock->size; /* Increment count of elements "realized" */ - hdr->stats.nelmts += hdr->cparam.idx_blk_elmts; + hdr->stats.stored.nelmts += hdr->cparam.idx_blk_elmts; - /* Mark the header dirty (for updating statistics) */ - *hdr_dirty = TRUE; + /* Mark the statistics as changed */ + *stats_changed = TRUE; /* Set address of index block to return */ ret_value = iblock_addr; diff --git a/src/H5EApkg.h b/src/H5EApkg.h index e374d3a..2364eb8 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -371,7 +371,7 @@ func_init_failed: \ + 1 /* Min. # of data block pointers for a super block */ \ + 1 /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ \ \ - /* Extensible Array Header statistics fields */ \ + /* Extensible Array statistics fields */ \ + (h)->sizeof_size /* Number of super blocks created */ \ + (h)->sizeof_size /* Size of super blocks created */ \ + (h)->sizeof_size /* Number of data blocks created */ \ @@ -472,7 +472,7 @@ typedef struct H5EA_hdr_t { /* Index block information (stored in header) */ haddr_t idx_blk_addr; /* Address of index block in header */ - /* Statistics for array (stored in header) */ + /* Statistics for array (stored in index block, actually) */ /* (header and index number/size fields not stored) */ H5EA_stat_t stats; /* Statistics for extensible array */ @@ -640,7 +640,7 @@ H5_DLL herr_t H5EA__hdr_dest(H5EA_hdr_t *hdr); /* Index block routines */ H5_DLL H5EA_iblock_t *H5EA__iblock_alloc(H5EA_hdr_t *hdr); H5_DLL haddr_t H5EA__iblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, - hbool_t *hdr_dirty); + hbool_t *stats_changed); H5_DLL H5EA_iblock_t *H5EA__iblock_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, H5AC_protect_t rw); H5_DLL herr_t H5EA__iblock_unprotect(H5EA_iblock_t *iblock, hid_t dxpl_id, @@ -650,8 +650,8 @@ H5_DLL herr_t H5EA__iblock_dest(H5F_t *f, H5EA_iblock_t *iblock); /* Super block routines */ H5_DLL H5EA_sblock_t *H5EA__sblock_alloc(H5EA_hdr_t *hdr, unsigned sblk_idx); -H5_DLL haddr_t H5EA__sblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, hbool_t *hdr_dirty, - unsigned sblk_idx); +H5_DLL haddr_t H5EA__sblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, + hbool_t *stats_changed, unsigned sblk_idx); H5_DLL H5EA_sblock_t *H5EA__sblock_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, haddr_t sblk_addr, unsigned sblk_idx, H5AC_protect_t rw); H5_DLL herr_t H5EA__sblock_unprotect(H5EA_sblock_t *sblock, hid_t dxpl_id, @@ -662,8 +662,8 @@ H5_DLL herr_t H5EA__sblock_dest(H5F_t *f, H5EA_sblock_t *sblock); /* Data block routines */ H5_DLL H5EA_dblock_t *H5EA__dblock_alloc(H5EA_hdr_t *hdr, size_t nelmts); -H5_DLL haddr_t H5EA__dblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, hbool_t *hdr_dirty, - hsize_t dblk_off, size_t nelmts); +H5_DLL haddr_t H5EA__dblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, + hbool_t *stats_changed, hsize_t dblk_off, size_t nelmts); H5_DLL unsigned H5EA__dblock_sblk_idx(const H5EA_hdr_t *hdr, hsize_t idx); H5_DLL H5EA_dblock_t *H5EA__dblock_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, haddr_t dblk_addr, size_t dblk_nelmts, H5AC_protect_t rw); diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h index f44d046..9e3fa48 100644 --- a/src/H5EAprivate.h +++ b/src/H5EAprivate.h @@ -82,19 +82,26 @@ typedef struct H5EA_create_t { } H5EA_create_t; /* Extensible array metadata statistics info */ +/* (If these are ever exposed to applications, don't let the application see + * which fields are computed vs. which fields are stored. -QAK) + */ typedef struct H5EA_stat_t { /* Non-stored (i.e. computed) fields */ - hsize_t hdr_size; /* Size of header */ - hsize_t nindex_blks; /* # of index blocks (should be 0 or 1) */ - hsize_t index_blk_size; /* Size of index blocks allocated */ + struct { + hsize_t hdr_size; /* Size of header */ + hsize_t nindex_blks; /* # of index blocks (should be 0 or 1) */ + hsize_t index_blk_size; /* Size of index blocks allocated */ + } computed; /* Stored fields */ - hsize_t nsuper_blks; /* # of super blocks */ - hsize_t super_blk_size; /* Size of super blocks allocated */ - hsize_t ndata_blks; /* # of data blocks */ - hsize_t data_blk_size; /* Size of data blocks allocated */ - hsize_t max_idx_set; /* Highest element index stored (+1 - i.e. if element 0 has been set, this value with be '1', if no elements have been stored, this value will be '0') */ - hsize_t nelmts; /* # of elements "realized" */ + struct { + hsize_t nsuper_blks; /* # of super blocks */ + hsize_t super_blk_size; /* Size of super blocks allocated */ + hsize_t ndata_blks; /* # of data blocks */ + hsize_t data_blk_size; /* Size of data blocks allocated */ + hsize_t max_idx_set; /* Highest element index stored (+1 - i.e. if element 0 has been set, this value with be '1', if no elements have been stored, this value will be '0') */ + hsize_t nelmts; /* # of elements "realized" */ + } stored; } H5EA_stat_t; /* Extensible array info (forward decl - defined in H5EApkg.h) */ diff --git a/src/H5EAsblock.c b/src/H5EAsblock.c index 3cb97a9..157d1aa 100644 --- a/src/H5EAsblock.c +++ b/src/H5EAsblock.c @@ -190,7 +190,7 @@ END_FUNC(PKG) /* end H5EA__sblock_alloc() */ */ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, -H5EA__sblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, hbool_t *hdr_dirty, +H5EA__sblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, hbool_t *stats_changed, unsigned sblk_idx)) /* Local variables */ @@ -204,7 +204,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Sanity check */ HDassert(hdr); - HDassert(hdr_dirty); + HDassert(stats_changed); /* Allocate the super block */ if(NULL == (sblock = H5EA__sblock_alloc(hdr, sblk_idx))) @@ -235,11 +235,11 @@ HDfprintf(stderr, "%s: sblock->block_off = %Hu\n", FUNC, sblock->block_off); H5E_THROW(H5E_CANTINSERT, "can't add extensible array super block to cache") /* Update extensible array super block statistics */ - hdr->stats.nsuper_blks++; - hdr->stats.super_blk_size += sblock->size; + hdr->stats.stored.nsuper_blks++; + hdr->stats.stored.super_blk_size += sblock->size; - /* Mark the header dirty (for updating statistics) */ - *hdr_dirty = TRUE; + /* Mark the statistics as changed */ + *stats_changed = TRUE; /* Set address of super block to return */ ret_value = sblock_addr; |