On Sun, Aug 10, 2008 at 03:13:50PM +1000, Paul Szabo wrote:
> I often observe this, mostly on that one machine "pisa". I do not think
> pisa is "special" in any way: has same hardware as some others, runs the
> same kernel, more-or-less the same daemons. Pisa is still running sarge:
Curious, just a standard type computer. There are some arches where the
jiffies don't quite work and I thought it was that.

Probably best to work out what numbers we use.

Start time is found in the 22nd field of /proc/<pid>/stat and is in
number of jiffies since the computer had booted. To get this to a wall
clock start time we add the boot time of the computer to the converted
start time. BUT, to get the boot time we need to subtract the uptime of
the computer from "now".

Or:
 w_stime = (now - uptime) + ( j_stime / Hertz)

w_stime is wall clock start time
now is seconds since epoch for the time now
uptime is first column of /proc/uptime
j_stime is 22nd column of /proc/<pid>/uptime
Hertz is usually 100

Can you run the following commands, you will need to change the PID to
whatever process id you have.

PID=21789 ; ( date +"%s -" ; cut -f 1 -d ' ' /proc/uptime ; echo " + ("
; cut -f 22 -d ' ' /proc/$PID/stat ; echo ' / 100 )' ) | (tr '\n' ' ' ;
echo ) ; ps -p $PID -o pid,start_time,cmd

then take the first line of the output (not the ps bit)  and then:

echo "THE OUTPUT" | bc | perl -e 'use Time::localtime; my $mytime=<>; ; print
ctime($mytime)."\n";'

So for me I get:

gonzo$ PID=21789 ; ( date +"%s -" ; cut -f 1 -d ' ' /proc/uptime ; echo " + (" 
; cut -f 22 -d ' ' /proc/$PID/stat ; echo ' / 100 )' ) | (tr '\n' ' '
; echo ) ; ps -p $PID -o pid,start_time,cmd
1218419241 - 251503.45  + ( 24646725  / 100 )
  PID START CMD
21789 10:23 sshd: [EMAIL PROTECTED]/0
gonzo$ echo "1218419241 - 251503.45  + ( 24646725  / 100 )" | bc | perl -e 'use 
Time::localtime; my $mytime=<>; ; print > ctime($mytime)."\n";'
  Mon Aug 11 10:23:24 2008

As you can see, I'm getting the same results (10:23) here. We may have
an under/overflow problem too.

 - Craig
-- 
Craig Small      GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
http://www.enc.com.au/                             csmall at : enc.com.au
http://www.debian.org/          Debian GNU/Linux, software should be Free 



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to