- "Return the run time in the internal time format. (See
- INTERNAL-TIME-UNITS-PER-SECOND.) This is useful for finding CPU usage."
- ;; FIXME: This is yet another creeping malaise: instead of #+/-win32
- ;; conditionals things like these need to be split into wholly separate
- ;; implementations of get-internal-run-time, probably one in
- ;; unix.lisp and one in win32.lisp -- that however requires also
- ;; cleaning up unix.lisp sufficiently to remove it from the Windows build.
- #-win32
- (multiple-value-bind (ignore utime-sec utime-usec stime-sec stime-usec)
- (sb!unix:unix-fast-getrusage sb!unix:rusage_self)
- (declare (ignore ignore)
- (type (unsigned-byte 31) utime-sec stime-sec)
- ;; (Classic CMU CL had these (MOD 1000000) instead, but
- ;; at least in Linux 2.2.12, the type doesn't seem to be
- ;; documented anywhere and the observed behavior is to
- ;; sometimes return 1000000 exactly.)
- (type (integer 0 1000000) utime-usec stime-usec))
- (let ((result (+ (* (+ utime-sec stime-sec)
- sb!xc:internal-time-units-per-second)
- (floor (+ utime-usec
- stime-usec
- (floor micro-seconds-per-internal-time-unit 2))
- micro-seconds-per-internal-time-unit))))
- result))
- #!+win32
- (multiple-value-bind
- (creation-time exit-time kernel-time user-time)
- (sb!win32:get-process-times)
- (declare (ignore creation-time exit-time))
- (values (floor (+ user-time kernel-time) 100ns-per-internal-time-unit))))
+ "Return the run time used by the process in the internal time format. (See
+INTERNAL-TIME-UNITS-PER-SECOND.) This is useful for finding CPU usage.
+Includes both \"system\" and \"user\" time."
+ (system-internal-run-time))