svn commit: r260234 - head/sys/cddl/compat/opensolaris/sys

Alexander Motin mav at FreeBSD.org
Fri Jan 3 18:08:31 UTC 2014


Author: mav
Date: Fri Jan  3 18:08:31 2014
New Revision: 260234
URL: http://svnweb.freebsd.org/changeset/base/260234

Log:
  Remove extra conversion to nanoseconds from ddi_get_lbolt64().
  
  As result this uses one multiplication and shifts instead of one division
  and two multiplications.

Modified:
  head/sys/cddl/compat/opensolaris/sys/time.h

Modified: head/sys/cddl/compat/opensolaris/sys/time.h
==============================================================================
--- head/sys/cddl/compat/opensolaris/sys/time.h	Fri Jan  3 16:36:55 2014	(r260233)
+++ head/sys/cddl/compat/opensolaris/sys/time.h	Fri Jan  3 18:08:31 2014	(r260234)
@@ -70,12 +70,13 @@ gethrtime(void) {
 #define	gethrtime_waitfree()	gethrtime()
 
 extern int nsec_per_tick;	/* nanoseconds per clock tick */
+extern int hz;			/* clock ticks per second */
 
 static __inline int64_t
 ddi_get_lbolt64(void)
 {
 
-	return (gethrtime() / nsec_per_tick);
+	return (((getsbinuptime() >> 16) * hz) >> 16);
 }
 
 static __inline clock_t


More information about the svn-src-head mailing list