OpenVZ Forum


Home » General » Support » Process start time incorrect inside VE
Re: Process start time incorrect inside VE [message #27878 is a reply to message #27851] Fri, 29 February 2008 17:22 Go to previous messageGo to previous message
maratrus is currently offline  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;
...
}
-------------------------------------
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: I can not reboot OpenVZ container
Next Topic: Ploop problems with md/RAID10
Goto Forum:
  


Current Time: Mon Aug 25 18:43:17 GMT 2025

Total time taken to generate the page: 0.06516 seconds