xref: /freebsd/contrib/jemalloc/include/jemalloc/internal/nstime.h (revision 15c433351f54e7cd5bec8d36c8e89e6a7fa55b26)
1 /******************************************************************************/
2 #ifdef JEMALLOC_H_TYPES
3 
4 #define JEMALLOC_CLOCK_GETTIME defined(_POSIX_MONOTONIC_CLOCK) \
5     && _POSIX_MONOTONIC_CLOCK >= 0
6 
7 typedef struct nstime_s nstime_t;
8 
9 /* Maximum supported number of seconds (~584 years). */
10 #define	NSTIME_SEC_MAX	KQU(18446744072)
11 
12 #endif /* JEMALLOC_H_TYPES */
13 /******************************************************************************/
14 #ifdef JEMALLOC_H_STRUCTS
15 
16 struct nstime_s {
17 	uint64_t	ns;
18 };
19 
20 #endif /* JEMALLOC_H_STRUCTS */
21 /******************************************************************************/
22 #ifdef JEMALLOC_H_EXTERNS
23 
24 void	nstime_init(nstime_t *time, uint64_t ns);
25 void	nstime_init2(nstime_t *time, uint64_t sec, uint64_t nsec);
26 uint64_t	nstime_ns(const nstime_t *time);
27 uint64_t	nstime_sec(const nstime_t *time);
28 uint64_t	nstime_nsec(const nstime_t *time);
29 void	nstime_copy(nstime_t *time, const nstime_t *source);
30 int	nstime_compare(const nstime_t *a, const nstime_t *b);
31 void	nstime_add(nstime_t *time, const nstime_t *addend);
32 void	nstime_subtract(nstime_t *time, const nstime_t *subtrahend);
33 void	nstime_imultiply(nstime_t *time, uint64_t multiplier);
34 void	nstime_idivide(nstime_t *time, uint64_t divisor);
35 uint64_t	nstime_divide(const nstime_t *time, const nstime_t *divisor);
36 #ifdef JEMALLOC_JET
37 typedef bool (nstime_update_t)(nstime_t *);
38 extern nstime_update_t *nstime_update;
39 #else
40 bool	nstime_update(nstime_t *time);
41 #endif
42 
43 #endif /* JEMALLOC_H_EXTERNS */
44 /******************************************************************************/
45 #ifdef JEMALLOC_H_INLINES
46 
47 #endif /* JEMALLOC_H_INLINES */
48 /******************************************************************************/
49