Date: Thu, 15 Nov 2012 20:06:08 +0000 (UTC) From: Davide Italiano <davide@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r243099 - in projects/calloutng/sys: kern sys Message-ID: <201211152006.qAFK68sM048369@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: davide Date: Thu Nov 15 20:06:07 2012 New Revision: 243099 URL: http://svnweb.freebsd.org/changeset/base/243099 Log: - Sort declarations - Fix TIMESEL() style and correct a typo - Move kernel-only macro out from !_KERNEL section Reported by: bde Modified: projects/calloutng/sys/kern/kern_tc.c projects/calloutng/sys/sys/time.h Modified: projects/calloutng/sys/kern/kern_tc.c ============================================================================== --- projects/calloutng/sys/kern/kern_tc.c Thu Nov 15 19:45:04 2012 (r243098) +++ projects/calloutng/sys/kern/kern_tc.c Thu Nov 15 20:06:07 2012 (r243099) @@ -120,7 +120,7 @@ SYSCTL_INT(_kern_timecounter, OID_AUTO, ×tepwarnings, 0, "Log time steps"); int tc_timethreshold; -int tc_timepercentage; +int tc_timepercentage = TC_DEFAULTPERC; struct bintime tick_bt; SYSCTL_INT(_kern, OID_AUTO, tc_timepercentage, CTLFLAG_RW, &tc_timepercentage, 0, "Precision percentage tolerance"); @@ -1714,8 +1714,8 @@ tc_ticktock(int cnt) static void inittimecounter(void *dummy) { - int tick_rate; u_int p; + int tick_rate; /* * Set the initial timeout to Modified: projects/calloutng/sys/sys/time.h ============================================================================== --- projects/calloutng/sys/sys/time.h Thu Nov 15 19:45:04 2012 (r243098) +++ projects/calloutng/sys/sys/time.h Thu Nov 15 20:06:07 2012 (r243099) @@ -55,23 +55,6 @@ struct bintime { uint64_t frac; }; -extern int tc_timethreshold; -extern struct bintime tick_bt; - -#define TC_DEFAULTPERC 5 - -#define FREQ2BT(freq, bt) \ -{ \ - (bt)->sec = 0; \ - (bt)->frac = ((uint64_t)0x8000000000000000 / (freq)) << 1; \ -} -#define BT2FREQ(bt) \ - (((uint64_t)0x8000000000000000 + ((bt)->frac >> 2)) / \ - ((bt)->frac >> 1)) - -#define TIMESEL(x, bt) \ - (((x) < (c_timethreshold)) ? binuptime(&bt) : getbinuptime(&bt)) - static __inline void bintime_addx(struct bintime *bt, uint64_t x) { @@ -307,7 +290,9 @@ void resettodr(void); extern time_t time_second; extern time_t time_uptime; extern struct bintime boottimebin; +extern struct bintime tick_bt; extern struct timeval boottime; +extern int tc_timethreshold; /* * Functions for looking at our clock: [get]{bin,nano,micro}[up]time() @@ -354,6 +339,22 @@ int ratecheck(struct timeval *, const st void timevaladd(struct timeval *t1, const struct timeval *t2); void timevalsub(struct timeval *t1, const struct timeval *t2); int tvtohz(struct timeval *tv); + +#define TC_DEFAULTPERC 5 + +#define FREQ2BT(freq, bt) \ +{ \ + (bt)->sec = 0; \ + (bt)->frac = ((uint64_t)0x8000000000000000 / (freq)) << 1; \ +} +#define BT2FREQ(bt) \ + (((uint64_t)0x8000000000000000 + ((bt)->frac >> 2)) / \ + ((bt)->frac >> 1)) + +#define TIMESEL(x, bt) \ + ((x) < tc_timethreshold ? (binuptime : getbinuptime(&(bt))) + + #else /* !_KERNEL */ #include <time.h>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211152006.qAFK68sM048369>