Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Jan 2014 18:08:31 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r260234 - head/sys/cddl/compat/opensolaris/sys
Message-ID:  <201401031808.s03I8V5a075322@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



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