diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-06-29 03:12:45 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-06-29 03:12:45 (GMT) |
commit | cad9846d77ea4926bb0f13cf5151c1a7ac05ec87 (patch) | |
tree | c88b30412b25b6fc5df9534a6ff2cf1742393a36 /src/H5SMpkg.h | |
parent | 58467956ba56fc52dd03e3540f14b062f9a6c5bb (diff) | |
download | hdf5-cad9846d77ea4926bb0f13cf5151c1a7ac05ec87.zip hdf5-cad9846d77ea4926bb0f13cf5151c1a7ac05ec87.tar.gz hdf5-cad9846d77ea4926bb0f13cf5151c1a7ac05ec87.tar.bz2 |
[svn-r13926] Description:
Add small interface to "wrap" a static buffer (usually on the stack), but
still allow for buffers larger than the static buffer to be allocated. This
can eliminate _many_ short-lived buffer allocations in situations where the
buffer is a predictable size (or at least a "very likely" size).
Also, some minor code cleanups, particularly in the SOHM caching code.
Tested on:
Mac OS X/32 10.4.10 (amazon)
Diffstat (limited to 'src/H5SMpkg.h')
-rwxr-xr-x | src/H5SMpkg.h | 75 |
1 files changed, 46 insertions, 29 deletions
diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h index 72be9f7..8d987a9 100755 --- a/src/H5SMpkg.h +++ b/src/H5SMpkg.h @@ -39,38 +39,55 @@ /****************************/ /* Package Macros */ /****************************/ -#define H5SM_LIST_MAGIC "SMLI" -#define H5SM_LIST_SIZEOF_MAGIC 4 -#define H5SM_TABLE_MAGIC "SMTB" -#define H5SM_TABLE_SIZEOF_MAGIC 4 -#define H5SM_SIZEOF_CHECKSUM 4 - -#define H5SM_HEAP_LOC_SIZE (4 /* Reference count */ \ - + sizeof(H5O_fheap_id_t)) /* size of heap ID on disk */ -#define H5SM_OH_LOC_SIZE(f) (1 /* reserved (possible flags?) */ \ - + 1 /* message type ID */ \ - + 2 /* creation index of message in OH */ \ - + H5F_SIZEOF_ADDR(f)) /* address of OH */ +/* Size of signature information (on disk) */ +#define H5SM_SIZEOF_MAGIC 4 -#define H5SM_SOHM_ENTRY_SIZE(f) (1 /* Message location */ \ - + 4 /* Hash value */ \ - + MAX(H5SM_HEAP_LOC_SIZE, H5SM_OH_LOC_SIZE(f))) +/* Shared Message signatures */ +#define H5SM_TABLE_MAGIC "SMTB" /* Shared Message Table */ +#define H5SM_LIST_MAGIC "SMLI" /* Shared Message List */ -#define H5SM_TABLE_SIZE(f) ( H5SM_TABLE_SIZEOF_MAGIC \ - + H5SM_SIZEOF_CHECKSUM) /* Checksum */ - -#define H5SM_INDEX_HEADER_SIZE(f) (1 /* Whether index is a list or B-tree */ \ - + 1 /* Version of index format */ \ - + 2 /* Type of messages stored in the index */ \ - + 4 /* Minimum size of messages to share */ \ - + (3 * 2) /* B-tree cutoff, list cutoff, # of shared messages */ \ - + H5F_SIZEOF_ADDR(f) /* Location of list or B-tree */ \ - + H5F_SIZEOF_ADDR(f)) /* Address of heap */ +/* Size of checksum information (on disk) */ +#define H5SM_SIZEOF_CHECKSUM 4 -#define H5SM_LIST_SIZE(f, num_mesg) H5SM_LIST_SIZEOF_MAGIC \ - + (H5SM_SOHM_ENTRY_SIZE(f) * num_mesg) \ - + H5SM_SIZEOF_CHECKSUM /* Checksum */ +#define H5SM_HEAP_LOC_SIZE ( \ + 4 /* Reference count */ \ + + sizeof(H5O_fheap_id_t) /* size of heap ID on disk */ \ + ) + +#define H5SM_OH_LOC_SIZE(f) ( \ + 1 /* reserved (possible flags?) */ \ + + 1 /* message type ID */ \ + + 2 /* creation index of message in OH */ \ + + H5F_SIZEOF_ADDR(f) /* address of OH */ \ + ) + +#define H5SM_SOHM_ENTRY_SIZE(f) ( \ + 1 /* Message location */ \ + + 4 /* Hash value */ \ + + MAX(H5SM_HEAP_LOC_SIZE, H5SM_OH_LOC_SIZE(f)) /* Entry */ \ + ) + +#define H5SM_TABLE_SIZE(f) ( \ + H5SM_SIZEOF_MAGIC /* Signature */ \ + + H5SM_SIZEOF_CHECKSUM /* Checksum */ \ + ) + +#define H5SM_INDEX_HEADER_SIZE(f) ( \ + 1 /* Whether index is a list or B-tree */ \ + + 1 /* Version of index format */ \ + + 2 /* Type of messages stored in the index */ \ + + 4 /* Minimum size of messages to share */ \ + + (3 * 2) /* B-tree cutoff, list cutoff, # of shared messages */ \ + + H5F_SIZEOF_ADDR(f) /* Location of list or B-tree */ \ + + H5F_SIZEOF_ADDR(f) /* Address of heap */ \ + ) + +#define H5SM_LIST_SIZE(f, num_mesg) ( \ + H5SM_SIZEOF_MAGIC /* Signature */ \ + + (H5SM_SOHM_ENTRY_SIZE(f) * num_mesg) /* Message entries */ \ + + H5SM_SIZEOF_CHECKSUM /* Checksum */ \ + ) #define H5SM_B2_NODE_SIZE 512 #define H5SM_B2_SPLIT_PERCENT 100 @@ -168,7 +185,7 @@ struct H5SM_master_table_t { /* Information for H5AC cache functions, _must_ be first field in structure */ H5AC_info_t cache_info; - uint8_t num_indexes; /* Number of indexes */ + unsigned num_indexes; /* Number of indexes */ H5SM_index_header_t *indexes; /* Array of num_indexes indexes */ }; |