diff options
Diffstat (limited to 'src/H5FDlog.c')
-rw-r--r-- | src/H5FDlog.c | 229 |
1 files changed, 117 insertions, 112 deletions
diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 38ea346..7214b75 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -429,7 +429,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() */ @@ -487,8 +487,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 */ @@ -505,6 +505,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) @@ -521,10 +525,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) { @@ -534,17 +536,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) @@ -597,15 +597,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) @@ -619,14 +619,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) @@ -648,7 +648,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; @@ -659,7 +659,7 @@ done: HDclose(fd); if (file) file = H5FL_FREE(H5FD_log_t, file); - } /* end if */ + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__log_open() */ @@ -680,20 +680,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) @@ -714,7 +715,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) @@ -749,13 +750,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) { @@ -770,13 +771,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) { @@ -791,12 +792,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) @@ -923,7 +924,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() */ @@ -962,13 +963,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; @@ -1001,13 +1002,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() */ @@ -1068,14 +1069,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)) { @@ -1086,15 +1087,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; @@ -1177,23 +1178,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) @@ -1210,17 +1210,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") @@ -1237,7 +1242,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) { @@ -1251,15 +1256,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, @@ -1304,13 +1307,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); @@ -1318,8 +1321,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) @@ -1333,7 +1335,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) { @@ -1347,7 +1349,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 @@ -1357,7 +1359,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; @@ -1368,7 +1370,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() */ @@ -1391,17 +1393,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 @@ -1409,13 +1407,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)) @@ -1433,16 +1434,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") @@ -1459,7 +1465,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) { @@ -1473,15 +1479,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 @@ -1548,7 +1552,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) { @@ -1561,8 +1565,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 @@ -1572,7 +1576,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; @@ -1585,7 +1589,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() */ @@ -1615,14 +1619,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 { @@ -1646,7 +1651,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") @@ -1669,7 +1674,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) { @@ -1683,7 +1688,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; |