summaryrefslogtreecommitdiffstats
path: root/test/lheap.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-05-10 20:35:35 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-05-10 20:35:35 (GMT)
commit670d598ff7a017cc4cbe1331b30ad645f04514a9 (patch)
tree30355200820c49c95ec44d14ed826e74df7459a5 /test/lheap.c
parentc751cdab335b24e069570dcec8a39856dfa2cd98 (diff)
downloadhdf5-670d598ff7a017cc4cbe1331b30ad645f04514a9.zip
hdf5-670d598ff7a017cc4cbe1331b30ad645f04514a9.tar.gz
hdf5-670d598ff7a017cc4cbe1331b30ad645f04514a9.tar.bz2
[svn-r13745] Description:
Take further advantage of the readers/writer locking in the metadata cache and push the locking of the local heap up to the routines which call B-tree routines, which should drastically lower the number of metadata cache protect/ unprotect calls. Tested on: Mac OS X/32 10.4.9 (amazon) Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'test/lheap.c')
-rw-r--r--test/lheap.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/test/lheap.c b/test/lheap.c
index 60c0b85..abf1bc0 100644
--- a/test/lheap.c
+++ b/test/lheap.c
@@ -58,6 +58,7 @@ main(void)
H5F_t *f=NULL; /*hdf5 file pointer */
char filename[1024]; /*file name */
haddr_t heap_addr; /*local heap address */
+ H5HL_t *heap = NULL; /*local heap */
size_t obj[NOBJS]; /*offsets within the heap */
int i, j; /*miscellaneous counters */
char buf[1024]; /*the value to store */
@@ -86,18 +87,27 @@ main(void)
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
+ if (NULL == (heap = H5HL_protect(f, H5P_DATASET_XFER_DEFAULT, heap_addr, H5AC_WRITE))) {
+ H5_FAILED();
+ H5Eprint2(H5E_DEFAULT, stdout);
+ goto error;
+ }
for(i = 0; i < NOBJS; i++) {
sprintf(buf, "%03d-", i);
for (j=4; j<i; j++) buf[j] = '0' + j%10;
if (j>4) buf[j] = '\0';
- if ((size_t)(-1)==(obj[i]=H5HL_insert(f, H5P_DATASET_XFER_DEFAULT, heap_addr, strlen(buf)+1,
- buf))) {
+ if ((size_t)(-1)==(obj[i]=H5HL_insert(f, H5P_DATASET_XFER_DEFAULT, heap, strlen(buf)+1, buf))) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
}
+ if (H5HL_unprotect(f, H5P_DATASET_XFER_DEFAULT, heap, heap_addr) < 0) {
+ H5_FAILED();
+ H5Eprint2(H5E_DEFAULT, stdout);
+ goto error;
+ }
if (H5Fclose(file)<0) goto error;
PASSED();
@@ -119,8 +129,6 @@ main(void)
goto error;
}
for (i=0; i<NOBJS; i++) {
- H5HL_t *heap = NULL;
-
sprintf(buf, "%03d-", i);
for (j=4; j<i; j++) buf[j] = '0' + j%10;
if (j>4) buf[j] = '\0';
@@ -145,7 +153,7 @@ main(void)
goto error;
}
- if (H5HL_unprotect(f, H5P_DATASET_XFER_DEFAULT, heap, heap_addr, H5AC__NO_FLAGS_SET) < 0) {
+ if (H5HL_unprotect(f, H5P_DATASET_XFER_DEFAULT, heap, heap_addr) < 0) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;