1 #ifndef JEMALLOC_INTERNAL_NSTIME_H 2 #define JEMALLOC_INTERNAL_NSTIME_H 3 4 /* Maximum supported number of seconds (~584 years). */ 5 #define NSTIME_SEC_MAX KQU(18446744072) 6 #define NSTIME_ZERO_INITIALIZER {0} 7 8 typedef struct { 9 uint64_t ns; 10 } nstime_t; 11 12 void nstime_init(nstime_t *time, uint64_t ns); 13 void nstime_init2(nstime_t *time, uint64_t sec, uint64_t nsec); 14 uint64_t nstime_ns(const nstime_t *time); 15 uint64_t nstime_sec(const nstime_t *time); 16 uint64_t nstime_msec(const nstime_t *time); 17 uint64_t nstime_nsec(const nstime_t *time); 18 void nstime_copy(nstime_t *time, const nstime_t *source); 19 int nstime_compare(const nstime_t *a, const nstime_t *b); 20 void nstime_add(nstime_t *time, const nstime_t *addend); 21 void nstime_iadd(nstime_t *time, uint64_t addend); 22 void nstime_subtract(nstime_t *time, const nstime_t *subtrahend); 23 void nstime_isubtract(nstime_t *time, uint64_t subtrahend); 24 void nstime_imultiply(nstime_t *time, uint64_t multiplier); 25 void nstime_idivide(nstime_t *time, uint64_t divisor); 26 uint64_t nstime_divide(const nstime_t *time, const nstime_t *divisor); 27 28 typedef bool (nstime_monotonic_t)(void); 29 extern nstime_monotonic_t *JET_MUTABLE nstime_monotonic; 30 31 typedef bool (nstime_update_t)(nstime_t *); 32 extern nstime_update_t *JET_MUTABLE nstime_update; 33 34 #endif /* JEMALLOC_INTERNAL_NSTIME_H */ 35