2003-02-17 23:54:15 +08:00
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
|
* Copyright by the Board of Trustees of the University of Illinois. *
|
|
|
|
|
* All rights reserved. *
|
|
|
|
|
* *
|
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
|
|
|
|
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
|
|
|
|
* of the source code distribution tree; Copyright.html can be found at the *
|
|
|
|
|
* root level of an installed copy of the electronic HDF5 document set and *
|
|
|
|
|
* is linked from the top-level documents page. It can also be found at *
|
|
|
|
|
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
|
|
|
|
|
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
|
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
|
1997-08-08 03:23:00 +08:00
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Created: H5Ostab.c
|
|
|
|
|
* Aug 6 1997
|
|
|
|
|
* Robb Matzke <matzke@llnl.gov>
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Symbol table messages.
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Modifications:
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
2003-02-17 23:54:15 +08:00
|
|
|
|
|
|
|
|
|
#define H5O_PACKAGE /*suppress error about including H5Opkg */
|
2003-05-16 03:22:33 +08:00
|
|
|
|
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
|
2003-02-17 23:54:15 +08:00
|
|
|
|
|
2003-05-16 03:22:33 +08:00
|
|
|
|
#include "H5private.h" /* Generic Functions */
|
|
|
|
|
#include "H5Eprivate.h" /* Error handling */
|
|
|
|
|
#include "H5FLprivate.h" /* Free lists */
|
|
|
|
|
#include "H5Gpkg.h" /* Groups */
|
|
|
|
|
#include "H5MMprivate.h" /* Memory management */
|
|
|
|
|
#include "H5Opkg.h" /* Object headers */
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
#define PABLO_MASK H5O_stab_mask
|
1997-08-10 00:45:59 +08:00
|
|
|
|
|
1997-08-08 03:23:00 +08:00
|
|
|
|
/* PRIVATE PROTOTYPES */
|
2003-02-11 01:26:09 +08:00
|
|
|
|
static void *H5O_stab_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
|
1998-11-19 02:40:09 +08:00
|
|
|
|
static herr_t H5O_stab_encode(H5F_t *f, uint8_t *p, const void *_mesg);
|
1998-02-10 03:37:40 +08:00
|
|
|
|
static void *H5O_stab_copy(const void *_mesg, void *_dest);
|
|
|
|
|
static size_t H5O_stab_size(H5F_t *f, const void *_mesg);
|
2000-08-17 04:13:02 +08:00
|
|
|
|
static herr_t H5O_stab_free (void *_mesg);
|
2003-04-14 13:03:26 +08:00
|
|
|
|
static herr_t H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg);
|
2003-02-11 01:26:09 +08:00
|
|
|
|
static herr_t H5O_stab_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
|
2001-08-15 06:09:56 +08:00
|
|
|
|
FILE * stream, int indent, int fwidth);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
|
|
|
|
/* This message derives from H5O */
|
1998-02-10 03:37:40 +08:00
|
|
|
|
const H5O_class_t H5O_STAB[1] = {{
|
1998-06-05 06:27:11 +08:00
|
|
|
|
H5O_STAB_ID, /*message id number */
|
|
|
|
|
"stab", /*message name for debugging */
|
|
|
|
|
sizeof(H5O_stab_t), /*native message size */
|
|
|
|
|
H5O_stab_decode, /*decode message */
|
|
|
|
|
H5O_stab_encode, /*encode message */
|
|
|
|
|
H5O_stab_copy, /*copy the native value */
|
|
|
|
|
H5O_stab_size, /*size of symbol table entry */
|
|
|
|
|
NULL, /*default reset method */
|
2003-04-14 13:03:26 +08:00
|
|
|
|
H5O_stab_free, /* free method */
|
|
|
|
|
H5O_stab_delete, /* file delete method */
|
2003-10-06 05:12:26 +08:00
|
|
|
|
NULL, /* link method */
|
1998-06-05 06:27:11 +08:00
|
|
|
|
NULL, /*get share method */
|
|
|
|
|
NULL, /*set share method */
|
|
|
|
|
H5O_stab_debug, /*debug the message */
|
1998-02-10 03:37:40 +08:00
|
|
|
|
}};
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
[svn-r139] ./src/*.[ch]
Removed the interface initialization argument from
FUNC_ENTER() and made it a locally-defined preprocessor
symbol, INTERFACE_INIT.
Changed `offset' to `address' and `length' to `size' in
documentation so it's more consistent. `Offset' still appears
occassionally when it refers to a byte offset within some
other data structure.
Moved interface termination function prototypes from public
header files to .c files and made them static.
./src/H5.c
./src/H5public.h
Added H5init() because it's possible that the predefined data
types are not initialized. This happens only if the first
call to the hdf5 library passes a predefined data type symbol
as an argument. There should be some way to fix this...
./src/H5A.c
./src/H5Aprivate.h
./src/H5Apublic.h
The free_func returns SUCCEED or FAIL, although the return
value is ignored by H5A. This is so we can use the various
H5*_close() functions to free things.
H5Ainc_ref() and H5Adec_ref() are no longer public. Many of
the other atom functions should also be made private, but I'll
save that for later...
Added additional template groups called H5_TEMPLATE_0 through
H5_TEMPLATE_7 that are used by the various template
subclasses.
Increased the number of bits used for atom groups to prevent
negative atoms.
./src/H5AC.c
./src/H5ACprivate.h
Changed H5AC_new() to H5AC_create() to make names more consistent.
./src/H5B.c
./src/H5Bprivate.h
Changed H5B_new() to H5B_create() to make names more consistent.
./src/H5C.c
./src/H5Cprivate.h
./src/H5Cpublic.h
Now supports multiple subclasses of templates, although it's
done with big switch statements. The default values for
templates are defined in the source file to which that
template belongs. This got rid of lots of needless
preprocessor constants.
Added H5Ccreate() to create a new template. Changed
H5C_release() to H5Cclose() to make the naming more
consistent.
./src/H5D.c
./src/H5Dprivate.h
./src/H5Dpublic.h
Enhanced to use the new dataset interface, and uses the enhanced
data type and data space interfaces, which haven't been
completely implemented. The dataset interface doesn't handle
non-contiguous storage, compression, or data type and space
conversions yet.
./src/H5F.c
./src/H5Fprivate.h
./src/H5Fpublic.h
Removed H5Fflush() since just calls H5F_flush(), which doesn't
do what the user would probably think it does, namely, flush
everything. It only flushes those things sitting in the H5AC
cache and the boot block.
Changed the `file_create_parms' field of H5F_low_t to just
`create_parms' since the `file' part is obvious.
./src/H5Fistore.c
Added some support for external files. Mostly just in the
file format and not supported much by the library yet. I need
to finish some dataset functions first.
Changed H5F_istore_new() to H5F_istore_create() to make names
more uniform across packages.
./src/H5Flow.c
Flushing a file causes the file to be physically extended to
the logical eof. This prevents H5F_open() from thinking a
file has been truncated. Most of the time the file will
already be that large, and when it isn't Unix will often just
allocate the final block anyway.
./src/H5G.c
./src/H5Gent.c
./src/H5Gnode.c
./src/H5Gpkg.h
./src/H5Gprivate.h
./src/H5Gstab.c
Removed H5G_basename()
Removed (temporarily) data type information from symbol table
entries and renamed H5G_CACHED_SDATA to H5G_CACHED_SDSPACE to
reflect that it's a simple data space and has nothing to do
with raw data.
Changed H5G_node_new() to H5G_node_create() and H5G_stab_new()
to H5G_stab_create() to make names more uniform across
packages.
Fixed an undefined address bug that happens when H5G_node_debug()
program doesn't pass enough info to H5G_node_load().
./src/H5H.c
./src/H5Hprivate.h
Changed H5H_new() to H5H_create() to make the names more
uniform across packages.
./src/H5M.c
./src/H5Mprivate.h
./src/H5Mpublic.h
Nulled all the create functions. Most of the other callbacks
are to public functions. Removed H5Mcreate().
Changed hobjtype_t to group_t since it has to be the same
thing anyway.
./src/H5O.c
./src/H5Oprivate.h
./src/H5Osdim.c
./src/H5Osdtyp.c
Changed H5O_SIM_DIM to H5O_SDSPACE (simple data space) since
`simple data space' is its official name, not `simple
dimensions'. Will eventually add H5O_CDSPACE for comples data
spaces. Changed _sim_dim_ to _dspace_.
Replaced H5O_SIM_DTYPE and the compound data type messages
with a single H5O_DTYPE message. Changed _sim_dtype_ to _dtype_.
Changed H5O_STD_STORE to H5O_CSTORE (contiguous storage) since
contiguous storage is not necessarily standard. Changed
_std_store_ to _cstore_ in H5Ocstore.c
Added the H5O_EFL (external file list) message.
Changed H5O_new() to H5O_create() to make names more uniform
across packages.
./src/H5Oefl.c NEW
External file list message for specifying which non-hdf5 files
contain raw data for a dataset.
./src/H5P.c
./src/H5Pprivate.h
./src/H5Ppublic.h
Renamed and moved data structures to make the names conform to
our naming scheme.
./src/H5T.c
./src/H5Tprivate.h
./src/H5Tpublic.h
./src/H5Tpkg.h NEW
Data structures redesigned to be more flexible. The interface
was redesigned to make it more regular and to make some names
more uniform across packages.
./src/H5detect.c
Output was changed to produce a file that conforms to the hdf5
coding standard.
./src/Makefile.in
Generates H5Tinit.c by running H5detect.
./src/debug.c
Moved command argument processing.
1997-12-11 06:41:07 +08:00
|
|
|
|
/* Interface initialization */
|
2001-08-15 06:09:56 +08:00
|
|
|
|
static int interface_initialize_g = 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
#define INTERFACE_INIT NULL
|
2000-08-17 04:13:02 +08:00
|
|
|
|
|
|
|
|
|
/* Declare a free list to manage the H5O_stab_t struct */
|
|
|
|
|
H5FL_DEFINE_STATIC(H5O_stab_t);
|
|
|
|
|
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5O_stab_decode
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Decode a symbol table message and return a pointer to
|
|
|
|
|
* a new one created with malloc().
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Return: Success: Ptr to new message in native order.
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Failure: NULL
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Aug 6 1997
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
1998-02-10 03:37:40 +08:00
|
|
|
|
static void *
|
2003-02-13 01:04:40 +08:00
|
|
|
|
H5O_stab_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh)
|
1997-08-08 03:23:00 +08:00
|
|
|
|
{
|
2002-08-09 00:52:55 +08:00
|
|
|
|
H5O_stab_t *stab=NULL;
|
|
|
|
|
void *ret_value; /* Return value */
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5O_stab_decode, NULL);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* check args */
|
|
|
|
|
assert(f);
|
|
|
|
|
assert(p);
|
1998-06-05 06:27:11 +08:00
|
|
|
|
assert (!sh);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* decode */
|
[svn-r6252] Purpose:
Lots of performance improvements & a couple new internal API interfaces.
Description:
Performance Improvements:
- Cached file offset & length sizes in shared file struct, to avoid
constantly looking them up in the FCPL.
- Generic property improvements:
- Added "revision" number to generic property classes to speed
up comparisons.
- Changed method of storing properties from using a hash-table
to the TBBT routines in the library.
- Share the propery names between classes and the lists derived
from them.
- Removed redundant 'def_value' buffer from each property.
- Switching code to use a "copy on write" strategy for
properties in each list, where the properties in each list
are shared with the properties in the class, until a
property's value is changed in a list.
- Fixed error in layout code which was allocating too many buffers.
- Redefined public macros of the form (H5open()/H5check, <variable>)
internally to only be (<variable>), avoiding innumerable useless
calls to H5open() and H5check_version().
- Reuse already zeroed buffers in H5F_contig_fill instead of
constantly re-zeroing them.
- Don't write fill values if writing entire dataset.
- Use gettimeofday() system call instead of time() system when
checking the modification time of a dataset.
- Added reference counted string API and use it for tracking the
names of objects opening in a file (for the ID->name code).
- Removed redundant H5P_get() calls in B-tree routines.
- Redefine H5T datatype macros internally to the library, to avoid
calling H5check redundantly.
- Keep dataspace information for dataset locally instead of reading
from disk each time. Added new module to track open objects
in a file, to allow this (which will be useful eventually for
some FPH5 metadata caching issues).
- Remove H5AC_find macro which was inlining metadata cache lookups,
and call function instead.
- Remove redundant memset() calls from H5G_namei() routine.
- Remove redundant checking of object type when locating objects
in metadata cache and rely on the address only.
- Create default dataset object to use when default dataset creation
property list is used to create datasets, bypassing querying
for all the property list values.
- Use default I/O vector size when performing raw data with the
default dataset transfer property list, instead of querying for
I/O vector size.
- Remove H5P_DEFAULT internally to the library, replacing it with
more specific default property list based on the type of
property list needed.
- Remove redundant memset() calls in object header message (H5O*)
routines.
- Remove redunant memset() calls in data I/O routines.
- Split free-list allocation routines into malloc() and calloc()-
like routines, instead of one combined routine.
- Remove lots of indirection in H5O*() routines.
- Simplify metadata cache entry comparison routine (used when
flushing entire cache out).
- Only enable metadata cache statistics when H5AC_DEBUG is turned
on, instead of always tracking them.
- Simplify address comparison macro (H5F_addr_eq).
- Remove redundant metadata cache entry protections during dataset
creation by protecting the object header once and making all
the modifications necessary for the dataset creation before
unprotecting it.
- Reduce # of "number of element in extent" computations performed
by computing and storing the value during dataspace creation.
- Simplify checking for group location's file information, when file
has not been involving in file-mounting operations.
- Use binary encoding for modification time, instead of ASCII.
- Hoist H5HL_peek calls (to get information in a local heap)
out of loops in many group routine.
- Use static variable for iterators of selections, instead of
dynamically allocation them each time.
- Lookup & insert new entries in one step, avoiding traversing
group's B-tree twice.
- Fixed memory leak in H5Gget_objname_idx() routine (tangential to
performance improvements, but fixed along the way).
- Use free-list for reference counted strings.
- Don't bother copying object names into cached group entries,
since they are re-created when an object is opened.
The benchmark I used to measure these results created several thousand
small (2K) datasets in a file and wrote out the data for them. This is
Elena's "regular.c" benchmark.
These changes resulted in approximately ~4.3x speedup of the
development branch when compared to the previous code in the
development branch and ~1.4x speedup compared to the release
branch.
Additionally, these changes reduce the total memory used (code and
data) by the development branch by ~800KB, bringing the development
branch back into the same ballpark as the release branch.
I'll send out a more detailed description of the benchmark results
as a followup note.
New internal API routines:
Added "reference counted strings" API for tracking strings that get
used by multiple owners without duplicating the strings.
Added "ternary search tree" API for text->object mappings.
Platforms tested:
Tested h5committest {arabica (fortran), eirene (fortran, C++)
modi4 (parallel, fortran)}
Other platforms/configurations tested?
FreeBSD 4.7 (sleipnir) serial & parallel
Solaris 2.6 (baldric) serial
2003-01-10 01:20:03 +08:00
|
|
|
|
if (NULL==(stab = H5FL_CALLOC(H5O_stab_t)))
|
2002-08-09 00:52:55 +08:00
|
|
|
|
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
|
1998-01-17 06:23:43 +08:00
|
|
|
|
H5F_addr_decode(f, &p, &(stab->btree_addr));
|
|
|
|
|
H5F_addr_decode(f, &p, &(stab->heap_addr));
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
/* Set return value */
|
|
|
|
|
ret_value=stab;
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
if(ret_value==NULL) {
|
|
|
|
|
if(stab!=NULL)
|
|
|
|
|
H5FL_FREE(H5O_stab_t,stab);
|
|
|
|
|
} /* end if */
|
|
|
|
|
|
2003-01-11 04:26:02 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
2002-08-09 00:52:55 +08:00
|
|
|
|
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5O_stab_encode
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Encodes a symbol table message.
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Aug 6 1997
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
1998-11-19 02:40:09 +08:00
|
|
|
|
H5O_stab_encode(H5F_t *f, uint8_t *p, const void *_mesg)
|
1997-08-08 03:23:00 +08:00
|
|
|
|
{
|
1998-01-17 06:23:43 +08:00
|
|
|
|
const H5O_stab_t *stab = (const H5O_stab_t *) _mesg;
|
2002-08-10 04:48:23 +08:00
|
|
|
|
herr_t ret_value=SUCCEED; /* Return value */
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5O_stab_encode, FAIL);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* check args */
|
|
|
|
|
assert(f);
|
|
|
|
|
assert(p);
|
|
|
|
|
assert(stab);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* encode */
|
1999-07-29 02:25:43 +08:00
|
|
|
|
H5F_addr_encode(f, &p, stab->btree_addr);
|
|
|
|
|
H5F_addr_encode(f, &p, stab->heap_addr);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2002-08-10 04:48:23 +08:00
|
|
|
|
done:
|
2003-01-11 04:26:02 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
}
|
2002-08-09 00:52:55 +08:00
|
|
|
|
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5O_stab_fast
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Initializes a new message struct with info from the cache of
|
|
|
|
|
* a symbol table entry.
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Return: Success: Ptr to message struct, allocated if none
|
|
|
|
|
* supplied.
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Failure: NULL
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Aug 6 1997
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
1998-02-10 03:37:40 +08:00
|
|
|
|
void *
|
1998-01-17 06:23:43 +08:00
|
|
|
|
H5O_stab_fast(const H5G_cache_t *cache, const H5O_class_t *type, void *_mesg)
|
1997-08-08 03:23:00 +08:00
|
|
|
|
{
|
2002-08-09 00:52:55 +08:00
|
|
|
|
H5O_stab_t *stab = NULL;
|
|
|
|
|
void *ret_value; /* Return value */
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5O_stab_fast, NULL);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* check args */
|
|
|
|
|
assert(cache);
|
|
|
|
|
assert(type);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
if (H5O_STAB == type) {
|
1998-06-23 11:41:22 +08:00
|
|
|
|
if (_mesg) {
|
|
|
|
|
stab = (H5O_stab_t *) _mesg;
|
[svn-r6252] Purpose:
Lots of performance improvements & a couple new internal API interfaces.
Description:
Performance Improvements:
- Cached file offset & length sizes in shared file struct, to avoid
constantly looking them up in the FCPL.
- Generic property improvements:
- Added "revision" number to generic property classes to speed
up comparisons.
- Changed method of storing properties from using a hash-table
to the TBBT routines in the library.
- Share the propery names between classes and the lists derived
from them.
- Removed redundant 'def_value' buffer from each property.
- Switching code to use a "copy on write" strategy for
properties in each list, where the properties in each list
are shared with the properties in the class, until a
property's value is changed in a list.
- Fixed error in layout code which was allocating too many buffers.
- Redefined public macros of the form (H5open()/H5check, <variable>)
internally to only be (<variable>), avoiding innumerable useless
calls to H5open() and H5check_version().
- Reuse already zeroed buffers in H5F_contig_fill instead of
constantly re-zeroing them.
- Don't write fill values if writing entire dataset.
- Use gettimeofday() system call instead of time() system when
checking the modification time of a dataset.
- Added reference counted string API and use it for tracking the
names of objects opening in a file (for the ID->name code).
- Removed redundant H5P_get() calls in B-tree routines.
- Redefine H5T datatype macros internally to the library, to avoid
calling H5check redundantly.
- Keep dataspace information for dataset locally instead of reading
from disk each time. Added new module to track open objects
in a file, to allow this (which will be useful eventually for
some FPH5 metadata caching issues).
- Remove H5AC_find macro which was inlining metadata cache lookups,
and call function instead.
- Remove redundant memset() calls from H5G_namei() routine.
- Remove redundant checking of object type when locating objects
in metadata cache and rely on the address only.
- Create default dataset object to use when default dataset creation
property list is used to create datasets, bypassing querying
for all the property list values.
- Use default I/O vector size when performing raw data with the
default dataset transfer property list, instead of querying for
I/O vector size.
- Remove H5P_DEFAULT internally to the library, replacing it with
more specific default property list based on the type of
property list needed.
- Remove redundant memset() calls in object header message (H5O*)
routines.
- Remove redunant memset() calls in data I/O routines.
- Split free-list allocation routines into malloc() and calloc()-
like routines, instead of one combined routine.
- Remove lots of indirection in H5O*() routines.
- Simplify metadata cache entry comparison routine (used when
flushing entire cache out).
- Only enable metadata cache statistics when H5AC_DEBUG is turned
on, instead of always tracking them.
- Simplify address comparison macro (H5F_addr_eq).
- Remove redundant metadata cache entry protections during dataset
creation by protecting the object header once and making all
the modifications necessary for the dataset creation before
unprotecting it.
- Reduce # of "number of element in extent" computations performed
by computing and storing the value during dataspace creation.
- Simplify checking for group location's file information, when file
has not been involving in file-mounting operations.
- Use binary encoding for modification time, instead of ASCII.
- Hoist H5HL_peek calls (to get information in a local heap)
out of loops in many group routine.
- Use static variable for iterators of selections, instead of
dynamically allocation them each time.
- Lookup & insert new entries in one step, avoiding traversing
group's B-tree twice.
- Fixed memory leak in H5Gget_objname_idx() routine (tangential to
performance improvements, but fixed along the way).
- Use free-list for reference counted strings.
- Don't bother copying object names into cached group entries,
since they are re-created when an object is opened.
The benchmark I used to measure these results created several thousand
small (2K) datasets in a file and wrote out the data for them. This is
Elena's "regular.c" benchmark.
These changes resulted in approximately ~4.3x speedup of the
development branch when compared to the previous code in the
development branch and ~1.4x speedup compared to the release
branch.
Additionally, these changes reduce the total memory used (code and
data) by the development branch by ~800KB, bringing the development
branch back into the same ballpark as the release branch.
I'll send out a more detailed description of the benchmark results
as a followup note.
New internal API routines:
Added "reference counted strings" API for tracking strings that get
used by multiple owners without duplicating the strings.
Added "ternary search tree" API for text->object mappings.
Platforms tested:
Tested h5committest {arabica (fortran), eirene (fortran, C++)
modi4 (parallel, fortran)}
Other platforms/configurations tested?
FreeBSD 4.7 (sleipnir) serial & parallel
Solaris 2.6 (baldric) serial
2003-01-10 01:20:03 +08:00
|
|
|
|
} else if (NULL==(stab = H5FL_CALLOC(H5O_stab_t))) {
|
2002-08-09 00:52:55 +08:00
|
|
|
|
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
|
1998-06-23 11:41:22 +08:00
|
|
|
|
}
|
1998-01-17 06:23:43 +08:00
|
|
|
|
stab->btree_addr = cache->stab.btree_addr;
|
|
|
|
|
stab->heap_addr = cache->stab.heap_addr;
|
|
|
|
|
}
|
2002-08-09 00:52:55 +08:00
|
|
|
|
|
|
|
|
|
/* Set return value */
|
|
|
|
|
ret_value=stab;
|
|
|
|
|
|
|
|
|
|
done:
|
2003-01-11 04:26:02 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
}
|
2002-08-09 00:52:55 +08:00
|
|
|
|
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5O_stab_copy
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Copies a message from _MESG to _DEST, allocating _DEST if
|
|
|
|
|
* necessary.
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Return: Success: Ptr to _DEST
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Failure: NULL
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Aug 6 1997
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
1998-02-10 03:37:40 +08:00
|
|
|
|
static void *
|
1998-01-17 06:23:43 +08:00
|
|
|
|
H5O_stab_copy(const void *_mesg, void *_dest)
|
1997-08-08 03:23:00 +08:00
|
|
|
|
{
|
1998-01-17 06:23:43 +08:00
|
|
|
|
const H5O_stab_t *stab = (const H5O_stab_t *) _mesg;
|
|
|
|
|
H5O_stab_t *dest = (H5O_stab_t *) _dest;
|
2002-08-09 00:52:55 +08:00
|
|
|
|
void *ret_value; /* Return value */
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5O_stab_copy, NULL);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* check args */
|
|
|
|
|
assert(stab);
|
[svn-r6252] Purpose:
Lots of performance improvements & a couple new internal API interfaces.
Description:
Performance Improvements:
- Cached file offset & length sizes in shared file struct, to avoid
constantly looking them up in the FCPL.
- Generic property improvements:
- Added "revision" number to generic property classes to speed
up comparisons.
- Changed method of storing properties from using a hash-table
to the TBBT routines in the library.
- Share the propery names between classes and the lists derived
from them.
- Removed redundant 'def_value' buffer from each property.
- Switching code to use a "copy on write" strategy for
properties in each list, where the properties in each list
are shared with the properties in the class, until a
property's value is changed in a list.
- Fixed error in layout code which was allocating too many buffers.
- Redefined public macros of the form (H5open()/H5check, <variable>)
internally to only be (<variable>), avoiding innumerable useless
calls to H5open() and H5check_version().
- Reuse already zeroed buffers in H5F_contig_fill instead of
constantly re-zeroing them.
- Don't write fill values if writing entire dataset.
- Use gettimeofday() system call instead of time() system when
checking the modification time of a dataset.
- Added reference counted string API and use it for tracking the
names of objects opening in a file (for the ID->name code).
- Removed redundant H5P_get() calls in B-tree routines.
- Redefine H5T datatype macros internally to the library, to avoid
calling H5check redundantly.
- Keep dataspace information for dataset locally instead of reading
from disk each time. Added new module to track open objects
in a file, to allow this (which will be useful eventually for
some FPH5 metadata caching issues).
- Remove H5AC_find macro which was inlining metadata cache lookups,
and call function instead.
- Remove redundant memset() calls from H5G_namei() routine.
- Remove redundant checking of object type when locating objects
in metadata cache and rely on the address only.
- Create default dataset object to use when default dataset creation
property list is used to create datasets, bypassing querying
for all the property list values.
- Use default I/O vector size when performing raw data with the
default dataset transfer property list, instead of querying for
I/O vector size.
- Remove H5P_DEFAULT internally to the library, replacing it with
more specific default property list based on the type of
property list needed.
- Remove redundant memset() calls in object header message (H5O*)
routines.
- Remove redunant memset() calls in data I/O routines.
- Split free-list allocation routines into malloc() and calloc()-
like routines, instead of one combined routine.
- Remove lots of indirection in H5O*() routines.
- Simplify metadata cache entry comparison routine (used when
flushing entire cache out).
- Only enable metadata cache statistics when H5AC_DEBUG is turned
on, instead of always tracking them.
- Simplify address comparison macro (H5F_addr_eq).
- Remove redundant metadata cache entry protections during dataset
creation by protecting the object header once and making all
the modifications necessary for the dataset creation before
unprotecting it.
- Reduce # of "number of element in extent" computations performed
by computing and storing the value during dataspace creation.
- Simplify checking for group location's file information, when file
has not been involving in file-mounting operations.
- Use binary encoding for modification time, instead of ASCII.
- Hoist H5HL_peek calls (to get information in a local heap)
out of loops in many group routine.
- Use static variable for iterators of selections, instead of
dynamically allocation them each time.
- Lookup & insert new entries in one step, avoiding traversing
group's B-tree twice.
- Fixed memory leak in H5Gget_objname_idx() routine (tangential to
performance improvements, but fixed along the way).
- Use free-list for reference counted strings.
- Don't bother copying object names into cached group entries,
since they are re-created when an object is opened.
The benchmark I used to measure these results created several thousand
small (2K) datasets in a file and wrote out the data for them. This is
Elena's "regular.c" benchmark.
These changes resulted in approximately ~4.3x speedup of the
development branch when compared to the previous code in the
development branch and ~1.4x speedup compared to the release
branch.
Additionally, these changes reduce the total memory used (code and
data) by the development branch by ~800KB, bringing the development
branch back into the same ballpark as the release branch.
I'll send out a more detailed description of the benchmark results
as a followup note.
New internal API routines:
Added "reference counted strings" API for tracking strings that get
used by multiple owners without duplicating the strings.
Added "ternary search tree" API for text->object mappings.
Platforms tested:
Tested h5committest {arabica (fortran), eirene (fortran, C++)
modi4 (parallel, fortran)}
Other platforms/configurations tested?
FreeBSD 4.7 (sleipnir) serial & parallel
Solaris 2.6 (baldric) serial
2003-01-10 01:20:03 +08:00
|
|
|
|
if (!dest && NULL==(dest = H5FL_MALLOC(H5O_stab_t)))
|
2002-08-09 00:52:55 +08:00
|
|
|
|
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
|
1998-06-23 11:41:22 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* copy */
|
|
|
|
|
*dest = *stab;
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
/* Set return value */
|
|
|
|
|
ret_value=dest;
|
|
|
|
|
|
|
|
|
|
done:
|
2003-01-11 04:26:02 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
2002-08-09 00:52:55 +08:00
|
|
|
|
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5O_stab_size
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Returns the size of the raw message in bytes not counting
|
|
|
|
|
* the message type or size fields, but only the data fields.
|
|
|
|
|
* This function doesn't take into account alignment.
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Return: Success: Message data size in bytes without alignment.
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-03-18 05:50:32 +08:00
|
|
|
|
* Failure: zero
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Aug 6 1997
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static size_t
|
2002-04-23 01:48:24 +08:00
|
|
|
|
H5O_stab_size(H5F_t *f, const void UNUSED *_mesg)
|
1997-08-08 03:23:00 +08:00
|
|
|
|
{
|
2002-08-10 04:48:23 +08:00
|
|
|
|
size_t ret_value; /* Return value */
|
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5O_stab_size, 0);
|
2002-08-10 04:48:23 +08:00
|
|
|
|
|
|
|
|
|
/* Set return value */
|
|
|
|
|
ret_value=2 * H5F_SIZEOF_ADDR(f);
|
|
|
|
|
|
|
|
|
|
done:
|
2003-01-11 04:26:02 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
}
|
2000-08-17 04:13:02 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: H5O_stab_free
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Free's the message
|
|
|
|
|
*
|
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* Thursday, March 30, 2000
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
|
|
|
|
H5O_stab_free (void *mesg)
|
|
|
|
|
{
|
2002-08-10 04:48:23 +08:00
|
|
|
|
herr_t ret_value=SUCCEED; /* Return value */
|
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5O_stab_free, FAIL);
|
2000-08-17 04:13:02 +08:00
|
|
|
|
|
|
|
|
|
assert (mesg);
|
|
|
|
|
|
|
|
|
|
H5FL_FREE(H5O_stab_t,mesg);
|
|
|
|
|
|
2002-08-10 04:48:23 +08:00
|
|
|
|
done:
|
2003-01-11 04:26:02 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value);
|
2000-08-17 04:13:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
2003-04-14 13:03:26 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: H5O_stab_delete
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Free file space referenced by message
|
|
|
|
|
*
|
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* Thursday, March 20, 2003
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
|
|
|
|
H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg)
|
|
|
|
|
{
|
|
|
|
|
const H5O_stab_t *stab = (const H5O_stab_t *) _mesg;
|
|
|
|
|
herr_t ret_value=SUCCEED; /* Return value */
|
|
|
|
|
|
|
|
|
|
FUNC_ENTER_NOAPI(H5O_stab_delete, FAIL);
|
|
|
|
|
|
|
|
|
|
/* check args */
|
|
|
|
|
assert(f);
|
|
|
|
|
assert(stab);
|
|
|
|
|
|
|
|
|
|
/* Free the file space for the symbol table */
|
|
|
|
|
if (H5G_stab_delete(f, dxpl_id, stab->btree_addr, stab->heap_addr)<0)
|
|
|
|
|
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free symbol table");
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value);
|
|
|
|
|
} /* end H5O_stab_delete() */
|
|
|
|
|
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5O_stab_debug
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Prints debugging info for a symbol table message.
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Aug 6 1997
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
2003-02-13 01:04:40 +08:00
|
|
|
|
H5O_stab_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE * stream,
|
2001-08-15 06:09:56 +08:00
|
|
|
|
int indent, int fwidth)
|
1997-08-08 03:23:00 +08:00
|
|
|
|
{
|
1998-01-17 06:23:43 +08:00
|
|
|
|
const H5O_stab_t *stab = (const H5O_stab_t *) _mesg;
|
2002-08-10 04:48:23 +08:00
|
|
|
|
herr_t ret_value=SUCCEED; /* Return value */
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5O_stab_debug, FAIL);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
/* check args */
|
|
|
|
|
assert(f);
|
|
|
|
|
assert(stab);
|
|
|
|
|
assert(stream);
|
|
|
|
|
assert(indent >= 0);
|
|
|
|
|
assert(fwidth >= 0);
|
|
|
|
|
|
1999-07-29 02:25:43 +08:00
|
|
|
|
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
|
|
|
|
|
"B-tree address:", stab->btree_addr);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
1999-07-29 02:25:43 +08:00
|
|
|
|
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
|
|
|
|
|
"Name heap address:", stab->heap_addr);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2002-08-10 04:48:23 +08:00
|
|
|
|
done:
|
2003-01-11 04:26:02 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
}
|