kern_tc.c (ce9fac00720e05d0856393e8b19796e5bb8249d6) kern_tc.c (4394f4767dbc3cf49b4dababb4bfafbbd588edf4)
1/*-
2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
8 *

--- 82 unchanged lines hidden (view full) ---

91 static u_int foo; \
92 SYSCTL_UINT(_kern_timecounter, OID_AUTO, foo, CTLFLAG_RD, &foo, 0, "");\
93 struct __hack
94
95TC_STATS(nbinuptime); TC_STATS(nnanouptime); TC_STATS(nmicrouptime);
96TC_STATS(nbintime); TC_STATS(nnanotime); TC_STATS(nmicrotime);
97TC_STATS(ngetbinuptime); TC_STATS(ngetnanouptime); TC_STATS(ngetmicrouptime);
98TC_STATS(ngetbintime); TC_STATS(ngetnanotime); TC_STATS(ngetmicrotime);
1/*-
2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
8 *

--- 82 unchanged lines hidden (view full) ---

91 static u_int foo; \
92 SYSCTL_UINT(_kern_timecounter, OID_AUTO, foo, CTLFLAG_RD, &foo, 0, "");\
93 struct __hack
94
95TC_STATS(nbinuptime); TC_STATS(nnanouptime); TC_STATS(nmicrouptime);
96TC_STATS(nbintime); TC_STATS(nnanotime); TC_STATS(nmicrotime);
97TC_STATS(ngetbinuptime); TC_STATS(ngetnanouptime); TC_STATS(ngetmicrouptime);
98TC_STATS(ngetbintime); TC_STATS(ngetnanotime); TC_STATS(ngetmicrotime);
99TC_STATS(nsetclock);
99
100#undef TC_STATS
101
102static void tc_windup(void);
103
104/*
105 * Return the difference between the timehands' counter value now and what
106 * was when we copied it to the timehands' offset_count.

--- 202 unchanged lines hidden (view full) ---

309 * Step our concept of GMT. This is done by modifying our estimate of
310 * when we booted. XXX: needs futher work.
311 */
312void
313tc_setclock(struct timespec *ts)
314{
315 struct timespec ts2;
316
100
101#undef TC_STATS
102
103static void tc_windup(void);
104
105/*
106 * Return the difference between the timehands' counter value now and what
107 * was when we copied it to the timehands' offset_count.

--- 202 unchanged lines hidden (view full) ---

310 * Step our concept of GMT. This is done by modifying our estimate of
311 * when we booted. XXX: needs futher work.
312 */
313void
314tc_setclock(struct timespec *ts)
315{
316 struct timespec ts2;
317
318 nsetclock++;
317 nanouptime(&ts2);
318 boottime.tv_sec = ts->tv_sec - ts2.tv_sec;
319 /* XXX boottime should probably be a timespec. */
320 boottime.tv_usec = (ts->tv_nsec - ts2.tv_nsec) / 1000;
321 if (boottime.tv_usec < 0) {
322 boottime.tv_usec += 1000000;
323 boottime.tv_sec--;
324 }

--- 373 unchanged lines hidden ---
319 nanouptime(&ts2);
320 boottime.tv_sec = ts->tv_sec - ts2.tv_sec;
321 /* XXX boottime should probably be a timespec. */
322 boottime.tv_usec = (ts->tv_nsec - ts2.tv_nsec) / 1000;
323 if (boottime.tv_usec < 0) {
324 boottime.tv_usec += 1000000;
325 boottime.tv_sec--;
326 }

--- 373 unchanged lines hidden ---