[svn-r30033] Description:

Extract epoch marker metadata client into separate source file.

Tested on:
    MacOSX/64 10.11.5 (amazon) w/serial & parallel
    (h5committest forthcoming)
This commit is contained in:
Quincey Koziol 2016-06-06 00:51:17 -05:00
parent 48fd9fd20a
commit e1f276f267
6 changed files with 250 additions and 188 deletions

View File

@ -488,6 +488,7 @@
./src/H5B2stat.c
./src/H5B2test.c
./src/H5C.c
./src/H5Cepoch.c
./src/H5Cmodule.h
./src/H5Cmpio.c
./src/H5Cpkg.h

View File

@ -83,6 +83,7 @@ IDE_GENERATED_PROPERTIES ("H5B2" "${H5B2_HDRS}" "${H5B2_SOURCES}" )
set (H5C_SOURCES
${HDF5_SRC_DIR}/H5C.c
${HDF5_SRC_DIR}/H5Cepoch.c
${HDF5_SRC_DIR}/H5Cmpio.c
${HDF5_SRC_DIR}/H5Cquery.c
)

189
src/H5C.c
View File

@ -193,6 +193,7 @@ herr_t H5C_dump_cache(H5C_t * cache_ptr, const char * cache_name);
herr_t H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn);
#endif /* debugging routines */
/*********************/
/* Package Variables */
/*********************/
@ -217,192 +218,6 @@ H5FL_DEFINE_STATIC(H5C_t);
H5FL_EXTERN(H5C_collective_write_t);
/****************************************************************************
*
* #defines and declarations for epoch marker cache entries.
*
* As a strategy for automatic cache size reduction, the cache may insert
* marker entries in the LRU list at the end of each epoch. These markers
* are then used to identify entries that have not been accessed for n
* epochs so that they can be evicted from the cache.
*
****************************************************************************/
/* Note that H5C__MAX_EPOCH_MARKERS is defined in H5Cpkg.h, not here because
* it is needed to dimension arrays in H5C_t.
*/
#define H5C__EPOCH_MARKER_TYPE H5C__MAX_NUM_TYPE_IDS
static herr_t H5C__epoch_marker_get_load_size(const void *udata_ptr,
size_t *image_len_ptr);
static void * H5C__epoch_marker_deserialize(const void * image_ptr,
size_t len,
void * udata,
hbool_t * dirty_ptr);
static herr_t H5C__epoch_marker_image_len(const void * thing,
size_t *image_len_ptr,
hbool_t *compressed_ptr,
size_t *compressed_len_ptr);
static herr_t H5C__epoch_marker_pre_serialize(const H5F_t *f,
hid_t dxpl_id,
void * thing,
haddr_t addr,
size_t len,
size_t compressed_len,
haddr_t * new_addr_ptr,
size_t * new_len_ptr,
size_t * new_compressed_len_ptr,
unsigned * flags_ptr);
static herr_t H5C__epoch_marker_serialize(const H5F_t *f,
void * image_ptr,
size_t len,
void * thing);
static herr_t H5C__epoch_marker_notify(H5C_notify_action_t action, void *thing);
static herr_t H5C__epoch_marker_free_icr(void * thing);
static herr_t H5C__epoch_marker_clear(const H5F_t *f, void * thing,
hbool_t about_to_destroy);
static herr_t H5C__epoch_marker_fsf_size(const void H5_ATTR_UNUSED * thing,
size_t H5_ATTR_UNUSED * fsf_size_ptr);
const H5C_class_t epoch_marker_class =
{
/* id = */ H5C__EPOCH_MARKER_TYPE,
/* name = */ "epoch marker",
/* mem_type = */ H5FD_MEM_DEFAULT, /* value doesn't matter */
/* flags = */ H5AC__CLASS_NO_FLAGS_SET,
/* get_load_size = */ H5C__epoch_marker_get_load_size,
/* deserialize = */ H5C__epoch_marker_deserialize,
/* image_len = */ H5C__epoch_marker_image_len,
/* pre_serialize = */ H5C__epoch_marker_pre_serialize,
/* serialize = */ H5C__epoch_marker_serialize,
/* notify = */ H5C__epoch_marker_notify,
/* free_icr = */ H5C__epoch_marker_free_icr,
/* clear = */ H5C__epoch_marker_clear,
/* fsf_size = */ H5C__epoch_marker_fsf_size,
};
/***************************************************************************
* Class functions for H5C__EPOCH_MAKER_TYPE:
*
* None of these functions should ever be called, so there is no point in
* documenting them separately.
* JRM - 11/16/04
*
***************************************************************************/
static herr_t
H5C__epoch_marker_get_load_size(const void H5_ATTR_UNUSED *udata_ptr,
size_t H5_ATTR_UNUSED *image_len_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_get_load_size() */
static void *
H5C__epoch_marker_deserialize(const void H5_ATTR_UNUSED * image_ptr, size_t H5_ATTR_UNUSED len,
void H5_ATTR_UNUSED * udata, hbool_t H5_ATTR_UNUSED * dirty_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(NULL)
} /* end H5C__epoch_marker_deserialize() */
static herr_t
H5C__epoch_marker_image_len(const void H5_ATTR_UNUSED *thing,
size_t H5_ATTR_UNUSED *image_len_ptr, hbool_t H5_ATTR_UNUSED *compressed_ptr,
size_t H5_ATTR_UNUSED *compressed_len_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_image_len() */
static herr_t
H5C__epoch_marker_pre_serialize(const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
void H5_ATTR_UNUSED *thing, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED len,
size_t H5_ATTR_UNUSED compressed_len, haddr_t H5_ATTR_UNUSED *new_addr_ptr,
size_t H5_ATTR_UNUSED *new_len_ptr, size_t H5_ATTR_UNUSED *new_compressed_len_ptr,
unsigned H5_ATTR_UNUSED *flags_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_pre_serialize() */
static herr_t
H5C__epoch_marker_serialize(const H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED *image_ptr,
size_t H5_ATTR_UNUSED len, void H5_ATTR_UNUSED *thing)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_serialize() */
static herr_t
H5C__epoch_marker_notify(H5C_notify_action_t H5_ATTR_UNUSED action,
void H5_ATTR_UNUSED * thing)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_notify() */
static herr_t
H5C__epoch_marker_free_icr(void H5_ATTR_UNUSED * thing)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_free_icr() */
static herr_t
H5C__epoch_marker_clear(const H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED * thing, hbool_t H5_ATTR_UNUSED about_to_destroy)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_clear() */
static herr_t
H5C__epoch_marker_fsf_size(const void H5_ATTR_UNUSED * thing, size_t H5_ATTR_UNUSED *fsf_size_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_fsf_size() */
/*-------------------------------------------------------------------------
* Function: H5C_create
@ -614,7 +429,7 @@ H5C_create(size_t max_cache_size,
((cache_ptr->epoch_markers)[i]).magic =
H5C__H5C_CACHE_ENTRY_T_MAGIC;
((cache_ptr->epoch_markers)[i]).addr = (haddr_t)i;
((cache_ptr->epoch_markers)[i]).type = &epoch_marker_class;
((cache_ptr->epoch_markers)[i]).type = &H5C__epoch_marker_class;
}
if ( H5C_reset_cache_hit_rate_stats(cache_ptr) != SUCCEED ) {

236
src/H5Cepoch.c Normal file
View File

@ -0,0 +1,236 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
* Created: H5Cepoch.c
* June 5 2004
* Quincey Koziol
*
* Purpose: Metadata cache epoch callbacks.
*
*-------------------------------------------------------------------------
*/
/****************/
/* Module Setup */
/****************/
#include "H5Cmodule.h" /* This source code file is part of the H5C module */
/***********/
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Cpkg.h" /* Cache */
/****************/
/* Local Macros */
/****************/
/******************/
/* Local Typedefs */
/******************/
/********************/
/* Local Prototypes */
/********************/
/****************************************************************************
*
* declarations for epoch marker cache entries.
*
* As a strategy for automatic cache size reduction, the cache may insert
* marker entries in the LRU list at the end of each epoch. These markers
* are then used to identify entries that have not been accessed for n
* epochs so that they can be evicted from the cache.
*
****************************************************************************/
static herr_t H5C__epoch_marker_get_load_size(const void *udata_ptr,
size_t *image_len_ptr);
static void * H5C__epoch_marker_deserialize(const void * image_ptr,
size_t len, void * udata, hbool_t * dirty_ptr);
static herr_t H5C__epoch_marker_image_len(const void * thing,
size_t *image_len_ptr, hbool_t *compressed_ptr, size_t *compressed_len_ptr);
static herr_t H5C__epoch_marker_pre_serialize(const H5F_t *f,
hid_t dxpl_id, void * thing, haddr_t addr, size_t len,
size_t compressed_len, haddr_t * new_addr_ptr, size_t * new_len_ptr,
size_t * new_compressed_len_ptr, unsigned * flags_ptr);
static herr_t H5C__epoch_marker_serialize(const H5F_t *f,
void * image_ptr, size_t len, void * thing);
static herr_t H5C__epoch_marker_notify(H5C_notify_action_t action, void *thing);
static herr_t H5C__epoch_marker_free_icr(void * thing);
static herr_t H5C__epoch_marker_clear(const H5F_t *f, void * thing,
hbool_t about_to_destroy);
static herr_t H5C__epoch_marker_fsf_size(const void H5_ATTR_UNUSED * thing,
size_t H5_ATTR_UNUSED * fsf_size_ptr);
/*********************/
/* Package Variables */
/*********************/
/*****************************/
/* Library Private Variables */
/*****************************/
/*******************/
/* Local Variables */
/*******************/
const H5C_class_t H5C__epoch_marker_class =
{
/* id = */ H5C__EPOCH_MARKER_TYPE,
/* name = */ "epoch marker",
/* mem_type = */ H5FD_MEM_DEFAULT, /* value doesn't matter */
/* flags = */ H5C__CLASS_NO_FLAGS_SET,
/* get_load_size = */ H5C__epoch_marker_get_load_size,
/* deserialize = */ H5C__epoch_marker_deserialize,
/* image_len = */ H5C__epoch_marker_image_len,
/* pre_serialize = */ H5C__epoch_marker_pre_serialize,
/* serialize = */ H5C__epoch_marker_serialize,
/* notify = */ H5C__epoch_marker_notify,
/* free_icr = */ H5C__epoch_marker_free_icr,
/* clear = */ H5C__epoch_marker_clear,
/* fsf_size = */ H5C__epoch_marker_fsf_size,
};
/***************************************************************************
* Class functions for H5C__EPOCH_MAKER_TYPE:
*
* None of these functions should ever be called, so there is no point in
* documenting them separately.
* JRM - 11/16/04
*
***************************************************************************/
static herr_t
H5C__epoch_marker_get_load_size(const void H5_ATTR_UNUSED *udata_ptr,
size_t H5_ATTR_UNUSED *image_len_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_get_load_size() */
static void *
H5C__epoch_marker_deserialize(const void H5_ATTR_UNUSED * image_ptr, size_t H5_ATTR_UNUSED len,
void H5_ATTR_UNUSED * udata, hbool_t H5_ATTR_UNUSED * dirty_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(NULL)
} /* end H5C__epoch_marker_deserialize() */
static herr_t
H5C__epoch_marker_image_len(const void H5_ATTR_UNUSED *thing,
size_t H5_ATTR_UNUSED *image_len_ptr, hbool_t H5_ATTR_UNUSED *compressed_ptr,
size_t H5_ATTR_UNUSED *compressed_len_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_image_len() */
static herr_t
H5C__epoch_marker_pre_serialize(const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
void H5_ATTR_UNUSED *thing, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED len,
size_t H5_ATTR_UNUSED compressed_len, haddr_t H5_ATTR_UNUSED *new_addr_ptr,
size_t H5_ATTR_UNUSED *new_len_ptr, size_t H5_ATTR_UNUSED *new_compressed_len_ptr,
unsigned H5_ATTR_UNUSED *flags_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_pre_serialize() */
static herr_t
H5C__epoch_marker_serialize(const H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED *image_ptr,
size_t H5_ATTR_UNUSED len, void H5_ATTR_UNUSED *thing)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_serialize() */
static herr_t
H5C__epoch_marker_notify(H5C_notify_action_t H5_ATTR_UNUSED action,
void H5_ATTR_UNUSED * thing)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_notify() */
static herr_t
H5C__epoch_marker_free_icr(void H5_ATTR_UNUSED * thing)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_free_icr() */
static herr_t
H5C__epoch_marker_clear(const H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED * thing, hbool_t H5_ATTR_UNUSED about_to_destroy)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_clear() */
static herr_t
H5C__epoch_marker_fsf_size(const void H5_ATTR_UNUSED * thing, size_t H5_ATTR_UNUSED *fsf_size_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_fsf_size() */

View File

@ -61,6 +61,12 @@
#define H5C__HASH_TABLE_LEN (64 * 1024) /* must be a power of 2 */
#define H5C__H5C_T_MAGIC 0x005CAC0E
/* Cache client ID for epoch markers */
/* Note that H5C__MAX_EPOCH_MARKERS is defined in H5Cprivate.h, not here because
* it is needed to dimension arrays in H5C_t.
*/
#define H5C__EPOCH_MARKER_TYPE H5C__MAX_NUM_TYPE_IDS
/****************************************************************************
*
* We maintain doubly linked lists of instances of H5C_cache_entry_t for a
@ -4259,6 +4265,9 @@ typedef struct H5C_collective_write_t {
/* Package Private Variables */
/*****************************/
/* Metadata cache epoch class */
H5_DLLVAR const H5C_class_t H5C__epoch_marker_class;
/******************************/
/* Package Private Prototypes */

View File

@ -45,7 +45,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5AC.c \
H5B.c H5Bcache.c H5Bdbg.c \
H5B2.c H5B2cache.c H5B2dbg.c H5B2hdr.c H5B2int.c H5B2stat.c H5B2test.c \
H5C.c H5Cquery.c \
H5C.c H5Cepoch.c H5Cquery.c \
H5CS.c \
H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \
H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfarray.c H5Dfill.c H5Dint.c \