Newsgroups: comp.sys.transputer
From: iselin@iam.unibe.ch (nicolas iselin)
Subject: Re: measure execution time on T800
Organization: Dept. of CS, University of Berne, Switzerland
Date: 1 Dec 1994 20:07:08 GMT
Message-ID: <3bladc$5pi@aragorn.unibe.ch>

Hello,

I wrote once an occam program that allow to measure the total execution of
every top-level parallel process separately. You have, say, a program
structure like

...  constants
...  libraries
...  channels

PAR 
  process1
  process2
  ...
  processn

You just had to run in parallel the monitor and your program:

PAR 
  ...  monitor
  ...  the program to be measured

The basic idea was that with a structure like described above, every parallel 
process uses a well defined and disjunct part of the memory for the
scheduled processes. By inspecting at every scheduling point (by manipulation
of the low priority process queue) the contents of the next process, I
could record the time a process was using. The slow down by this procedure
was very dependend on the code you execute. In an (untypical) program like

PAR 
  SEQ i = 0 FOR a.big.number
    SKIP
  SEQ i = 0 FOR another.big.number
    SKIP

The program used about 10% more time. However, a program like

CHAN OF INT c:
PAR
  SEQ i = 0 FOR a.big.number
    c ! 0
  SEQ i = 0 FOR a.big.number
    INT any:
    c ? any

the program took 10 times (or so) longer. The factor is the average time
a process remains working before being descheduled.

The process queue was manipulated after every context switch so it looked like

FrontPointer -->  user.process1 --> spy --> user.process2 --> user.process3 ...

And by reading the contents of FrontPointer, I knew which process will be executed
next, and when the spy reactivated the (High Priority) monitor process, the
time elapsed was added to the time for this process.

If you want more information, please contect me through Email.

Nicolas Iselin
Dep. of Computer Science         iselin@iam.unibe.ch  


