All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jim Houston <jim.houston@attbi.com>
To: linux-kernel@vger.kernel.org,
	high-res-timers-discourse@lists.sourceforge.net,
	jim.houston@ccur.com
Subject: [PATCH] calibrate_tsc should not use HZ
Date: Thu, 31 Oct 2002 14:28:50 -0500	[thread overview]
Message-ID: <200210311928.g9VJSoY03708@linux.local> (raw)


Hi Everyone,

I noticed that the calibration time for calibrate_tsc() is 5 jiffies.
This means the result with 1000 Hz jiffies may be less accurate
then it was at 100 Hz.  The attached patch removes this dependency.

Jim Houston - Concurrent Computer Corp.

diff -X /usr1/jhouston/dontdiff -ur linux.orig/arch/i386/kernel/timers/timer_tsc.c linux.kdb/arch/i386/kernel/timers/timer_tsc.c
--- linux.orig/arch/i386/kernel/timers/timer_tsc.c	Wed Oct 23 00:54:19 2002
+++ linux.kdb/arch/i386/kernel/timers/timer_tsc.c	Thu Oct 31 14:18:21 2002
@@ -97,8 +97,13 @@
  * device.
  */
 
-#define CALIBRATE_LATCH	(5 * LATCH)
-#define CALIBRATE_TIME	(5 * 1000020/HZ)
+/*
+ * Pick the largest possible latch value (it is a 16 bit counter)
+ * and calculate the corresponding time.
+ */
+#define CALIBRATE_LATCH	(0xffff)	
+#define CALIBRATE_TIME	((int)((1000000LL*CALIBRATE_LATCH + \
+				CLOCK_TICK_RATE/2)/CLOCK_TICK_RATE)
 
 static unsigned long __init calibrate_tsc(void)
 {

             reply	other threads:[~2002-10-31 19:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-31 19:28 Jim Houston [this message]
2002-10-31 19:52 ` [PATCH] calibrate_tsc should not use HZ george anzinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200210311928.g9VJSoY03708@linux.local \
    --to=jim.houston@attbi.com \
    --cc=high-res-timers-discourse@lists.sourceforge.net \
    --cc=jim.houston@ccur.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.