From c066eb8996798bb5591842fb17991c74539fa2b9 Mon Sep 17 00:00:00 2001 From: rtoy <rtoy> Date: Sat, 9 Oct 2004 02:47:45 +0000 Subject: [PATCH] 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. --- code/time.lisp | 7 +++++-- compiler/ppc/system.lisp | 16 ++-------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/code/time.lisp b/code/time.lisp index 2a4cac535..446fa77ca 100644 --- a/code/time.lisp +++ b/code/time.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (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 @@ ~S second~:P of real time~% ~ ~S second~:P of user run time~% ~ ~S second~:P of system run time~% ~ - ~:D CPU cycles~% ~ + ~:D ~A cycles~% ~ ~@[[Run times include ~S second~:P GC run time]~% ~]~ ~S page fault~:P and~% ~ ~:D bytes consed.~%" @@ -379,6 +379,9 @@ (max (/ (- new-run-utime old-run-utime) 1000000.0) 0.0) (max (/ (- new-run-stime old-run-stime) 1000000.0) 0.0) (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) (/ (float gc-run-time) (float internal-time-units-per-second))) diff --git a/compiler/ppc/system.lisp b/compiler/ppc/system.lisp index 75d0e5808..6f8e43057 100644 --- a/compiler/ppc/system.lisp +++ b/compiler/ppc/system.lisp @@ -7,7 +7,7 @@ ;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; (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 @@ (move lo temp-lo)))) (defun read-cycle-counter () - (multiple-value-bind (lo hi) - (read-time-base) - ;; 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))))))) + (read-time-base)) \ No newline at end of file -- GitLab