[SIGAR-129] add another sanity check
This commit is contained in:
parent
3c0541888f
commit
901c6eeef4
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue