-/* $OpenBSD: kern_tc.c,v 1.72 2021/04/30 13:52:48 bluhm Exp $ */
+/* $OpenBSD: kern_tc.c,v 1.73 2021/06/15 05:24:46 dlg Exp $ */
/*
* Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
} while (gen == 0 || gen != th->th_generation);
}
+void
+getbinuptime(struct bintime *bt)
+{
+ struct timehands *th;
+ u_int gen;
+
+ do {
+ th = timehands;
+ gen = th->th_generation;
+ membar_consumer();
+ *bt = th->th_offset;
+ membar_consumer();
+ } while (gen == 0 || gen != th->th_generation);
+}
+
void
nanouptime(struct timespec *tsp)
{
#endif
}
+uint64_t
+nsecuptime(void)
+{
+ struct bintime bt;
+ uint64_t nsec;
+
+ binuptime(&bt);
+
+ nsec = (1000000000ULL * (bt.frac >> 32)) >> 32;
+ nsec += bt.sec * 1000000000ULL;
+
+ return (nsec);
+}
+
+uint64_t
+getnsecuptime(void)
+{
+ struct bintime bt;
+ uint64_t nsec;
+
+ getbinuptime(&bt);
+
+ nsec = (1000000000ULL * (bt.frac >> 32)) >> 32;
+ nsec += bt.sec * 1000000000ULL;
+
+ return (nsec);
+}
+
void
binruntime(struct bintime *bt)
{
-/* $OpenBSD: subr_pool.c,v 1.233 2021/03/10 10:21:47 jsg Exp $ */
+/* $OpenBSD: subr_pool.c,v 1.234 2021/06/15 05:24:46 dlg Exp $ */
/* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */
/*-
#define POOL_WAIT_FREE SEC_TO_NSEC(1)
#define POOL_WAIT_GC SEC_TO_NSEC(8)
-/*
- * TODO Move getnsecuptime() to kern_tc.c and document it when we
- * have callers in other modules.
- */
-static uint64_t
-getnsecuptime(void)
-{
- struct timespec now;
-
- getnanouptime(&now);
- return TIMESPEC_TO_NSEC(&now);
-}
-
RBT_PROTOTYPE(phtree, pool_page_header, ph_node, phtree_compare);
static inline int
-/* $OpenBSD: vfs_sync.c,v 1.65 2021/01/14 03:32:01 cheloha Exp $ */
+/* $OpenBSD: vfs_sync.c,v 1.66 2021/06/15 05:24:47 dlg Exp $ */
/*
* Portions of this code are:
splx(s);
}
-/*
- * TODO Move getnsecuptime() to kern_tc.c and document it when we have
- * more users in the kernel.
- */
-static uint64_t
-getnsecuptime(void)
-{
- struct timespec now;
-
- getnanouptime(&now);
- return TIMESPEC_TO_NSEC(&now);
-}
-
/*
* System filesystem synchronizer daemon.
*/
-/* $OpenBSD: bpf.c,v 1.204 2021/04/23 03:43:19 dlg Exp $ */
+/* $OpenBSD: bpf.c,v 1.205 2021/06/15 05:24:47 dlg Exp $ */
/* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */
/*
(d)->bd_slen = 0; \
(d)->bd_fbuf = NULL;
-/*
- * TODO Move nsecuptime() into kern_tc.c and document it when we have
- * more users elsewhere in the kernel.
- */
-static uint64_t
-nsecuptime(void)
-{
- struct timespec now;
-
- nanouptime(&now);
- return TIMESPEC_TO_NSEC(&now);
-}
-
/*
* bpfread - read next chunk of packets from buffers
*/
-/* $OpenBSD: time.h,v 1.59 2021/06/11 16:36:34 cheloha Exp $ */
+/* $OpenBSD: time.h,v 1.60 2021/06/15 05:24:47 dlg Exp $ */
/* $NetBSD: time.h,v 1.18 1996/04/23 10:29:33 mycroft Exp $ */
/*
void nanouptime(struct timespec *);
void microuptime(struct timeval *);
+void getbinuptime(struct bintime *);
void getnanouptime(struct timespec *);
void getmicrouptime(struct timeval *);
time_t gettime(void);
time_t getuptime(void);
+uint64_t nsecuptime(void);
+uint64_t getnsecuptime(void);
+
struct proc;
int clock_gettime(struct proc *, clockid_t, struct timespec *);