[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: joofung@iss.nus.sg*Subject*: Re: get-internal-real-time and internal-time-units-per-second*From*: "Mark A. Tapia" <markt@dgp.toronto.edu>*Date*: Tue, 14 Dec 1993 10:18:15 -0500*Cc*: info-mcl@cambridge.apple.com

On Monday 13 DEC, Wong Joo Fung asks Right now, I'm a little puzzled about the timing accuracy that I can get from MCL. That is, MCL 2.0 tells me that internal-time-units-per-second has the value of 1000 -- and this seems to imply that (get-internal-real-time) has an accuracy of up to 1 millisecond. However, the Mac's time manager is only updated 60 times a second (or so) -- meaning that all times are only accurate to about 16 milliseconds. Here's a simple example that shows that the resolution is greater than 1/60 ms (a clock tick). ? (defun time-test (n) (loop for i fixnum from 1 to n with j = 0 do (incf j) finally (return j))) ? (loop for i from 1 to 6 initially (gc) with j = 10 do (time (time-test j)) do (setq j (* j 10))) ? Here are the statistics on Mac IIcx with 8mb running Lisp in a 6mb partition. As you can see, the resolution is creatly improved. This is probably a reflection of the faster clock speeds J Total Time Multi tasking 10 52ms 12ms 100 1ms 1000 6ms 10000 53ms 1ms 100000 542ms 5ms 1000000 6213ms 781ms Here are the relevant disassembled functions for reporting the internal time. mark ? (disassemble #'GET-INTERNAL-RUN-TIME) 0 (JSR_SUBPRIM $SP-NOARGS) 4 (MOVE.L (FIXNUM -846) D1) 10 (MOVE.L (FIXNUM -842) D0) 16 (SET_NARGS 2) 18 (ADDQ.W 4 SP) 20 (JMP #'CCL::%TMTASK-TIME) ? ? (disassemble #'CCL::%TMTASK-TIME) 0 (JSR_SUBPRIM $SP-TWO-ARGS-VPUSH) 4 (ASR.L 3 D1) 6 (MOVE.L (A5 D1.L 0) ATEMP0) 10 (ASR.L 3 D0) 12 (PEA (A5 D0.L 4)) 16 (ATRAP #xA059) 18 (MOVE.L (ATEMP0 10) D1) 22 (ATRAP #xA058) 24 (MOVE.L (FIXNUM 125) D0) 30 (ATRAP #xA05A) 32 (MOVE.L (FIXNUM 125000) D0) 38 (ADD.L D1 D0) 40 (SPOP ATEMP0) 42 (MOVE.L SP ATEMP1) 44 (PEA (@W 0)) 48 (ADD.L D0 @ATEMP0) 50 (ADDX.L -@ATEMP1 -@ATEMP0) 52 (ADDQ.L 4 SP) 54 (JSR #'CCL::%%DOUBLE-US->MS) 60 (SPOP VSP) 62 (RTS) ? (disassemble #'CCL::%%DOUBLE-US->MS) 0 (MOVEM.L ATEMP0@+ #(D1 D0)) 4 (MOVE.L (FIXNUM 125) D3) 10 (DIVU.L D3 (D0 D1)) 14 (BVS.S LABEL-24) 16 (MOVE.L D1 D0) 18 (JMP_SUBPRIM $SP-MKULONG) 22 (BRA.S 'CCL::%%DOUBLE-US->MS) LABEL-24 (MOVE.L D0 D3) 26 (CLR.W D0) 28 (VPUSH D0) 30 (SWAP D3) 32 (CLR.W D3) 34 (VPUSH D3) 36 (MOVE.L D1 D0) 38 (JSR_SUBPRIM $SP-MKULONG) 42 (MOVE.L D0 D1) 44 (VPOP D3) 46 (SWAP D3) 48 (VPOP D0) 50 (MOVE.W D3 D0) 52 (VPUSH D1) 54 (JSR_SUBPRIM $SP-MKULONG) 58 (MOVE.L D0 D1) 60 (MOVE.L (FIXNUM 32) D0) 66 (SET_NARGS 2) 68 (JSR #'ASH) 74 (VPOP D1) 76 (JSR_SUBPRIM $SP-ADD2ACC) 80 (MOVE.L D0 D1) 82 (MOVE.L (FIXNUM 1000) D0) 88 (SET_NARGS 2)

- Prev by Date:
**Re: Sliders?** - Next by Date:
**Cancel subscription** - Previous by thread:
**Re: get-internal-real-time and internal-time-units-per-second** - Next by thread:
**Re: get-internal-real-time and internal-time-units-per-second** - Index(es):