summaryrefslogtreecommitdiffstats
path: root/src/H5private.h
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@lbl.gov>2020-07-02 15:36:44 (GMT)
committerQuincey Koziol <koziol@lbl.gov>2020-07-02 15:36:44 (GMT)
commitd05b58b5d4806d694f16d0fc698c5e1c057a411b (patch)
tree1931c3ebb10d98d90b694adb1588945d9519c394 /src/H5private.h
parent7cbb5fe2d177e49417401e1dc0b2a4c9d618cc67 (diff)
parent7371c83f9777b34b31909e99e052398b93c31bed (diff)
downloadhdf5-d05b58b5d4806d694f16d0fc698c5e1c057a411b.zip
hdf5-d05b58b5d4806d694f16d0fc698c5e1c057a411b.tar.gz
hdf5-d05b58b5d4806d694f16d0fc698c5e1c057a411b.tar.bz2
Merge pull request #2668 in HDFFV/hdf5 from monotonic_timer to develop
* commit '7371c83f9777b34b31909e99e052398b93c31bed': Remove non-existent example Add new source files to CMake build Clean up warnings va_arg -> HDva_arg Refactor code to remove remaining checks for H5_HAVE_GETTIMEOFDAY scattered around in various places. Also clean up iopipe.c. Correct mistake in H5_now_usec calculation for clock_gettime. Remove detection for mach/mach/time.h, since we're no longer using the time routines from that header. Update H5_now_usec to prefer using clock_gettime. Changes to make timers within the library monotonic.
Diffstat (limited to 'src/H5private.h')
-rw-r--r--src/H5private.h37
1 files changed, 28 insertions, 9 deletions
diff --git a/src/H5private.h b/src/H5private.h
index dc7ca57..836d7d5 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -614,21 +614,37 @@
#define LOCK_UN 0x08
#endif /* H5_HAVE_FLOCK */
-/*
- * Data types and functions for timing certain parts of the library.
+/* Typedefs and functions for timing certain parts of the library. */
+
+/* A set of elapsed/user/system times emitted as a time point by the
+ * platform-independent timers.
*/
typedef struct {
- double utime; /*user time */
- double stime; /*system time */
- double etime; /*elapsed wall-clock time */
+ double user; /* User time in seconds */
+ double system; /* System time in seconds */
+ double elapsed; /* Elapsed (wall clock) time in seconds */
+} H5_timevals_t;
+
+/* Timer structure for platform-independent timers */
+typedef struct {
+ H5_timevals_t initial; /* Current interval start time */
+ H5_timevals_t final_interval; /* Last interval elapsed time */
+ H5_timevals_t total; /* Total elapsed time for all intervals */
+ hbool_t is_running; /* Whether timer is running */
} H5_timer_t;
-H5_DLL void H5_timer_reset (H5_timer_t *timer);
-H5_DLL void H5_timer_begin (H5_timer_t *timer);
-H5_DLL void H5_timer_end (H5_timer_t *sum/*in,out*/,
- H5_timer_t *timer/*in,out*/);
+/* Returns library bandwidth as a pretty string */
H5_DLL void H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds);
+
+/* Timer functionality */
H5_DLL time_t H5_now(void);
+H5_DLL uint64_t H5_now_usec(void);
+H5_DLL herr_t H5_timer_init(H5_timer_t *timer /*in,out*/);
+H5_DLL herr_t H5_timer_start(H5_timer_t *timer /*in,out*/);
+H5_DLL herr_t H5_timer_stop(H5_timer_t *timer /*in,out*/);
+H5_DLL herr_t H5_timer_get_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/);
+H5_DLL herr_t H5_timer_get_total_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/);
+H5_DLL char *H5_timer_get_time_string(double seconds);
/* Depth of object copy */
typedef enum {
@@ -750,6 +766,9 @@ typedef struct {
#ifndef HDclock
#define HDclock() clock()
#endif /* HDclock */
+#ifndef HDclock_gettime
+ #define HDclock_gettime(CID, TS) clock_gettime(CID, TS)
+#endif /* HDclock_gettime */
#ifndef HDclose
#define HDclose(F) close(F)
#endif /* HDclose */