From: Petri Kaukasoina <kaukasoi@elektroni.ee.tut.fi>
To: john stultz <johnstul@us.ibm.com>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: Re: 2.6.1: process start times by procps
Date: Thu, 29 Jan 2004 16:38:47 +0200 [thread overview]
Message-ID: <20040129143847.GA4544@elektroni.ee.tut.fi> (raw)
In-Reply-To: <1075342912.1592.72.camel@cog.beaverton.ibm.com>
Thanks for answering,
On Wed, Jan 28, 2004 at 06:21:52PM -0800, john stultz wrote:
> On Tue, 2004-01-27 at 07:52, Petri Kaukasoina wrote:
> > I made an experiment shown below. I know nothing about kernel programming,
> > so this is probably not correct, but at least btime seemed to stay constant.
> > (I don't believe this fixes procps, though. If HZ if off by 180 ppm then I
> > guess ps can't possibly get its calculations involving HZ right. But at
> > least the bootup time reported by procinfo stays constant.)
>
>
> Uh, what does your /etc/ntp/drift file show?
ntp.drift is -22.251 on linux-2.6.1. But on linux-2.4.24 it stabilizes at
about -5.4.
> The basic equation is:
> btime ~= gettimeodfay() - uptime
>
> Thus if your time of day is adjusted by NTP, btime will change as well.
> Uptime is calculated calculated by jiffies/HZ, and HZ is not NTP
> adjusted, so if your system is running 180ppm too fast or slow, btime
> would be expected to change.
>
Yes, on linux-2.2.24 I can see that /proc/uptime is just the jiffies and
btime is current time - jiffies. But in linux-2.6.1 /proc/uptime is now
do_posix_clock_monotonic_gettime(), whatever that means, and /proc/uptime
gives a correct value. But btime is still gettimeofday-jiffies and it does
not stay constant. My patch changed btime to be
gettimeofday-do_posix_clock_monotonic_gettime() and after that it stays
constant.
In other words, on linux-2.2.24, if I print the current time with 'date +%s'
and subtract uptime (/proc/uptime) from that, I do get the same number that
is in the btime field in /proc/stat. But not on linux-2.6.1 without my
patch. (ntp running in both cases.)
> I'm not yet sure how that is related to the ps start time being wrong.
I guess it's not. The relative error was just the same in both. On
linux-2.2.24, ps start time is correct but on linux-2.6.1 it shows times in
future. How much in future, about minute per four days of uptime. But if I
multiply Hertz by e.g. 1.000172 in the ps source, then I get the right
results on linux-2.6.1.
I'll do an experiment and boot to linux-2.6.1 without ntpd next...
Thanks,
-Petri
next prev parent reply other threads:[~2004-01-29 14:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-23 19:47 Petri Kaukasoina
2004-01-25 11:08 ` Petri Kaukasoina
2004-01-27 15:52 ` Petri Kaukasoina
2004-01-27 17:31 ` Petri Kaukasoina
2004-01-29 2:21 ` john stultz
2004-01-29 14:38 ` Petri Kaukasoina [this message]
2004-01-29 19:48 ` john stultz
2004-01-29 20:33 ` Petri Kaukasoina
2004-01-29 22:51 ` Andrew Morton
2004-01-30 12:42 ` Petri Kaukasoina
2004-01-29 20:13 ` Petri Kaukasoina
2004-02-01 20:18 ` Bill Davidsen
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=20040129143847.GA4544@elektroni.ee.tut.fi \
--to=kaukasoi@elektroni.ee.tut.fi \
--cc=johnstul@us.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®