[comp.sys.transputer] 3L Parallel C time function

jcheng@RADAR.NRL.NAVY.MIL (Jerry Cheng) (03/25/89)

I was trying to figure out the execution speed of the build-in arctangent
function of the Parallel C compiler.  I was using the following codes:

#include "time.h"
#include "math.h"
#define SIZE 100000
main()
{
  int n, t1, t2;
  float x;

  t1 = time();
  for ( n=0; n<SIZE; n++ )
    x = atan( (float) n );
  t2 = time();

  printf( "start %d  finish %d  time elapsed %d\n", t1, t2, t2-t1 );
}

I compiled the program and ran it using

  >afserver -:b trig.b4

The program printed out the answers but then the computer just hung up.
I had to do a CTRL-BREAK and got the message

Server aborted by user

The answer returned by the program was correct, but the program (or the server)
never terminated.  And there does not seem to have any obvious reasons.
I suspected that the 'time' function call might have something to do with it
so I removed from my program all references to 'time'.

#include "math.h"
#define SIZE 100000
main()
{
  int n;
  float x;
  for ( n=0; n<SIZE; n++ )
    x = atan( (float) n );

  printf( "start %d  finish %d  time elapsed %d\n", n, n, n );
}

And it worked fine!  I got the DOS prompt back right after the program printed
"start 100000  finish 100000  ti....."  Oh, yes.  I was using a Zenith ZWX248
AT compatible computer with a B009 board which had a 20MHz T414 with 1 MB of
RAM.  I was using the board in Configuration A.

Besides 'time' there was 'clock', which returns the clock ticks of the transpur instead of the AT system clock.  I went back to the first program and
changed time() calls to clock().  And it also worked perfectly.

It seems to me that the problem exists only for 'time'.  Is this a bug in
3L's library routine?  Or is it due to something else?  I'd welcome any
answers and suggestions.

Jerry Cheng
Naval Research Laboratory
jcheng@radar.nrl.navy.mil