convert cpu time to seconds
This commit is contained in:
parent
1145f83c97
commit
3a84d89a78
|
@ -170,7 +170,9 @@ int sigar_os_open(sigar_t **sigar)
|
||||||
(*sigar)->boot_time = boottime.tv_sec; /* XXX seems off a bit */
|
(*sigar)->boot_time = boottime.tv_sec; /* XXX seems off a bit */
|
||||||
|
|
||||||
(*sigar)->pagesize = getpagesize();
|
(*sigar)->pagesize = getpagesize();
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
(*sigar)->ticks = 100; /* sysconf(_SC_CLK_TCK) == 128 !? */
|
||||||
|
#endif
|
||||||
(*sigar)->last_pid = -1;
|
(*sigar)->last_pid = -1;
|
||||||
|
|
||||||
(*sigar)->pinfo = NULL;
|
(*sigar)->pinfo = NULL;
|
||||||
|
@ -474,10 +476,10 @@ int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu->user = cp_time[CP_USER];
|
cpu->user = SIGAR_TICK2SEC(cp_time[CP_USER]);
|
||||||
cpu->nice = cp_time[CP_NICE];
|
cpu->nice = SIGAR_TICK2SEC(cp_time[CP_NICE]);
|
||||||
cpu->sys = cp_time[CP_SYS] + cp_time[CP_INTR];
|
cpu->sys = SIGAR_TICK2SEC(cp_time[CP_SYS] + cp_time[CP_INTR]);
|
||||||
cpu->idle = cp_time[CP_IDLE];
|
cpu->idle = SIGAR_TICK2SEC(cp_time[CP_IDLE]);
|
||||||
cpu->wait = 0; /*N/A*/
|
cpu->wait = 0; /*N/A*/
|
||||||
cpu->total = cpu->user + cpu->nice + cpu->sys + cpu->idle;
|
cpu->total = cpu->user + cpu->nice + cpu->sys + cpu->idle;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue