minow@mountn.dec.com (Martin Minow) (08/06/90)
I very vaguely remember reading an article/note on high-resolution (i.e., better than TickCount()) timing on the Macintosh, but can't seem to find it any more. If anyone has a reference lying around (or, was it a note posted here), I'd greatly appreciate a copy/pointer. Send mail to me and I'll summarize for the net. Thanks. Martin Minow minow@bolt.enet.dec.com
ccc_ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) (08/07/90)
To time things to better than single-tick resolution, you need the Time Manager. The original Time Manager is documented in chapter 32 of the New Testament (Inside Mac Vol IV), and lets you invoke tasks at intervals measured to millisecond resolution. System 6.0.3 introduced the Revised Time Manager, which gives you the option of microsecond resolution (just pass a negative tmCount). You can also use the Revised Time Manager to measure unknown intervals, without necessarily invoking a task: the way this works is, if you call RmvTime before the timer has gone off, the tmCount field will contain the number of time units (milliseconds or negated microseconds) remaining until the timer would have gone off. The above information is from the interim Inside Mac Vol VI documentation on the System 7.0a9 CD-ROM (I don't have 7.0a12, sigh...). This also mentions the Extended Time Manager in System 7.0, which adds a few new interesting functions. Tech Note 180 has a few more hints about the Revised Time Manager; on or about page 7 (my copy may have been reformatted a little), in a section labeled "Time Manager Tasks", it says that your timer task now gets the TMTask record address in A1, and it no longer needs to worry about setting up A5. Lawrence D'Oliveiro fone: +64-71-562-889 Computer Services Dept fax: +64-71-384-066 University of Waikato electric mail: ldo@waikato.ac.nz Hamilton, New Zealand 37^ 47' 26" S, 175^ 19' 7" E, GMT+12:00 Finally, a message for all power users: pay your electricity bills!
minow@mountn.dec.com (Martin Minow) (08/07/90)
In article <1822@mountn.dec.com> minow@bolt.enet.dec.com (me) asks about
high-resolution timing. Thanks for several useful responses:
-- The TimeManager (Inside Mac IV and TechNote 180) supports 1 msec
resolution timing. You can install a task that merely updates a
global counter each time it is called. There might be problems
if I/O operations block the interrupt.
-- Mike Tarr described a millisecond timer support package:
There is a millisecond timer that works on all macs -- the reference is
Behavior Research Methods, Instruments, and Computers, 1989, 21 (5), pp
540-547 and the title is: Millisecond timing on the apple macintosh:
updating drexel's millitimer. They distribute a disk with full sources.
It seems to work pretty well -- but there is no simple way to link these
to a keypress...
-- Think C has a "VIA_timer.c" (in the library source) that, according to
comments in the code, gives 1.28 microsecond resolution. This is used
by the Think C profiler. I'm not certain if it will work for, say,
an INIT or driver. Nor am I sure it will work on "all" Mac's, including
future systems.
Thanks to the following for the useful help (in order of arrival).
pers@ifi.uio.no Per Siljubergsaasen, Institute of Informatics,
University of Oslo
andyc@ai.mit.edu, Andrew D. Christian
tarr@cs.yale.edu Mike Tarr
ba0k+@andrew.cmu.edu Brian Patrick Arnold
olson@endor.harvard.edu Eric K. Olson
Martin Minow
minow@bolt.enet.dec.com