Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Nov 2012 06:29:59 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r242886 - in projects/calloutng: share/man/man9 sys/sys
Message-ID:  <201211110629.qAB6Txoq015521@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sun Nov 11 06:29:59 2012
New Revision: 242886
URL: http://svnweb.freebsd.org/changeset/base/242886

Log:
  - Rename macro C_T2PREC() to C_US2PREC() to be more specific.
  - Add macro C_BT2PREC() to specify precision in form of bintime, that
  should be useful for relative precisions.
  - Document both macros.

Modified:
  projects/calloutng/share/man/man9/timeout.9
  projects/calloutng/sys/sys/callout.h

Modified: projects/calloutng/share/man/man9/timeout.9
==============================================================================
--- projects/calloutng/share/man/man9/timeout.9	Sun Nov 11 04:07:10 2012	(r242885)
+++ projects/calloutng/share/man/man9/timeout.9	Sun Nov 11 06:29:59 2012	(r242886)
@@ -349,6 +349,18 @@ Run handler directly from hardware inter
 It is faster, but puts more constraints on handlers.
 Handlers may use only spin mutexes for locking, and they must be fast because
 they run with absolute priority.
+.It Fn C_US2PREC
+Specifies acceptable deviation between requested and factual run time in
+microseconds.
+Bigger value allows to aggregate more events in one timer interrupt to
+reduce processing overhead and power consumption.
+.It Fn C_BT2PREC
+Alike to
+.Fn C_US2PREC ,
+but allows to specify deviation as 64bit fraction of second same as
+.Fa frac
+field in
+.Ft struct bintime .
 .El
 .Pp
 The function

Modified: projects/calloutng/sys/sys/callout.h
==============================================================================
--- projects/calloutng/sys/sys/callout.h	Sun Nov 11 04:07:10 2012	(r242885)
+++ projects/calloutng/sys/sys/callout.h	Sun Nov 11 06:29:59 2012	(r242886)
@@ -52,17 +52,18 @@
 
 #define	C_DIRECT_EXEC		0x0001 /* direct execution of callout */
 #define	C_PRECISIONBITS		24
-#define	C_PRECISIONRANGE	((1 << C_PRECISIONBITS) - 1)	
+#define	C_PRECISIONRANGE	((1 << C_PRECISIONBITS) - 1)
 #define	C_PRECISIONMASK		(1 << ((32 - C_PRECISIONBITS) - 1))
-#define	C_T2PREC(x)		(((x) * 4294) & C_PRECISIONMASK) 
+#define	C_US2PREC(x)		(((x) * 4294) & C_PRECISIONMASK)
+#define	C_BT2PREC(x)		(((x) >> 32) & C_PRECISIONMASK)
 #define	C_PREC2BT(x)		((uint64_t)(flags & C_PRECISIONMASK) << 32)
 
 /*
  * Common values specified for precision.
  */
-#define	C_P1MS			C_T2PREC(1000)
-#define	C_P10MS			C_T2PREC(10000)
-#define	C_P100MS		C_T2PREC(100000)
+#define	C_P1MS			C_US2PREC(1000)
+#define	C_P10MS			C_US2PREC(10000)
+#define	C_P100MS		C_US2PREC(100000)
 
 struct callout_handle {
 	struct callout *callout;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211110629.qAB6Txoq015521>