X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcode%2Ftime.lisp;h=13897422f9600d7a76b53f10a6de963dae2cc554;hb=18dc0069cd514c976042766ab9a785c970fe1603;hp=a6dbc9435449f42b09904bd91565b14c9f1969c7;hpb=fcd65db754f3a5062fccf136bc633e658e4967b3;p=sbcl.git diff --git a/src/code/time.lisp b/src/code/time.lisp index a6dbc94..1389742 100644 --- a/src/code/time.lisp +++ b/src/code/time.lisp @@ -46,11 +46,11 @@ Includes both \"system\" and \"user\" time." ;;; number of seconds since 1970-01-01 ;;; I'm obliged to Erik Naggum's "Long, Painful History of Time" paper -;;; for the choice of epoch -;;; here. By starting the year in March, we avoid having to test the month -;;; whenever deciding whether to account for a leap day. 2000 is especially -;;; special, because it's disvisible by 400, hence the start of a 400 year -;;; leap year cycle +;;; for the choice of epoch here. +;;; By starting the year in March, we avoid having to test the month +;;; whenever deciding whether to account for a leap day. 2000 is +;;; especially special, because it's divisible by 400, hence the start +;;; of a 400 year leap year cycle ;;; If a universal-time is after time_t runs out, we find its offset ;;; from 1st March of whichever year it falls in, then add that to @@ -95,9 +95,7 @@ Includes both \"system\" and \"user\" time." #!+sb-doc "Return a single integer for the current time of day in universal time format." - (multiple-value-bind (res secs) (sb!unix:unix-gettimeofday) - (declare (ignore res)) - (+ secs unix-to-universal-time))) + (+ (get-time-of-day) unix-to-universal-time)) (defun get-decoded-time () #!+sb-doc @@ -259,8 +257,10 @@ format." (defvar *gc-run-time* 0 #!+sb-doc - "the total CPU time spent doing garbage collection (as reported by - GET-INTERNAL-RUN-TIME)") + "Total CPU time spent doing garbage collection (as reported by +GET-INTERNAL-RUN-TIME.) Initialized to zero on startup. It is safe to bind +this to zero in order to measure GC time inside a certain section of code, but +doing so may interfere with results reported by eg. TIME.") (declaim (type index *gc-run-time*)) (defun print-time (&key real-time-ms user-run-time-us system-run-time-us @@ -393,7 +393,7 @@ normally during operations like SLEEP." ;;; function, report the times. (defun call-with-timing (timer function &rest arguments) #!+sb-doc - "Calls FUNCTION with ARGUMENTS, and gathers timing infomation about it. + "Calls FUNCTION with ARGUMENTS, and gathers timing information about it. Then calls TIMER with keyword arguments describing the information collected. Calls TIMER even if FUNCTION performs a non-local transfer of control. Finally returns values returned by FUNCTION. @@ -500,8 +500,10 @@ EXPERIMENTAL: Interface subject to change." (note :aborted aborted #'not) (note :bytes-consed (max (- new-bytes-consed old-bytes-consed) 0)) (note :page-faults page-faults #'zerop) - (note :processor-cycles cycles #'zerop) - (note :lambdas-converted sb!c::*lambda-conversions* #'zerop) + ;; cycle counting isn't supported everywhere. + (when cycles + (note :processor-cycles cycles #'zerop) + (note :lambdas-converted sb!c::*lambda-conversions* #'zerop)) (note :eval-calls *eval-calls* #'zerop) (note :gc-run-time-ms gc-internal-run-time) (note :system-run-time-us system-run-time)