X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ftime.lisp;h=0fc9d1c32db11f708679a9960270eadf743ecde5;hb=970dd272dc84f7420252eadb4829cc193f795716;hp=29a7687f390b70db3203716b47151f3d323a464a;hpb=9b458bf995314b7edd1cc050bd11ede83ada4328;p=sbcl.git diff --git a/src/code/time.lisp b/src/code/time.lisp index 29a7687..0fc9d1c 100644 --- a/src/code/time.lisp +++ b/src/code/time.lisp @@ -18,6 +18,9 @@ (defconstant micro-seconds-per-internal-time-unit (/ 1000000 sb!xc:internal-time-units-per-second)) + +(defconstant 100ns-per-internal-time-unit + (/ 10000000 internal-time-units-per-second)) ;;; The base number of seconds for our internal "epoch". We initialize ;;; this to the time of the first call to GET-INTERNAL-REAL-TIME, and @@ -47,6 +50,12 @@ #!+sb-doc "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) @@ -62,7 +71,13 @@ stime-usec (floor micro-seconds-per-internal-time-unit 2)) micro-seconds-per-internal-time-unit)))) - result))) + 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)))) ;;;; Encode and decode universal times. @@ -353,7 +368,9 @@ (old-run-utime old-run-stime old-page-faults old-bytes-consed) (time-get-sys-info)) (setq old-real-time (get-internal-real-time)) - (let ((start-gc-run-time *gc-run-time*)) + (let ((start-gc-run-time *gc-run-time*) + #!+sb-eval (sb!eval:*eval-calls* 0)) + (declare #!+sb-eval (special sb!eval:*eval-calls*)) (multiple-value-prog1 ;; Execute the form and return its values. (funcall fun) @@ -367,7 +384,8 @@ ~S second~:P of real time~% ~ ~S second~:P of user run time~% ~ ~S second~:P of system run time~% ~ - ~@[[Run times include ~S second~:P GC run time.]~% ~]~ + ~@[[Run times include ~S second~:P GC run time.]~% ~]~ + ~@[~S call~:P to %EVAL~% ~]~ ~S page fault~:P and~% ~ ~:D bytes consed.~%" (max (/ (- new-real-time old-real-time) @@ -378,5 +396,7 @@ (unless (zerop gc-run-time) (/ (float gc-run-time) (float sb!xc:internal-time-units-per-second))) + #!+sb-eval sb!eval:*eval-calls* #!-sb-eval nil (max (- new-page-faults old-page-faults) 0) (max (- new-bytes-consed old-bytes-consed) 0))))))) +