Changeset 11463


Ignore:
Timestamp:
Dec 4, 2008, 10:48:08 AM (11 years ago)
Author:
hans
Message:

On Darwin, use mach_timespec instead of timespec when dealing with kernel times.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/tools/advice-profiler/profiler.lisp

    r9447 r11463  
    9797     ,@body))
    9898
     99#+darwin
     100(defun mach-timespec->nanoseconds (ts)
     101  "Convert the given typespec structure into nanoseconds."
     102  (+ (* 1000000000 (pref ts :mach_timespec.tv_sec))
     103     (pref ts :mach_timespec.tv_nsec)))
     104#+darwin
     105(declaim (inline mach-timespec->nanoseconds))
     106
    99107(defun timespec->nanoseconds (ts)
    100108  "Convert the given typespec structure into nanoseconds."
     
    111119  (#_host_get_clock_service (#_mach_host_self) #$REALTIME_CLOCK clock-port)
    112120  (defun get-real-time ()
    113     (ccl:rlet ((ts :mach_timespec_t))
    114       (#_clock_get_time (%get-ptr clock-port) ts)
    115       (timespec->nanoseconds ts))))
     121    (ccl:rlet ((ts :mach_timespec))
     122      (unless (zerop (#_clock_get_time (%get-ptr clock-port) ts))
     123        (error "error reading clock ~A: ~A~%" id (ccl::%strerror (ccl::%get-errno))))
     124      (mach-timespec->nanoseconds ts))))
    116125
    117126;;; For non-Darwin platforms, we use clock_gettime() with the
Note: See TracChangeset for help on using the changeset viewer.