summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-09-11 17:25:26 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-09-11 17:25:26 (GMT)
commite5cad0ef24543e55d164a26dd42a0cc1ba5c2cbe (patch)
tree0a33a38538477c1705f93a0b92a2ba84828ff6f4 /test
parent9e158b781668387bf82fbab9d60ece304f0e9729 (diff)
downloadhdf5-e5cad0ef24543e55d164a26dd42a0cc1ba5c2cbe.zip
hdf5-e5cad0ef24543e55d164a26dd42a0cc1ba5c2cbe.tar.gz
hdf5-e5cad0ef24543e55d164a26dd42a0cc1ba5c2cbe.tar.bz2
[svn-r12655] Description:
Add "op" routine to perform operation on heap object "in situ", to allow for faster operations on dense links during B-tree traversal & lookup. Refactor the "read" routine to use the internal version of the "op" routine, to keep the code duplication as low as possible. Tested on: Mac OS X.4/PPC (amazon) Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'test')
-rw-r--r--test/fheap.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/test/fheap.c b/test/fheap.c
index eafcc5c..637513e 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -295,6 +295,30 @@ error:
/*-------------------------------------------------------------------------
+ * Function: op_memcpy
+ *
+ * Purpose: Perform 'memcpy' for an object
+ *
+ * Return: Success: 0
+ *
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Monday, September 11, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+op_memcpy(const void *obj, size_t obj_len, void *op_data)
+{
+ /* Make copy of the object */
+ HDmemcpy(op_data, obj, obj_len);
+
+ return(SUCCEED);
+} /* op_memcpy() */
+
+
+/*-------------------------------------------------------------------------
* Function: add_obj
*
* Purpose: Add an object to heap
@@ -13512,6 +13536,13 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
+ /* Check 'op' functionality on first huge object */
+ HDmemset(shared_robj_g, 0, obj_size);
+ if(H5HF_op(fh, dxpl, heap_id, op_memcpy, shared_robj_g) < 0)
+ FAIL_STACK_ERROR
+ if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ TEST_ERROR
+
/* Insert second object too large for managed heap blocks */
obj_size = SMALL_STAND_SIZE + 2;
if(H5HF_insert(fh, dxpl, obj_size, shared_wobj_g, heap_id2) < 0)
@@ -13542,6 +13573,13 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
+ /* Check 'op' functionality on second huge object */
+ HDmemset(shared_robj_g, 0, obj_size);
+ if(H5HF_op(fh, dxpl, heap_id2, op_memcpy, shared_robj_g) < 0)
+ FAIL_STACK_ERROR
+ if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ TEST_ERROR
+
/* Insert third object too large for managed heap blocks */
obj_size = SMALL_STAND_SIZE + 3;
if(H5HF_insert(fh, dxpl, obj_size, shared_wobj_g, heap_id3) < 0)
@@ -13572,6 +13610,13 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
+ /* Check 'op' functionality on third huge object */
+ HDmemset(shared_robj_g, 0, obj_size);
+ if(H5HF_op(fh, dxpl, heap_id3, op_memcpy, shared_robj_g) < 0)
+ FAIL_STACK_ERROR
+ if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ TEST_ERROR
+
/* Insert fourth object small enough to fit into 'normal' heap blocks */
obj_size = DBLOCK_SIZE(fh, 0) + 1;
if(H5HF_insert(fh, dxpl, obj_size, shared_wobj_g, heap_id4) < 0)
@@ -13609,6 +13654,13 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
+ /* Check 'op' functionality on fourth ('normal') object */
+ HDmemset(shared_robj_g, 0, obj_size);
+ if(H5HF_op(fh, dxpl, heap_id4, op_memcpy, shared_robj_g) < 0)
+ FAIL_STACK_ERROR
+ if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ TEST_ERROR
+
/* Insert fifth object small enough to fit into 'normal' heap blocks */
obj_size = DBLOCK_SIZE(fh, 3) + 1;
if(H5HF_insert(fh, dxpl, obj_size, shared_wobj_g, heap_id5) < 0)
@@ -13647,6 +13699,13 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
+ /* Check 'op' functionality on fifth ('normal') object */
+ HDmemset(shared_robj_g, 0, obj_size);
+ if(H5HF_op(fh, dxpl, heap_id5, op_memcpy, shared_robj_g) < 0)
+ FAIL_STACK_ERROR
+ if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ TEST_ERROR
+
/* Insert sixth object small enough to encode in heap ID */
obj_size = tparam->actual_id_len - 2;
@@ -13678,6 +13737,13 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
+ /* Check 'op' functionality on sixth ('tiny') object */
+ HDmemset(shared_robj_g, 0, obj_size);
+ if(H5HF_op(fh, dxpl, heap_id6, op_memcpy, shared_robj_g) < 0)
+ FAIL_STACK_ERROR
+ if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ TEST_ERROR
+
/* Insert seventh object small enough to encode in heap ID */
obj_size = tparam->actual_id_len - 2;
if(H5HF_insert(fh, dxpl, obj_size, shared_wobj_g, heap_id7) < 0)
@@ -13708,6 +13774,13 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
+ /* Check 'op' functionality on seventh ('tiny') object */
+ HDmemset(shared_robj_g, 0, obj_size);
+ if(H5HF_op(fh, dxpl, heap_id7, op_memcpy, shared_robj_g) < 0)
+ FAIL_STACK_ERROR
+ if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ TEST_ERROR
+
/* Delete individual objects, if we won't be deleting the entire heap later */
if(tparam->del_dir != FHEAP_DEL_HEAP) {
if(tparam->del_dir == FHEAP_DEL_FORWARD) {