Process start time incorrect inside VE [message #27772] |
Tue, 26 February 2008 23:19 |
aab49
Messages: 10 Registered: November 2007 Location: USA
|
Junior Member |
|
|
For some reason, the process timestamps reported inside a VE when using "ps -ef" are incorrect:
[root@testwww /]# date
Tue Feb 26 18:16:01 EST 2008
[root@testwww /]# ps -ef | grep tomcat
www 3765 1 0 Feb09 ? 00:00:03 /usr/local/j2sdk1.4.2_12/bin/java -classpath........
On the HN, the same process shows up with correct timestamp:
www 2995 2195 1 18:14 ? 00:00:02 /usr/local/j2sdk1.4.2_12/bin/java -classpath........
Hardware node is Fedora 8 running kernel 2.6.18-53.1.4.el5.028stab053.4
Any help would be appreciated. Thanks.
|
|
|
|
|
|
Re: Process start time incorrect inside VE [message #27823 is a reply to message #27772] |
Thu, 28 February 2008 15:26 |
aab49
Messages: 10 Registered: November 2007 Location: USA
|
Junior Member |
|
|
Here is some additional information from one of our other hardware nodes running Fedora 8:
HN
[root@openvz12 ~]# date
Thu Feb 28 10:05:44 EST 2008
[root@openvz12 ~]# uptime
10:05:45 up 16 days, 23:47, 1 user, load average: 0.08, 0.19, 0.12
[root@openvz12 ~]# last | grep reboot
reboot system boot 2.6.18-53.1.4.el Mon Feb 11 10:18 (17+00:01)
[root@openvz12 ~]# uname -a
Linux openvz12 2.6.18-53.1.4.el5.028stab053.4 #1 SMP Fri Jan 18 12:31:04 MSK 2008 i686 i686 i386 GNU/Linux
[root@openvz12 ~]# vzctl start 1203
[root@openvz12 ~]# ps -ef | grep tomcat
www 7079 6668 0 10:07 ? 00:00:02 /usr/local/java/bin/java -classpath
VE
[root@testwww /]# date
Thu Feb 28 10:08:03 EST 2008
[root@testwww /]# uptime
10:06:04 up 1 min, 0 users, load average: 0.02, 0.01, 0.00
[root@testwww /]# ps -ef | grep tomcat
www 8103 1 0 Feb11 ? 00:00:02 /usr/local/java/bin/java -classpath......
I have built the VE using the same template on HN running Fedora 6/7 (2.6.18-53.1.4.el5.028stab053.4) and it does not suffer from the issue.
It appears to only happen on a HN running Fedora 8.
Also, the process start time reported inside VE (Feb 11) coincides with the date that the HN was last rebooted. This may be some type of clue but I am not sure.
I do not use any checkpointing/migration tools.
|
|
|
|
|
|
|
|
Re: Process start time incorrect inside VE [message #27878 is a reply to message #27851] |
Fri, 29 February 2008 17:22 |
maratrus
Messages: 1495 Registered: August 2007 Location: Moscow
|
Senior Member |
|
|
Seems it uses /proc/stat to calculate boot time.
From ps src:
./ps/display.c
-------------------------------------
int main(int argc, char *argv[]){
...
reset_global();
...
}
-------------------------------------
./ps/global.c
-------------------------------------
void reset_global(void){
...
/* get boot time from /proc/stat */
fd = open("/proc/stat", O_RDONLY, 0);
if (fd != -1) {
buf[BUFFSIZE-1] = 0;
read(fd, buf, BUFFSIZE-1);
b = strstr(buf, "btime ");
if (b) {
sscanf(b, "btime %lu", &time_of_boot);
seconds_since_boot = time(0) - time_of_boot;
}
close(fd);
}
...
}
-------------------------------------
./ps/output.c
-------------------------------------
static int pr_stime(char *restrict const outbuf, const proc_t *restrict const pp){
...
t = time_of_boot + pp->start_time / Hertz;
...
}
-------------------------------------
|
|
|
|
|
|
|