implements Create_time of process_linux.

This commit is contained in:
Shirou WAKAYAMA 2014-04-24 19:08:07 +09:00
parent b01775ecf9
commit 0dcaecbada
1 changed files with 9 additions and 4 deletions

View File

@ -137,14 +137,19 @@ func fillFromStat(pid int32, p *Process) error {
}
p.Ppid = parseInt32(fields[3])
utime, _ := strconv.ParseFloat(fields[11], 64)
stime, _ := strconv.ParseFloat(fields[11], 64)
utime, _ := strconv.ParseFloat(fields[13], 64)
stime, _ := strconv.ParseFloat(fields[14], 64)
p.Cpu_times = CPU_TimesStat{
User: float32(utime / CLOCK_TICKS),
System: float32(stime / CLOCK_TICKS),
Cpu: "cpu",
User: float32(utime * (1000 / CLOCK_TICKS)),
System: float32(stime * (1000 / CLOCK_TICKS)),
}
boot_time, _ := Boot_time()
ctime := ((parseUint64(fields[21]) / uint64(CLOCK_TICKS)) + uint64(boot_time)) * 1000
p.Create_time = int64(ctime)
// p.Nice = parseInt32(fields[18])
// use syscall instead of parse Stat file
nice, _ := syscall.Getpriority(PRIO_PROCESS, int(pid))