Skip to content
Snippets Groups Projects
Commit c066eb89 authored by rtoy's avatar rtoy
Browse files

o Don't try to scale the time-base value by 16 to get cycles, because

  that seems to depend on what CPU is being used.  Jon Boone says it's
  64 on a G5.  It's some other weird value for a G4.
o Change TIME output to say "time-base cycles" instead of "CPU cycles"
  for PPC, so the user isn't confused when (time (sleep 1)) returns
  something unexpected.
parent 484fcd5b
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain. ;;; Carnegie Mellon University, and has been placed in the public domain.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/time.lisp,v 1.26 2004/10/09 01:08:11 rtoy Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/time.lisp,v 1.27 2004/10/09 02:47:44 rtoy Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -369,7 +369,7 @@ ...@@ -369,7 +369,7 @@
~S second~:P of real time~% ~ ~S second~:P of real time~% ~
~S second~:P of user run time~% ~ ~S second~:P of user run time~% ~
~S second~:P of system run time~% ~ ~S second~:P of system run time~% ~
~:D CPU cycles~% ~ ~:D ~A cycles~% ~
~@[[Run times include ~S second~:P GC run time]~% ~]~ ~@[[Run times include ~S second~:P GC run time]~% ~]~
~S page fault~:P and~% ~ ~S page fault~:P and~% ~
~:D bytes consed.~%" ~:D bytes consed.~%"
...@@ -379,6 +379,9 @@ ...@@ -379,6 +379,9 @@
(max (/ (- new-run-utime old-run-utime) 1000000.0) 0.0) (max (/ (- new-run-utime old-run-utime) 1000000.0) 0.0)
(max (/ (- new-run-stime old-run-stime) 1000000.0) 0.0) (max (/ (- new-run-stime old-run-stime) 1000000.0) 0.0)
(truncate cycle-count) (truncate cycle-count)
;; The counter for PPC isn't the number of CPU
;; cycles, unlike x86 and Ultrasparc.
#+ppc "time-base" #-ppc "CPU"
(unless (zerop gc-run-time) (unless (zerop gc-run-time)
(/ (float gc-run-time) (/ (float gc-run-time)
(float internal-time-units-per-second))) (float internal-time-units-per-second)))
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/ppc/system.lisp,v 1.2 2004/10/09 01:08:11 rtoy Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/ppc/system.lisp,v 1.3 2004/10/09 02:47:45 rtoy Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -274,16 +274,4 @@ ...@@ -274,16 +274,4 @@
(move lo temp-lo)))) (move lo temp-lo))))
(defun read-cycle-counter () (defun read-cycle-counter ()
(multiple-value-bind (lo hi) (read-time-base))
(read-time-base) \ No newline at end of file
;; Based on some simple tests by reading the time-base, sleeping
;; for 1 sec, and reading the time-base again, it seems that on an
;; iMac G3/400 MHz, the time base value is incremented once for
;; each clock cycle. Is that true for other iMacs? I hope so.
;;
;; So, left shift the time-base value by 4 to figure out how many
;; cycles have elapsed.
(let ((overflow (ldb (byte 4 28) lo)))
(values (ldb (byte 32 0) (ash lo 4))
(ldb (byte 32 0) (+ overflow
(ash hi 4)))))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment