summaryrefslogtreecommitdiffstats
path: root/src/H5FDlog.c
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-03-31 20:31:20 (GMT)
committerGitHub <noreply@github.com>2021-03-31 20:31:20 (GMT)
commit0f0721f2d616ac9edd7cea642baa176c87713757 (patch)
tree7dc2ae7cc63c819a51d9cea59f09f9800610cdb2 /src/H5FDlog.c
parent6dae5c2cb565fce010db28a5bcfc0220edb98921 (diff)
downloadhdf5-0f0721f2d616ac9edd7cea642baa176c87713757.zip
hdf5-0f0721f2d616ac9edd7cea642baa176c87713757.tar.gz
hdf5-0f0721f2d616ac9edd7cea642baa176c87713757.tar.bz2
Minor warning fixes in develop (#526)
* Committing clang-format changes * Minor warning fixes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/H5FDlog.c')
-rw-r--r--src/H5FDlog.c229
1 files changed, 117 insertions, 112 deletions
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index aa2d6db..b836a3d 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -426,7 +426,7 @@ done:
if (new_fa->logfile)
new_fa->logfile = (char *)H5MM_xfree(new_fa->logfile);
H5MM_free(new_fa);
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__log_fapl_copy() */
@@ -484,8 +484,8 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
#ifdef H5_HAVE_WIN32_API
struct _BY_HANDLE_FILE_INFORMATION fileinfo;
#endif
- H5_timer_t open_timer = {{0}, {0}, {0}, FALSE}; /* Timer for open() call */
- H5_timer_t stat_timer = {{0}, {0}, {0}, FALSE}; /* Timer for stat() call */
+ H5_timer_t open_timer; /* Timer for open() call */
+ H5_timer_t stat_timer; /* Timer for stat() call */
h5_stat_t sb;
H5FD_t * ret_value = NULL; /* Return value */
@@ -502,6 +502,10 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
if (ADDR_OVERFLOW(maxaddr))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr")
+ /* Initialize timers */
+ H5_timer_init(&open_timer);
+ H5_timer_init(&stat_timer);
+
/* Build the open flags */
o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY;
if (H5F_ACC_TRUNC & flags)
@@ -518,10 +522,8 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info")
/* Start timer for open() call */
- if (fa->flags & H5FD_LOG_TIME_OPEN) {
- H5_timer_init(&open_timer);
+ if (fa->flags & H5FD_LOG_TIME_OPEN)
H5_timer_start(&open_timer);
- } /* end if */
/* Open the file */
if ((fd = HDopen(name, o_flags, H5_POSIX_CREATE_MODE_RW)) < 0) {
@@ -531,17 +533,15 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
H5E_FILE, H5E_CANTOPENFILE, NULL,
"unable to open file: name = '%s', errno = %d, error message = '%s', flags = %x, o_flags = %x",
name, myerrno, HDstrerror(myerrno), flags, (unsigned)o_flags);
- } /* end if */
+ }
/* Stop timer for open() call */
if (fa->flags & H5FD_LOG_TIME_OPEN)
H5_timer_stop(&open_timer);
/* Start timer for stat() call */
- if (fa->flags & H5FD_LOG_TIME_STAT) {
- H5_timer_init(&stat_timer);
+ if (fa->flags & H5FD_LOG_TIME_STAT)
H5_timer_start(&stat_timer);
- } /* end if */
/* Get the file stats */
if (HDfstat(fd, &sb) < 0)
@@ -594,15 +594,15 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
if (file->fa.flags & H5FD_LOG_FILE_READ) {
file->nread = (unsigned char *)H5MM_calloc(file->iosize);
HDassert(file->nread);
- } /* end if */
+ }
if (file->fa.flags & H5FD_LOG_FILE_WRITE) {
file->nwrite = (unsigned char *)H5MM_calloc(file->iosize);
HDassert(file->nwrite);
- } /* end if */
+ }
if (file->fa.flags & H5FD_LOG_FLAVOR) {
file->flavor = (unsigned char *)H5MM_calloc(file->iosize);
HDassert(file->flavor);
- } /* end if */
+ }
/* Set the log file pointer */
if (fa->logfile)
@@ -616,14 +616,14 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
H5_timer_get_times(open_timer, &open_times);
HDfprintf(file->logfp, "Open took: (%f s)\n", open_times.elapsed);
- } /* end if */
+ }
if (file->fa.flags & H5FD_LOG_TIME_STAT) {
H5_timevals_t stat_times; /* Elapsed time for stat() call */
H5_timer_get_times(stat_timer, &stat_times);
HDfprintf(file->logfp, "Stat took: (%f s)\n", stat_times.elapsed);
- } /* end if */
- } /* end if */
+ }
+ }
/* Check the file locking flags in the fapl */
if (ignore_disabled_file_locks_s != FAIL)
@@ -645,7 +645,7 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
if (H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME) > 0)
if (H5P_get(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME, &file->fam_to_single) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to single")
- } /* end if */
+ }
/* Set return value */
ret_value = (H5FD_t *)file;
@@ -656,7 +656,7 @@ done:
HDclose(fd);
if (file)
file = H5FL_FREE(H5FD_log_t, file);
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__log_open() */
@@ -677,20 +677,21 @@ done:
static herr_t
H5FD__log_close(H5FD_t *_file)
{
- H5FD_log_t *file = (H5FD_log_t *)_file;
- H5_timer_t close_timer = {{0}, {0}, {0}, FALSE}; /* Timer for close() call */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5FD_log_t *file = (H5FD_log_t *)_file;
+ H5_timer_t close_timer; /* Timer for close() call */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
HDassert(file);
+ /* Initialize timer */
+ H5_timer_init(&close_timer);
+
/* Start timer for close() call */
- if (file->fa.flags & H5FD_LOG_TIME_CLOSE) {
- H5_timer_init(&close_timer);
+ if (file->fa.flags & H5FD_LOG_TIME_CLOSE)
H5_timer_start(&close_timer);
- } /* end if */
/* Close the underlying file */
if (HDclose(file->fd) < 0)
@@ -711,7 +712,7 @@ H5FD__log_close(H5FD_t *_file)
H5_timer_get_times(close_timer, &close_times);
HDfprintf(file->logfp, "Close took: (%f s)\n", close_times.elapsed);
- } /* end if */
+ }
/* Dump the total number of seek/read/write operations */
if (file->fa.flags & H5FD_LOG_NUM_READ)
@@ -746,13 +747,13 @@ H5FD__log_close(H5FD_t *_file)
last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val);
last_val = file->nwrite[addr];
last_addr = addr;
- } /* end if */
+ }
addr++;
- } /* end while */
+ }
HDfprintf(file->logfp,
"\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) written to %3d times\n",
last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val);
- } /* end if */
+ }
/* Dump the read I/O information */
if (file->fa.flags & H5FD_LOG_FILE_READ) {
@@ -767,13 +768,13 @@ H5FD__log_close(H5FD_t *_file)
last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val);
last_val = file->nread[addr];
last_addr = addr;
- } /* end if */
+ }
addr++;
- } /* end while */
+ }
HDfprintf(file->logfp,
"\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) read from %3d times\n",
last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val);
- } /* end if */
+ }
/* Dump the I/O flavor information */
if (file->fa.flags & H5FD_LOG_FLAVOR) {
@@ -788,12 +789,12 @@ H5FD__log_close(H5FD_t *_file)
last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]);
last_val = file->flavor[addr];
last_addr = addr;
- } /* end if */
+ }
addr++;
- } /* end while */
+ }
HDfprintf(file->logfp, "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) flavor is %s\n",
last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]);
- } /* end if */
+ }
/* Free the logging information */
if (file->fa.flags & H5FD_LOG_FILE_WRITE)
@@ -920,7 +921,7 @@ H5FD__log_query(const H5FD_t *_file, unsigned long *flags /* out */)
if (file && file->fam_to_single)
*flags |= H5FD_FEAT_IGNORE_DRVRINFO; /* Ignore the driver info when file is opened (which
eliminates it) */
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FD__log_query() */
@@ -959,13 +960,13 @@ H5FD__log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hs
HDassert(addr < file->iosize);
H5_CHECK_OVERFLOW(size, hsize_t, size_t);
HDmemset(&file->flavor[addr], (int)type, (size_t)size);
- } /* end if */
+ }
if (file->fa.flags & H5FD_LOG_ALLOC)
HDfprintf(file->logfp,
"%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Allocated\n", addr,
(haddr_t)((addr + size) - 1), size, flavors[type]);
- } /* end if */
+ }
/* Set return value */
ret_value = addr;
@@ -998,13 +999,13 @@ H5FD__log_free(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
HDassert(addr < file->iosize);
H5_CHECK_OVERFLOW(size, hsize_t, size_t);
HDmemset(&file->flavor[addr], H5FD_MEM_DEFAULT, (size_t)size);
- } /* end if */
+ }
/* Log the file memory freed */
if (file->fa.flags & H5FD_LOG_FREE)
HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Freed\n",
addr, (haddr_t)((addr + size) - 1), size, flavors[type]);
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FD__log_free() */
@@ -1065,14 +1066,14 @@ H5FD__log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr)
HDassert(addr < file->iosize);
H5_CHECK_OVERFLOW(size, hsize_t, size_t);
HDmemset(&file->flavor[file->eoa], (int)type, (size_t)size);
- } /* end if */
+ }
/* Log the extension like an allocation */
if (file->fa.flags & H5FD_LOG_ALLOC)
HDfprintf(file->logfp,
"%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Allocated\n",
file->eoa, addr, size, flavors[type]);
- } /* end if */
+ }
/* Check for decreasing file size */
if (H5F_addr_lt(addr, file->eoa) && H5F_addr_gt(addr, 0)) {
@@ -1083,15 +1084,15 @@ H5FD__log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr)
HDassert((addr + size) < file->iosize);
H5_CHECK_OVERFLOW(size, hsize_t, size_t);
HDmemset(&file->flavor[addr], H5FD_MEM_DEFAULT, (size_t)size);
- } /* end if */
+ }
/* Log the shrink like a free */
if (file->fa.flags & H5FD_LOG_FREE)
HDfprintf(file->logfp,
"%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Freed\n",
file->eoa, addr, size, flavors[type]);
- } /* end if */
- } /* end if */
+ }
+ }
file->eoa = addr;
@@ -1174,23 +1175,22 @@ static herr_t
H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size,
void *buf /*out*/)
{
- H5FD_log_t * file = (H5FD_log_t *)_file;
- size_t orig_size = size; /* Save the original size for later */
- haddr_t orig_addr = addr;
- H5_timer_t read_timer = {{0}, {0}, {0}, FALSE}; /* Timer for read operation */
- H5_timevals_t read_times; /* Elapsed time for read operation */
-#ifndef H5_HAVE_PREADWRITE
- H5_timer_t seek_timer; /* Timer for seek operation */
- H5_timevals_t seek_times; /* Elapsed time for seek operation */
-#endif /* H5_HAVE_PREADWRITE */
- HDoff_t offset = (HDoff_t)addr;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5FD_log_t * file = (H5FD_log_t *)_file;
+ size_t orig_size = size; /* Save the original size for later */
+ haddr_t orig_addr = addr;
+ H5_timer_t read_timer; /* Timer for read operation */
+ H5_timevals_t read_times; /* Elapsed time for read operation */
+ HDoff_t offset = (HDoff_t)addr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
HDassert(file && file->pub.cls);
HDassert(buf);
+ /* Initialize timer */
+ H5_timer_init(&read_timer);
+
/* Check for overflow conditions */
if (!H5F_addr_defined(addr))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr)
@@ -1207,17 +1207,22 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
HDassert((addr + size) < file->iosize);
while (tmp_size-- > 0)
file->nread[tmp_addr++]++;
- } /* end if */
- } /* end if */
+ }
+ }
#ifndef H5_HAVE_PREADWRITE
/* Seek to the correct location (if we don't have pread) */
if (addr != file->pos || OP_READ != file->op) {
+
+ H5_timer_t seek_timer; /* Timer for seek operation */
+ H5_timevals_t seek_times; /* Elapsed time for seek operation */
+
+ /* Initialize timer */
+ H5_timer_init(&seek_timer);
+
/* Start timer for seek() call */
- if (file->fa.flags & H5FD_LOG_TIME_SEEK) {
- H5_timer_init(&seek_timer);
+ if (file->fa.flags & H5FD_LOG_TIME_SEEK)
H5_timer_start(&seek_timer);
- } /* end if */
if (HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
@@ -1234,7 +1239,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
if (file->fa.flags & H5FD_LOG_TIME_SEEK) {
H5_timer_get_times(seek_timer, &seek_times);
file->total_seek_time += seek_times.elapsed;
- } /* end if */
+ }
/* Emit log string if we're tracking individual seek events. */
if (file->fa.flags & H5FD_LOG_LOC_SEEK) {
@@ -1248,15 +1253,13 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
HDfprintf(file->logfp, " (%fs @ %f)\n", seek_times.elapsed, seek_timer.initial.elapsed);
else
HDfprintf(file->logfp, "\n");
- } /* end if */
- } /* end if */
-#endif /* H5_HAVE_PREADWRITE */
+ }
+ }
+#endif /* H5_HAVE_PREADWRITE */
/* Start timer for read operation */
- if (file->fa.flags & H5FD_LOG_TIME_READ) {
- H5_timer_init(&read_timer);
+ if (file->fa.flags & H5FD_LOG_TIME_READ)
H5_timer_start(&read_timer);
- } /* end if */
/*
* Read data, being careful of interrupted system calls, partial results,
@@ -1301,13 +1304,13 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf,
(unsigned long long)size, (unsigned long long)bytes_in,
(unsigned long long)bytes_read, (unsigned long long)offset);
- } /* end if */
+ }
if (0 == bytes_read) {
- /* end of file but not end of format address space */
+ /* End of file but not end of format address space */
HDmemset(buf, 0, size);
break;
- } /* end if */
+ }
HDassert(bytes_read >= 0);
HDassert((size_t)bytes_read <= size);
@@ -1315,8 +1318,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
size -= (size_t)bytes_read;
addr += (haddr_t)bytes_read;
buf = (char *)buf + bytes_read;
-
- } /* end while */
+ }
/* Stop timer for read operation */
if (file->fa.flags & H5FD_LOG_TIME_READ)
@@ -1330,7 +1332,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
if (file->fa.flags & H5FD_LOG_TIME_READ) {
H5_timer_get_times(read_timer, &read_times);
file->total_read_time += read_times.elapsed;
- } /* end if */
+ }
/* Log information about the read */
if (file->fa.flags & H5FD_LOG_LOC_READ) {
@@ -1344,7 +1346,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
HDassert(type == H5FD_MEM_DEFAULT ||
type == (H5FD_mem_t)file->flavor[(orig_addr + orig_size) - 1] ||
(H5FD_mem_t)file->flavor[(orig_addr + orig_size) - 1] == H5FD_MEM_DEFAULT);
- } /* end if */
+ }
/* Add the read time, if we're tracking that.
* Note that the read time is NOT emitted for when just H5FD_LOG_TIME_READ
@@ -1354,7 +1356,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
HDfprintf(file->logfp, " (%fs @ %f)\n", read_times.elapsed, read_timer.initial.elapsed);
else
HDfprintf(file->logfp, "\n");
- } /* end if */
+ }
/* Update current position */
file->pos = addr;
@@ -1365,7 +1367,7 @@ done:
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__log_read() */
@@ -1388,17 +1390,13 @@ static herr_t
H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size,
const void *buf)
{
- H5FD_log_t * file = (H5FD_log_t *)_file;
- size_t orig_size = size; /* Save the original size for later */
- haddr_t orig_addr = addr;
- H5_timer_t write_timer = {{0}, {0}, {0}, FALSE}; /* Timer for write operation */
- H5_timevals_t write_times; /* Elapsed time for write operation */
-#ifndef H5_HAVE_PREADWRITE
- H5_timer_t seek_timer; /* Timer for seek operation */
- H5_timevals_t seek_times; /* Elapsed time for seek operation */
-#endif /* H5_HAVE_PREADWRITE */
- HDoff_t offset = (HDoff_t)addr;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5FD_log_t * file = (H5FD_log_t *)_file;
+ size_t orig_size = size; /* Save the original size for later */
+ haddr_t orig_addr = addr;
+ H5_timer_t write_timer; /* Timer for write operation */
+ H5_timevals_t write_times; /* Elapsed time for write operation */
+ HDoff_t offset = (HDoff_t)addr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1406,13 +1404,16 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
HDassert(size > 0);
HDassert(buf);
+ /* Initialize timer */
+ H5_timer_init(&write_timer);
+
/* Verify that we are writing out the type of data we allocated in this location */
if (file->flavor) {
HDassert(type == H5FD_MEM_DEFAULT || type == (H5FD_mem_t)file->flavor[addr] ||
(H5FD_mem_t)file->flavor[addr] == H5FD_MEM_DEFAULT);
HDassert(type == H5FD_MEM_DEFAULT || type == (H5FD_mem_t)file->flavor[(addr + size) - 1] ||
(H5FD_mem_t)file->flavor[(addr + size) - 1] == H5FD_MEM_DEFAULT);
- } /* end if */
+ }
/* Check for overflow conditions */
if (!H5F_addr_defined(addr))
@@ -1430,16 +1431,21 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
HDassert((addr + size) < file->iosize);
while (tmp_size-- > 0)
file->nwrite[tmp_addr++]++;
- } /* end if */
+ }
#ifndef H5_HAVE_PREADWRITE
/* Seek to the correct location (if we don't have pwrite) */
if (addr != file->pos || OP_WRITE != file->op) {
+
+ H5_timer_t seek_timer; /* Timer for seek operation */
+ H5_timevals_t seek_times; /* Elapsed time for seek operation */
+
+ /* Initialize timer */
+ H5_timer_init(&seek_timer);
+
/* Start timer for seek() call */
- if (file->fa.flags & H5FD_LOG_TIME_SEEK) {
- H5_timer_init(&seek_timer);
+ if (file->fa.flags & H5FD_LOG_TIME_SEEK)
H5_timer_start(&seek_timer);
- } /* end if */
if (HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
@@ -1456,7 +1462,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
if (file->fa.flags & H5FD_LOG_TIME_SEEK) {
H5_timer_get_times(seek_timer, &seek_times);
file->total_seek_time += seek_times.elapsed;
- } /* end if */
+ }
/* Emit log string if we're tracking individual seek events. */
if (file->fa.flags & H5FD_LOG_LOC_SEEK) {
@@ -1470,15 +1476,13 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
HDfprintf(file->logfp, " (%fs @ %f)\n", seek_times.elapsed, seek_timer.initial.elapsed);
else
HDfprintf(file->logfp, "\n");
- } /* end if */
- } /* end if */
-#endif /* H5_HAVE_PREADWRITE */
+ }
+ }
+#endif /* H5_HAVE_PREADWRITE */
/* Start timer for write operation */
- if (file->fa.flags & H5FD_LOG_TIME_WRITE) {
- H5_timer_init(&write_timer);
+ if (file->fa.flags & H5FD_LOG_TIME_WRITE)
H5_timer_start(&write_timer);
- } /* end if */
/*
* Write the data, being careful of interrupted system calls and partial
@@ -1545,7 +1549,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
if (file->fa.flags & H5FD_LOG_TIME_WRITE) {
H5_timer_get_times(write_timer, &write_times);
file->total_write_time += write_times.elapsed;
- } /* end if */
+ }
/* Log information about the write */
if (file->fa.flags & H5FD_LOG_LOC_WRITE) {
@@ -1558,8 +1562,8 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
if ((H5FD_mem_t)file->flavor[orig_addr] == H5FD_MEM_DEFAULT) {
HDmemset(&file->flavor[orig_addr], (int)type, orig_size);
HDfprintf(file->logfp, " (fresh)");
- } /* end if */
- } /* end if */
+ }
+ }
/* Add the write time, if we're tracking that.
* Note that the write time is NOT emitted for when just H5FD_LOG_TIME_WRITE
@@ -1569,7 +1573,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
HDfprintf(file->logfp, " (%fs @ %f)\n", write_times.elapsed, write_timer.initial.elapsed);
else
HDfprintf(file->logfp, "\n");
- } /* end if */
+ }
/* Update current position and eof */
file->pos = addr;
@@ -1582,7 +1586,7 @@ done:
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__log_write() */
@@ -1612,14 +1616,15 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_
/* Extend the file to make sure it's large enough */
if (!H5F_addr_eq(file->eoa, file->eof)) {
- H5_timer_t trunc_timer = {{0}, {0}, {0}, FALSE}; /* Timer for truncate operation */
- H5_timevals_t trunc_times; /* Elapsed time for truncate operation */
+ H5_timer_t trunc_timer; /* Timer for truncate operation */
+ H5_timevals_t trunc_times; /* Elapsed time for truncate operation */
+
+ /* Initialize timer */
+ H5_timer_init(&trunc_timer);
/* Start timer for truncate operation */
- if (file->fa.flags & H5FD_LOG_TIME_TRUNCATE) {
- H5_timer_init(&trunc_timer);
+ if (file->fa.flags & H5FD_LOG_TIME_TRUNCATE)
H5_timer_start(&trunc_timer);
- } /* end if */
#ifdef H5_HAVE_WIN32_API
{
@@ -1643,7 +1648,7 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_
dwError = GetLastError();
if (dwError != NO_ERROR)
HGOTO_ERROR(H5E_FILE, H5E_FILEOPEN, FAIL, "unable to set file pointer")
- } /* end if */
+ }
if (0 == SetEndOfFile(file->hFile))
HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
@@ -1666,7 +1671,7 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_
if (file->fa.flags & H5FD_LOG_TIME_TRUNCATE) {
H5_timer_get_times(trunc_timer, &trunc_times);
file->total_truncate_time += trunc_times.elapsed;
- } /* end if */
+ }
/* Emit log string if we're tracking individual truncate events. */
if (file->fa.flags & H5FD_LOG_TRUNCATE) {
@@ -1680,7 +1685,7 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_
HDfprintf(file->logfp, " (%fs @ %f)\n", trunc_times.elapsed, trunc_timer.initial.elapsed);
else
HDfprintf(file->logfp, "\n");
- } /* end if */
+ }
/* Update the eof value */
file->eof = file->eoa;