1
1

Fix a problem where CPU time was computed wrong.

This definitely affected FreeBSD, which breaks POSIX.1 by not
setting CLOCKS_PER_SEC to 1000000 (see clock(3)).  At this point
I can't tell if any other platforms were affected by this.
Этот коммит содержится в:
Bruce A. Mah 2014-04-25 12:50:15 -07:00
родитель 5069cc1329
Коммит bf219a4d51

Просмотреть файл

@ -189,7 +189,7 @@ cpu_util(double pcpu[3])
systemdiff = ((rtemp.ru_stime.tv_sec * 1000000.0 + rtemp.ru_stime.tv_usec) -
(rlast.ru_stime.tv_sec * 1000000.0 + rlast.ru_stime.tv_usec));
pcpu[0] = ((ctemp - clast) / timediff) * 100;
pcpu[0] = (((ctemp - clast) * 1000000.0 / CLOCKS_PER_SEC) / timediff) * 100;
pcpu[1] = (userdiff / timediff) * 100;
pcpu[2] = (systemdiff / timediff) * 100;
}