[comp.sys.mac] LightSpeed C time

simon@alberta.UUCP (Simon Tortike) (10/03/87)

I was trying out some timings in LightSpeed C the other day when I ran
into a little problem with the call to time() in the unix library.
Specifically, I was timing adds, multiplications and divisions with
(separately) double and short double variables (i.e. 64-bit and 80-bit)
with a one-line for loop.  time() was called before and after the
for loop in each case.  Output was written using printf. All the integer
variables were declared unsigned long.
 I had the source code, MacTraps, unix.h, stdio.h and PrLink.Lib in one
segment in the project.  The timings for the additions and multiplications
were fine, but the call to time() before the divides seems to cause
a address error (access address 3FFF8003 - instruction - this info. from
TMON).  This occurred whether the loop was 10 times or 1 000 000 times.
I commented out all the code except for the divides (which were last) and
the same error occurred.
  Could anyone say whether I am using the function time() incorrectly
or if this is some other bug which might have been posted previously?
I am using a Mac+ with S4.0/F5.4 and an HD-20.  Probably best to mail
any suggestions to me. (I am only a casual Mac programmer.)
  -------------------  
W. Simon Tortike
Dept Min, Met &    UUCP:   {ubc-vision,ihnp4,mnetor}!alberta!simon
  Petroleum Engg   BITNET: stortike@ualtavm
Univ. of Alberta   AGT:    (403) 432-3338
Edmonton, AB
Canada T6G 2G6

singer@endor.harvard.edu (Richard Siegel) (10/05/87)

Offhand, I couldn't say what the problem is; I prefer to use TickCount()
for timing functions, myself.

If you can send the source directly to me, and tell me which version
of LSC you're using, I'll be happy to take a look at it.

		--Rich


**The opinions stated herein are my own opinions and do not necessarily
represent the policies or opinions of my employer (THINK Technologies, Inc).

* Richard M. Siegel | {decvax, ucbvax, sun}!harvard!endor!singer    *
* Customer Support  | singer@endor.harvard.edu			    *
* THINK Technologies, Inc.  (No snappy quote)                       *