[comp.lang.modula2] timing programs with Metrowerks Mod 2 on Macs

curtis@sybil.cs.Buffalo.EDU (Ronald Curtis) (03/21/91)

Does anyone know a way to time programs using the Student version of
Metrowerks Mac Mod2? That is, does anyone have a procedure "gettime" so that
students can determine the time used by their program? eg

  x := gettime
  code to be timed goes here
  y := gettime
  timeused := y-x

The goal is to have them develop two implementation modules for a single
def and compare the results analytically and experimentally.

-- 
* Ronald Curtis, Computer Science Dept., SUNY at Buffalo, Buffalo, NY 14260    *
* OFFICE: 235 Bell Hall TELEPHONE: (716) 636-3185 CSNET: curtis@buffalo.csnet  *
* BITNET: curtis%cs.buffalo.edu@ubvm.bitnet      UUCP: {apple, cornell,decwrl, *
* harvard,rutgers,talcott,ucbvax,uunet}!cs.buffalo.edu!curtis 		       *

lins@Apple.COM (Chuck Lins) (03/21/91)

In article <66570@eerie.acsu.Buffalo.EDU> curtis@sybil.cs.Buffalo.EDU (Ronald Curtis) writes:
>Does anyone know a way to time programs using the Student version of
>Metrowerks Mac Mod2? That is, does anyone have a procedure "gettime" so that
>students can determine the time used by their program? eg
>
>  x := gettime
>  code to be timed goes here
>  y := gettime
>  timeused := y-x
>
>The goal is to have them develop two implementation modules for a single
>def and compare the results analytically and experimentally.
>
>-- 
>* Ronald Curtis, Computer Science Dept., SUNY at Buffalo, Buffalo, NY 14260    *
>* OFFICE: 235 Bell Hall TELEPHONE: (716) 636-3185 CSNET: curtis@buffalo.csnet  *
>* BITNET: curtis%cs.buffalo.edu@ubvm.bitnet      UUCP: {apple, cornell,decwrl, *
>* harvard,rutgers,talcott,ucbvax,uunet}!cs.buffalo.edu!curtis 		       *

Use the Toolbox routine "TickCount" - it's in the Utilities module. Gives results
to 1/60th of a second. If you need better accuracy you'll have ti use a milli-
second timer using the Time Manager described in Inside Macinotsh Volume 4.


-- 
Chuck Lins               | "Is this the kind of work you'd like to do?"
Apple Computer, Inc.     | -- Front 242
20525 Mariani Avenue     | Internet:  lins@apple.com
Mail Stop 37-BD          | AppleLink: LINS@applelink.apple.com
Cupertino, CA 95014      | "Self-proclaimed Object Oberon Evangelist"
The intersection of Apple's ideas and my ideas yields the empty set.