本文整理汇总了C++中HDfprintf函数的典型用法代码示例。如果您正苦于以下问题:C++ HDfprintf函数的具体用法?C++ HDfprintf怎么用?C++ HDfprintf使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HDfprintf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: H5O_ginfo_debug
/*-------------------------------------------------------------------------
* Function: H5O_ginfo_debug
*
* Purpose: Prints debugging info for a message.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* [email protected]
* Aug 30 2005
*
*-------------------------------------------------------------------------
*/
static herr_t
H5O_ginfo_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE * stream,
int indent, int fwidth)
{
const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *) _mesg;
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* check args */
HDassert(f);
HDassert(ginfo);
HDassert(stream);
HDassert(indent >= 0);
HDassert(fwidth >= 0);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Max. compact links:", ginfo->max_compact);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Min. dense links:", ginfo->min_dense);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Estimated # of objects in group:", ginfo->est_num_entries);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Estimated length of object in group's name:", ginfo->est_name_len);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_ginfo_debug() */
示例2: print_metadata_retries_info
/*-------------------------------------------------------------------------
* Function: print_metadata_retries_info
*
* Purpose: To retrieve and print the collection of metadata retries for the file.
*
* Parameters: fid: the currently opened file identifier
*
* Return: Success: 0
* Failure: negative
*
*-------------------------------------------------------------------------
*/
int
print_metadata_retries_info(hid_t fid)
{
H5F_retry_info_t info;
unsigned i;
/* Retrieve the collection of retries */
if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
return (-1);
/* Print information for each non-NULL retries[i] */
for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
unsigned power;
unsigned j;
if(NULL == info.retries[i])
continue;
HDfprintf(stderr, "Metadata read retries for item %u:\n", i);
power = 1;
for(j = 0; j < info.nbins; j++) {
if(info.retries[i][j])
HDfprintf(stderr, "\t# of retries for %u - %u retries: %u\n",
power, (power * 10) - 1, info.retries[i][j]);
power *= 10;
} /* end for */
} /* end for */
/* Free memory for each non-NULL retries[i] */
for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
if(info.retries[i] != NULL)
HDfree(info.retries[i]);
return 0;
} /* print_metadata_retries_info() */
示例3: H5HF_man_dblock_destroy
/*-------------------------------------------------------------------------
* Function: H5HF_man_dblock_destroy
*
* Purpose: Destroy a managed direct block
*
* Note: This routine does _not_ insert a range section for the
* destroyed direct block, that must be handled by the
* caller.
*
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* [email protected]
* May 17 2006
*
*-------------------------------------------------------------------------
*/
herr_t
H5HF_man_dblock_destroy(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_direct_t *dblock,
haddr_t dblock_addr)
{
hsize_t dblock_size; /* Size of direct block on disk */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_destroy)
#ifdef QAK
HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off);
HDfprintf(stderr, "%s: dblock->size = %Zu\n", FUNC, dblock->size);
HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr);
#endif /* QAK */
/*
* Check arguments.
*/
HDassert(hdr);
HDassert(dblock);
/* Check for I/O filters on this heap */
if(hdr->filter_len > 0) {
/* Check for root direct block */
if(dblock->parent == NULL)
/* Get direct block's actual size */
dblock_size = (hsize_t)hdr->pline_root_direct_size;
else {
H5HF_indirect_t *par_iblock; /* Parent indirect block */
unsigned par_entry; /* Entry in parent indirect block */
/* Get parent information */
par_iblock = dblock->parent;
par_entry = dblock->par_entry;
/* Get direct block's actual size */
dblock_size = (hsize_t)par_iblock->filt_ents[par_entry].size;
} /* end else */
} /* end if */
else
dblock_size = (hsize_t)dblock->size;
/* Check for root direct block */
if(hdr->man_dtable.curr_root_rows == 0) {
#ifdef QAK
HDfprintf(stderr, "%s: root direct block\n", FUNC);
#endif /* QAK */
/* Sanity check */
HDassert(hdr->man_dtable.table_addr == dblock_addr);
HDassert(hdr->man_dtable.cparam.start_block_size == dblock->size);
/* Sanity check block iterator */
HDassert(!H5HF_man_iter_ready(&hdr->next_block));
/* Reset root pointer information */
hdr->man_dtable.table_addr = HADDR_UNDEF;
/* Reset header information back to "empty heap" state */
if(H5HF_hdr_empty(hdr) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't make heap empty")
} /* end if */
示例4: custom_print_cb
/*-------------------------------------------------------------------------
* Function: custom_print_cb
*
* Purpose: Callback function to print error stack in customized way.
*
* Return: Success: 0
*
* Failure: -1
*
* Programmer: Raymond Lu
* July 17, 2003
*
*-------------------------------------------------------------------------
*/
static herr_t
custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void* client_data)
{
FILE *stream = (FILE *)client_data;
char maj[MSG_SIZE];
char min[MSG_SIZE];
char cls[MSG_SIZE];
const int indent = 4;
/* Get descriptions for the major and minor error numbers */
if(H5Eget_class_name(err_desc->cls_id, cls, MSG_SIZE) < 0)
TEST_ERROR;
if(H5Eget_msg(err_desc->maj_num, NULL, maj, MSG_SIZE) < 0)
TEST_ERROR;
if(H5Eget_msg(err_desc->min_num, NULL, min, MSG_SIZE) < 0)
TEST_ERROR;
HDfprintf(stream, "%*serror #%03d: %s in %s(): line %u\n",
indent, "", n, err_desc->file_name,
err_desc->func_name, err_desc->line);
HDfprintf(stream, "%*sclass: %s\n", indent * 2, "", cls);
HDfprintf(stream, "%*smajor: %s\n", indent * 2, "", maj);
HDfprintf(stream, "%*sminor: %s\n", indent * 2, "", min);
return 0;
error:
return -1;
} /* end custom_print_cb() */
示例5: send_signal
/*-------------------------------------------------------------------------
* Function: send_signal
*
* Purpose: Sends the specified signal.
*
* In terms of this test framework, a signal consists of a file
* on disk. Since there are multiple processes that need to
* communicate with each other, they do so by writing and
* reading signal files on disk, the names and contents of
* which are used to inform a process about when it can
* proceed and what it should do next.
*
* This function writes a signal file. The first argument is
* the name of the signal file, and the second and third
* arguments are the contents of the first two lines of the
* signal file. The last two arguments may be NULL.
*
* Return: void
*
* Programmer: Mike McGreevy
* August 18, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
void send_signal(const char * send, const char * arg1, const char * arg2)
{
FILE *signalfile = NULL;
/* Create signal file (which will send signal to some other process) */
signalfile = fopen(send, "w+");
/* Write messages to signal file, if provided */
if (arg2 != NULL) {
HDassert(arg1);
HDfprintf(signalfile, "%s\n%s\n", arg1, arg2);
} /* end if */
else if (arg1 != NULL) {
HDassert(arg2 == NULL);
HDfprintf(signalfile, "%s\n", arg1);
} /* end if */
else {
HDassert(arg1 == NULL);
HDassert(arg2 == NULL);
}/* end else */
HDfflush(signalfile);
HDfclose(signalfile);
} /* send_signal */
示例6: print_io_api
static void
print_io_api(long io_types)
{
if (io_types & SIO_POSIX)
HDfprintf(output, "posix ");
if (io_types & SIO_HDF5)
HDfprintf(output, "hdf5 ");
HDfprintf(output, "\n");
}
示例7: check_dataset
/*-------------------------------------------------------------------------
* Function: check_dataset
*
* Purpose: For a given dataset, checks to make sure that the stated
* and actual sizes are the same. If they are not, then
* we have an inconsistent dataset due to a SWMR error.
*
* Parameters: hid_t fid
* The SWMR test file's ID.
*
* unsigned verbose
* Whether verbose console output is desired.
*
* const symbol_info_t *symbol
* The dataset from which to read (the ID is in the struct).
* Must be pre-allocated.
*
* symbol_t *record
* Memory for the record. Must be pre-allocated.
*
* hid_t rec_sid
* The memory dataspace for access. It's always the same so
* there is no need to re-create it every time this function
* is called.
*
* Return: Success: 0
* Failure: -1
*
*-------------------------------------------------------------------------
*/
static int
check_dataset(hid_t fid, unsigned verbose, const symbol_info_t *symbol, symbol_t *record,
hid_t rec_sid)
{
hid_t dsid; /* Dataset ID */
hid_t file_sid; /* Dataset's space ID */
hsize_t start[2] = {0, 0}; /* Hyperslab selection values */
hsize_t count[2] = {1, 1}; /* Hyperslab selection values */
HDassert(fid >= 0);
HDassert(symbol);
HDassert(record);
HDassert(rec_sid >= 0);
/* Open dataset for symbol */
if((dsid = H5Dopen2(fid, symbol->name, H5P_DEFAULT)) < 0)
return -1;
/* Get the dataset's dataspace */
if((file_sid = H5Dget_space(dsid)) < 0)
return -1;
/* Choose the random record in the dataset (will be the same as chosen by
* the writer) */
start[1] = (hsize_t)HDrandom() % symbol->nrecords;
if(H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
return -1;
/* Emit informational message */
if(verbose)
HDfprintf(stderr, "Symbol = '%s', location = %lld\n", symbol->name, (long long)start);
/* Read record from dataset */
record->rec_id = (uint64_t)ULLONG_MAX;
if(H5Dread(dsid, symbol_tid, rec_sid, file_sid, H5P_DEFAULT, record) < 0)
return -1;
/* Verify record value */
if(record->rec_id != start[1]) {
HDfprintf(stderr, "*** ERROR ***\n");
HDfprintf(stderr, "Incorrect record value!\n");
HDfprintf(stderr, "Symbol = '%s', location = %lld, record->rec_id = %llu\n", symbol->name, (long long)start, (unsigned long long)record->rec_id);
return -1;
} /* end if */
/* Close the dataset's dataspace */
if(H5Sclose(file_sid) < 0)
return -1;
/* Close dataset for symbol */
if(H5Dclose(dsid) < 0)
return -1;
return 0;
} /* end check_dataset() */
示例8: dump_table
/*-------------------------------------------------------------------------
* Function: dump_table
*
* Purpose: display the contents of tables for debugging purposes
*
* Return: void
*
* Programmer: Ruey-Hsia Li
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static void
dump_table(char* tablename, table_t *table)
{
unsigned u;
HDfprintf(rawoutstream,"%s: # of entries = %d\n", tablename,table->nobjs);
for (u = 0; u < table->nobjs; u++)
HDfprintf(rawoutstream,"%a %s %d %d\n", table->objs[u].objno,
table->objs[u].objname,
table->objs[u].displayed, table->objs[u].recorded);
}
示例9: error
/*
* Function: error
* Purpose: Display error message and exit.
* Programmer: Bill Wendling, 05. June 2002
* Modifications:
*/
static void
error(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
HDfprintf(stderr, "%s: error: ", prog);
HDvfprintf(stderr, fmt, ap);
HDfprintf(stderr, "\n");
va_end(ap);
HDexit(EXIT_FAILURE);
}
示例10: indentation
/*-------------------------------------------------------------------------
* Function: indentation
*
* Purpose: Print spaces for indentation
*
* Return: void
*
* Programmer: Ruey-Hsia Li
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
void
indentation(int x)
{
if (x < h5tools_nCols) {
while (x-- > 0)
HDfprintf(rawoutstream, " ");
}
else {
HDfprintf(rawerrorstream, "error: the indentation exceeds the number of cols.\n");
HDexit(1);
}
}
示例11: do_fopen
/*
* Function: do_fopen
* Purpose: Open the specified file.
* Return: SUCCESS or FAIL
* Programmer: Albert Cheng, Bill Wendling, 2001/12/13
* Modifications: Support for file drivers, Christian Chilan, April, 2008
*/
static herr_t
do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
{
int ret_code = SUCCESS;
switch (param->io_type) {
case POSIXIO:
if (flags & (SIO_CREATE | SIO_WRITE))
fd->posixfd = POSIXCREATE(fname);
else
fd->posixfd = POSIXOPEN(fname, O_RDONLY);
if (fd->posixfd < 0 ) {
HDfprintf(stderr, "POSIX File Open failed(%s)\n", fname);
GOTOERROR(FAIL);
}
break;
case HDF5:
fapl = set_vfd(param);
if (fapl < 0) {
fprintf(stderr, "HDF5 Property List Create failed\n");
GOTOERROR(FAIL);
}
/* create the parallel file */
if (flags & (SIO_CREATE | SIO_WRITE)) {
fd->h5fd = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
} else {
fd->h5fd = H5Fopen(fname, H5F_ACC_RDONLY, fapl);
}
if (fd->h5fd < 0) {
fprintf(stderr, "HDF5 File Create failed(%s)\n", fname);
GOTOERROR(FAIL);
}
break;
default:
/* unknown request */
HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)param->io_type);
GOTOERROR(FAIL);
break;
}
done:
return ret_code;
}
示例12: print_group_metadata
/*-------------------------------------------------------------------------
* Function: print_group_metadata
*
* Purpose: Prints file space information for groups' metadata
*
* Return: Success: 0
*
* Failure: Never fails
*
* Programmer: Vailin Choi; October 2009
*
*-------------------------------------------------------------------------
*/
static herr_t
print_group_metadata(const iter_t *iter)
{
printf("File space information for groups' metadata (in bytes):\n");
HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n",
iter->group_ohdr_info.total_size, iter->group_ohdr_info.free_size);
HDfprintf(stdout, "\tB-tree/List: %Hu\n", iter->groups_btree_storage_size);
HDfprintf(stdout, "\tHeap: %Hu\n", iter->groups_heap_storage_size);
return 0;
} /* print_group_metadata() */
示例13: H5HF_man_insert
/*-------------------------------------------------------------------------
* Function: H5HF_man_insert
*
* Purpose: Insert an object in a managed direct block
*
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* [email protected]
* Mar 13 2006
*
*-------------------------------------------------------------------------
*/
herr_t
H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, const void *obj,
void *_id)
{
H5HF_free_section_t *sec_node; /* Pointer to free space section */
H5HF_direct_t *dblock = NULL; /* Pointer to direct block to modify */
haddr_t dblock_addr = HADDR_UNDEF; /* Direct block address */
size_t dblock_size; /* Direct block size */
uint8_t *id = (uint8_t *)_id; /* Pointer to ID buffer */
size_t blk_off; /* Offset of object within block */
htri_t node_found; /* Whether an existing free list node was found */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_insert)
#ifdef QAK
HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size);
#endif /* QAK */
/*
* Check arguments.
*/
HDassert(hdr);
HDassert(obj_size > 0);
HDassert(obj);
HDassert(id);
/* Look for free space */
if((node_found = H5HF_space_find(hdr, dxpl_id, (hsize_t)obj_size, &sec_node)) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't locate free space in fractal heap")
#ifdef QAK
HDfprintf(stderr, "%s: After H5HF_space_find(), node_found = %t\n", FUNC, node_found);
#endif /* QAK */
/* If we didn't find a node, go create a direct block big enough to hold the requested block */
if(!node_found)
/* Allocate direct block big enough to hold requested size */
if(H5HF_man_dblock_new(hdr, dxpl_id, obj_size, &sec_node) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create fractal heap direct block")
/* Check for row section */
if(sec_node->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW ||
sec_node->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW) {
#ifdef QAK
HDfprintf(stderr, "%s: sec_node->sect_info.addr = %a\n", FUNC, sec_node->sect_info.addr);
HDfprintf(stderr, "%s: sec_node->sect_info.size = %Hu\n", FUNC, sec_node->sect_info.size);
HDfprintf(stderr, "%s: sec_node->sect_info.type = %s\n", FUNC, (sec_node->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW ? "H5HF_FSPACE_SECT_FIRST_ROW" : "H5HF_FSPACE_SECT_NORMAL_ROW"));
HDfprintf(stderr, "%s: sec_node->u.row.under = %p\n", FUNC, sec_node->u.row.under);
HDfprintf(stderr, "%s: sec_node->u.row.row = %u\n", FUNC, sec_node->u.row.row);
HDfprintf(stderr, "%s: sec_node->u.row.col = %u\n", FUNC, sec_node->u.row.col);
HDfprintf(stderr, "%s: sec_node->u.row.num_entries = %u\n", FUNC, sec_node->u.row.num_entries);
#endif /* QAK */
/* Allocate 'single' selection out of 'row' selection */
if(H5HF_man_iblock_alloc_row(hdr, dxpl_id, &sec_node) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't break up row section")
} /* end if */
示例14: print_dset_metadata
/*-------------------------------------------------------------------------
* Function: print_dataset_metadata
*
* Purpose: Prints file space information for datasets' metadata
*
* Return: Success: 0
*
* Failure: Never fails
*
* Programmer: Vailin Choi; October 2009
*
*-------------------------------------------------------------------------
*/
static herr_t
print_dset_metadata(const iter_t *iter)
{
printf("File space information for datasets' metadata (in bytes):\n");
HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n",
iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size);
HDfprintf(stdout, "\tIndex for Chunked datasets: %Hu\n",
iter->datasets_index_storage_size);
HDfprintf(stdout, "\tHeap: %Hu\n", iter->datasets_heap_storage_size);
return 0;
} /* print_dset_metadata() */
示例15: H5FS_close
/*-------------------------------------------------------------------------
* Function: H5FS_close
*
* Purpose: Destroy & deallocate free list structure, serializing sections
* in the bins
*
* Return: Success: non-negative
*
* Failure: negative
*
* Programmer: Quincey Koziol
* Tuesday, March 7, 2006
*
*-------------------------------------------------------------------------
*/
herr_t
H5FS_close(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, FAIL)
/* Check arguments. */
HDassert(f);
HDassert(fspace);
#ifdef H5FS_DEBUG
HDfprintf(stderr, "%s: Entering, fspace = %p, fspace->addr = %a, fspace->sinfo = %p\n", FUNC, fspace, fspace->addr, fspace->sinfo);
#endif /* H5FS_DEBUG */
/* Check if section info is valid */
/* (i.e. the header "owns" the section info and it's not in the cache) */
if(fspace->sinfo) {
#ifdef H5FS_DEBUG
HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu, fspace->serial_sect_count = %Hu, fspace->sect_addr = %a, fspace->rc = %u\n", FUNC, fspace->tot_sect_count, fspace->serial_sect_count, fspace->sect_addr, fspace->rc);
HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, fspace->alloc_sect_size, fspace->sect_size);
#endif /* H5FS_DEBUG */
/* If there are sections to serialize, update them */
/* (if the free space manager is persistant) */
if(fspace->serial_sect_count > 0 && H5F_addr_defined(fspace->addr)) {
#ifdef H5FS_DEBUG
HDfprintf(stderr, "%s: Real sections to store in file\n", FUNC);
#endif /* H5FS_DEBUG */
if(fspace->sinfo->dirty) {
/* Check if the section info is "floating" */
if(!H5F_addr_defined(fspace->sect_addr)) {
/* Sanity check */
HDassert(fspace->sect_size > 0);
/* Allocate space for the section info in file */
if(H5F_USE_TMP_SPACE(f)) {
if(HADDR_UNDEF == (fspace->sect_addr = H5MF_alloc_tmp(f, fspace->sect_size)))
HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for free space sections")
} /* end if */
else {
if(HADDR_UNDEF == (fspace->sect_addr = H5MF_alloc(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_size)))
HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for free space sections")
} /* end if */
fspace->alloc_sect_size = (size_t)fspace->sect_size;
/* Mark free space header as dirty */
if(H5AC_mark_entry_dirty(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
} /* end if */