summaryrefslogtreecommitdiffstats
path: root/test/cache_common.h
diff options
context:
space:
mode:
authorJohn Mainzer <mainzer@hdfgroup.org>2006-04-28 13:27:54 (GMT)
committerJohn Mainzer <mainzer@hdfgroup.org>2006-04-28 13:27:54 (GMT)
commit8a7b9b3221f192ed0e64b00c3a90d5e6a1fb9e19 (patch)
tree2a4a38cc7b359149409ba55d919031ce9d25e932 /test/cache_common.h
parent6a77572c26b354541cafed74bf583e0de0ddfe9a (diff)
downloadhdf5-8a7b9b3221f192ed0e64b00c3a90d5e6a1fb9e19.zip
hdf5-8a7b9b3221f192ed0e64b00c3a90d5e6a1fb9e19.tar.gz
hdf5-8a7b9b3221f192ed0e64b00c3a90d5e6a1fb9e19.tar.bz2
[svn-r12311] Purpose:
Add pinned entry capability to cache. Description: For frequently accessed cache entries, the protect/unprotect overhead is sometimes a bottleneck. Solution: Allow entries to be pinned in the cache. Pinned entries can't be evicted, but can be flushed or modified. Platforms tested: h5committested -- minus one small typo in test/cache.c whose fix was tested on copper and heping only. Misc. update:
Diffstat (limited to 'test/cache_common.h')
-rw-r--r--test/cache_common.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/test/cache_common.h b/test/cache_common.h
index acacb30..ac58b1a 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -105,6 +105,9 @@
#define MONSTER_ALT_BASE_ADDR (haddr_t)(HUGE_ALT_BASE_ADDR + \
(HUGE_ENTRY_SIZE * NUM_HUGE_ENTRIES))
+#define MAX_PINS 8 /* Maximum number of entries that can be
+ * directly pinned by a single entry.
+ */
typedef struct test_entry_t
{
H5C_cache_entry_t header; /* entry data used by the cache
@@ -113,6 +116,10 @@ typedef struct test_entry_t
struct test_entry_t * self; /* pointer to this entry -- used for
* sanity checking.
*/
+ H5C_t * cache_ptr; /* pointer to the cache in which
+ * the entry resides, or NULL if the
+ * entry is not in cache.
+ */
haddr_t addr; /* where the cache thinks this entry
* is located
*/
@@ -146,6 +153,25 @@ typedef struct test_entry_t
hbool_t is_protected; /* entry should currently be on
* the cache's protected list.
*/
+ hbool_t is_pinned; /* entry is currently pinned in
+ * the cache.
+ */
+ int pinning_ref_count; /* Number of entries that
+ * pin this entry in the cache.
+ * When this count drops to zero,
+ * this entry should be unpinned.
+ */
+ int num_pins; /* Number of entries that this
+ * entry pins in the cache. This
+ * value must be in the range
+ * [0, MAX_PINS].
+ */
+ int pin_type[MAX_PINS]; /* array of the types of entries
+ * pinned by this entry.
+ */
+ int pin_idx[MAX_PINS]; /* array of the indicies of
+ * entries pinned by this entry.
+ */
hbool_t loaded; /* entry has been loaded since the
* last time it was reset.
*/
@@ -247,6 +273,33 @@ struct flush_cache_test_spec
hbool_t expected_destroyed;
};
+struct pe_flush_cache_test_spec
+{
+ int entry_num;
+ int entry_type;
+ int entry_index;
+ hbool_t insert_flag;
+ hbool_t dirty_flag;
+ unsigned int flags;
+ int num_pins;
+ int pin_type[MAX_PINS];
+ int pin_idx[MAX_PINS];
+ hbool_t expected_loaded;
+ hbool_t expected_cleared;
+ hbool_t expected_flushed;
+ hbool_t expected_destroyed;
+};
+
+struct rename_entry_test_spec
+{
+ int entry_type;
+ int entry_index;
+ hbool_t is_dirty;
+ hbool_t is_pinned;
+};
+
+
+
/* global variable externs: */
@@ -376,6 +429,12 @@ void insert_entry(H5C_t * cache_ptr,
hbool_t dirty,
unsigned int flags);
+void mark_pinned_entry_dirty(H5C_t * cache_ptr,
+ int32_t type,
+ int32_t idx,
+ hbool_t size_changed,
+ size_t new_size);
+
void rename_entry(H5C_t * cache_ptr,
int32_t type,
int32_t idx,
@@ -389,6 +448,12 @@ hbool_t entry_in_cache(H5C_t * cache_ptr,
int32_t type,
int32_t idx);
+void create_pinned_entry_dependency(H5C_t * cache_ptr,
+ int pinning_type,
+ int pinning_idx,
+ int pinned_type,
+ int pinned_idx);
+
void reset_entries(void);
H5C_t * setup_cache(size_t max_cache_size, size_t min_clean_size);
@@ -488,6 +553,10 @@ void flush_cache(H5C_t * cache_ptr,
hbool_t dump_stats,
hbool_t dump_detailed_stats);
+void unpin_entry(H5C_t * cache_ptr,
+ int32_t type,
+ int32_t idx);
+
void unprotect_entry(H5C_t * cache_ptr,
int32_t type,
int32_t idx,