[SIGAR-129] add another sanity check

This commit is contained in:
Doug MacEachern 2008-12-19 23:10:37 +00:00
parent bf61ce78a9
commit ede7b6c9de
1 changed files with 5 additions and 0 deletions

View File

@ -148,6 +148,11 @@ SIGAR_DECLARE(int) sigar_proc_cpu_get(sigar_t *sigar, sigar_pid_t pid,
memcpy(prev, proccpu, sizeof(*prev));
if (proccpu->total < otime) {
/* XXX this should not happen */
otime = 0;
}
if (otime == 0) {
proccpu->percent = 0.0;
/* first time called */