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
|
|
|
|
|
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
|
|
|
|
|
2004-06-23 23:36:35 +08:00
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT(H5O_stab_decode);
|
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;
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2004-06-23 23:36:35 +08:00
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_stab_encode);
|
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
|
|
|
|
|
2004-06-23 23:36:35 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(SUCCEED);
|
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
|
|
|
|
|
2004-06-23 23:36:35 +08:00
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT(H5O_stab_copy);
|
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 */
|
|
|
|
|
|
2004-06-23 23:36:35 +08:00
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_stab_size);
|
2002-08-10 04:48:23 +08:00
|
|
|
|
|
|
|
|
|
/* Set return value */
|
|
|
|
|
ret_value=2 * H5F_SIZEOF_ADDR(f);
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
2004-06-23 23:36:35 +08:00
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_stab_free);
|
2000-08-17 04:13:02 +08:00
|
|
|
|
|
|
|
|
|
assert (mesg);
|
|
|
|
|
|
|
|
|
|
H5FL_FREE(H5O_stab_t,mesg);
|
|
|
|
|
|
2004-06-23 23:36:35 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(SUCCEED);
|
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 */
|
|
|
|
|
|
2004-06-23 23:36:35 +08:00
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT(H5O_stab_delete);
|
2003-04-14 13:03:26 +08:00
|
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
|
|
2004-06-23 23:36:35 +08:00
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_stab_debug);
|
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
|
|
|
|
|
2004-06-23 23:36:35 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(SUCCEED);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
}
|