0.7.3.4:
[sbcl.git] / src / code / time.lisp
index 1b4e823..3694425 100644 (file)
 
 (in-package "SB!IMPL")
 
-(defconstant internal-time-units-per-second 100
+(defconstant sb!xc:internal-time-units-per-second 1000
   #!+sb-doc
   "The number of internal time units that fit into a second. See
   GET-INTERNAL-REAL-TIME and GET-INTERNAL-RUN-TIME.")
 
 (defconstant micro-seconds-per-internal-time-unit
-  (/ 1000000 internal-time-units-per-second))
+  (/ 1000000 sb!xc:internal-time-units-per-second))
 \f
 ;;; 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
@@ -29,8 +29,6 @@
   #!+sb-doc
   "Return the real time in the internal time format. This is useful for
   finding elapsed time. See INTERNAL-TIME-UNITS-PER-SECOND."
-  ;; FIXME: See comment on OPTIMIZE declaration in GET-INTERNAL-RUN-TIME.
-  (declare (optimize (speed 3) (safety 3)))
   (multiple-value-bind (ignore seconds useconds) (sb!unix:unix-gettimeofday)
     (declare (ignore ignore) (type (unsigned-byte 32) seconds useconds))
     (let ((base *internal-real-time-base-seconds*)
@@ -41,7 +39,7 @@
             (truly-the (unsigned-byte 32)
                        (+ (the (unsigned-byte 32)
                                (* (the (unsigned-byte 32) (- seconds base))
-                                  internal-time-units-per-second))
+                                  sb!xc:internal-time-units-per-second))
                           uint)))
            (t
             (setq *internal-real-time-base-seconds* seconds)
   "Return the run time in the internal time format. This is useful for
   finding CPU usage."
   (declare (values (unsigned-byte 32)))
-  ;; FIXME: In CMU CL this was (SPEED 3) (SAFETY 0), and perhaps
-  ;; someday it should be again, since overhead here is annoying. But
-  ;; it's even more annoying to worry about this function returning
-  ;; out-of-range values, so while debugging the profiling code,
-  ;; I set it to (SAFETY 3) for now.
-  (declare (optimize (speed 3) (safety 3)))
   (multiple-value-bind (ignore utime-sec utime-usec stime-sec stime-usec)
       (sb!unix:unix-fast-getrusage sb!unix:rusage_self)
     (declare (ignore ignore)
             ;; documented anywhere and the observed behavior is to
             ;; sometimes return 1000000 exactly.)
             (type (integer 0 1000000) utime-usec stime-usec))
-
     (let ((result (+ (the (unsigned-byte 32)
                          (* (the (unsigned-byte 32) (+ utime-sec stime-sec))
-                            internal-time-units-per-second))
+                            sb!xc:internal-time-units-per-second))
                     (floor (+ utime-usec
                               stime-usec
                               (floor micro-seconds-per-internal-time-unit 2))
@@ -82,9 +73,9 @@
 ;;; Returns two values:
 ;;;  - the minutes west of GMT.
 ;;;  - T if daylight savings is in effect, NIL if not.
-(sb!alien:def-alien-routine get-timezone sb!c-call:void
-  (when sb!c-call:long :in)
-  (minutes-west sb!c-call:int :out)
+(sb!alien:define-alien-routine get-timezone sb!alien:void
+  (when sb!alien:long :in)
+  (minutes-west sb!alien:int :out)
   (daylight-savings-p sb!alien:boolean :out))
 
 ;;; Subtract from the returned Internal-Time to get the universal
 (defmacro time (form)
   #!+sb-doc
   "Execute FORM and print timing information on *TRACE-OUTPUT*."
-  `(%time #'(lambda () ,form)))
+  `(%time (lambda () ,form)))
 
 ;;; Return all the data that we want TIME to report.
 (defun time-get-sys-info ()
                 ~S page fault~:P and~%  ~
                 ~S bytes consed.~%"
                (max (/ (- new-real-time old-real-time)
-                       (float internal-time-units-per-second))
+                       (float sb!xc:internal-time-units-per-second))
                     0.0)
                (max (/ (- new-run-utime old-run-utime) 1000000.0) 0.0)
                (max (/ (- new-run-stime old-run-stime) 1000000.0) 0.0)
                (unless (zerop gc-run-time)
                  (/ (float gc-run-time)
-                    (float internal-time-units-per-second)))
+                    (float sb!xc:internal-time-units-per-second)))
                (max (- new-page-faults old-page-faults) 0)
                (max (- new-bytes-consed old-bytes-consed) 0)))))))