diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2000-06-01 23:45:11 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2000-06-01 23:45:11 (GMT) |
commit | ae69e30f76aff9cee3a948d38505fdb33d63a242 (patch) | |
tree | 16c9fe3d9ecf886d619e6d91b38a9593cd3ec85b /src/H5ACprivate.h | |
parent | ecb52e75d3394f8f373ae37ff2487228997b43a4 (diff) | |
download | hdf5-ae69e30f76aff9cee3a948d38505fdb33d63a242.zip hdf5-ae69e30f76aff9cee3a948d38505fdb33d63a242.tar.gz hdf5-ae69e30f76aff9cee3a948d38505fdb33d63a242.tar.bz2 |
[svn-r2318] Rearranged metadata caching to put caching information in the objects being
cached instead of in separate structures. This reduces the amount of memory
the hash table uses by about half. This is the initial step along the path of
speeding up the metadata caching.
Diffstat (limited to 'src/H5ACprivate.h')
-rw-r--r-- | src/H5ACprivate.h | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 34f8121..7335c0d 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -58,12 +58,13 @@ typedef enum H5AC_subid_t { H5AC_NTYPES = 5 /*THIS MUST BE LAST! */ } H5AC_subid_t; +typedef void *(*H5AC_load_func_t)(H5F_t*, haddr_t addr, const void *udata1, void *udata2); +typedef herr_t (*H5AC_flush_func_t)(H5F_t*, hbool_t dest, haddr_t addr, void *thing); + typedef struct H5AC_class_t { H5AC_subid_t id; - void *(*load)(H5F_t*, haddr_t addr, const void *udata1, - void *udata2); - herr_t (*flush)(H5F_t*, hbool_t dest, haddr_t addr, - void *thing); + H5AC_load_func_t load; + H5AC_flush_func_t flush; } H5AC_class_t; /* @@ -77,26 +78,25 @@ typedef struct H5AC_class_t { /* of the smallest file format object written to the file. */ #define H5AC_HASH(F,ADDR) H5F_addr_hash((ADDR/H5AC_HASH_DIVISOR),(F)->shared->cache->nslots) -typedef struct H5AC_prot_t { - const H5AC_class_t *type; /*type of protected thing */ - haddr_t addr; /*address of protected thing */ - void *thing; /*(possible) protected thing */ -} H5AC_prot_t; - -typedef struct H5AC_slot_t { +typedef struct H5AC_info_t { const H5AC_class_t *type; /*type of object stored here */ haddr_t addr; /*file address for object */ - void *thing; /*the thing which is cached */ +} H5AC_info_t; + #ifdef H5AC_DEBUG +typedef struct H5AC_prot_t { intn nprots; /*number of things protected */ intn aprots; /*nelmts of `prot' array */ - H5AC_prot_t *prot; /*array of protected things */ -#endif -} H5AC_slot_t; + H5AC_info_t **slot; /*array of pointers to protected things */ +} H5AC_prot_t; +#endif /* H5AC_DEBUG */ typedef struct H5AC_t { uintn nslots; /*number of cache slots */ - H5AC_slot_t *slot; /*the cache slots */ + H5AC_info_t **slot; /*the cache slots, an array of pointers to the cached objects */ +#ifdef H5AC_DEBUG + H5AC_prot_t *prot; /*the protected slots */ +#endif /* H5AC_DEBUG */ intn nprots; /*number of protected objects */ struct { uintn nhits; /*number of cache hits */ @@ -126,10 +126,12 @@ __DLL__ herr_t H5AC_set(H5F_t *f, const H5AC_class_t *type, haddr_t addr, __DLL__ herr_t H5AC_debug(H5F_t *f); #define H5AC_find(F,TYPE,ADDR,UDATA1,UDATA2) \ - (((F)->shared->cache->slot[H5AC_HASH(F,ADDR)].type==(TYPE) && \ - (F)->shared->cache->slot[H5AC_HASH(F,ADDR)].addr==ADDR) ? \ + ((F)->shared->cache->slot[H5AC_HASH(F,ADDR)]!=NULL && \ + ((F)->shared->cache->slot[H5AC_HASH(F,ADDR)]->type==(TYPE) && \ + (F)->shared->cache->slot[H5AC_HASH(F,ADDR)]->addr==ADDR) ? \ ((F)->shared->cache->diagnostics[(TYPE)->id].nhits++, \ - (F)->shared->cache->slot[H5AC_HASH(F,ADDR)].thing) : \ + (F)->shared->cache->slot[H5AC_HASH(F,ADDR)]) : \ H5AC_find_f(F, TYPE, ADDR, UDATA1, UDATA2)) #endif /* !_H5ACprivate_H */ + |