From owner-svn-src-projects@FreeBSD.ORG Thu Nov 15 20:06:08 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5770E43C; Thu, 15 Nov 2012 20:06:08 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3D9738FC16; Thu, 15 Nov 2012 20:06:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAFK68qO048371; Thu, 15 Nov 2012 20:06:08 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAFK68sM048369; Thu, 15 Nov 2012 20:06:08 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201211152006.qAFK68sM048369@svn.freebsd.org> From: Davide Italiano Date: Thu, 15 Nov 2012 20:06:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r243099 - in projects/calloutng/sys: kern sys X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Nov 2012 20:06:08 -0000 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