Newsgroups: comp.sys.transputer
From: eeberger@faith (Lothar Berger)
Subject: sneaky suspicion wanted
Organization: Swansea Info Server
Date: Mon, 12 Dec 1994 18:25:23 GMT
Message-ID: <D0pn6C.LFA@info.swan.ac.uk>

Hi

if there are any people who deal with instruction code timing on T800
I'd like to do a brain-storming with them. If already some experience
about extracting execution time. But I cannot explain the behaviour
of the following problem.

I wanted to measure the time for a 'ldc' machine code on a T800 with
Parallel-C.

Therefore I measure a function 'the_one' in a urgent task

...
time1 = timer_now();
 the_one(100000);
time2 =timer_now();
period = time2 - time1;
...


void the_one(int times)
{
  int i;
  for(i=1;i<=times;i++)
  { 
    asm { ldc 0; }
    asm { ldc 0; }
    asm { ldc 0; }
    asm { ldc 0; }
    asm { ldc 0; }

    asm { ldc 0; }
    asm { ldc 0; }
    asm { ldc 0; }
    asm { ldc 0; }
    asm { ldc 0; }

    asm { ldc 0; }
    asm { ldc 0; }
  }
}

I made several runs (up to 40). I started with only 1 'ldc'. Then I executed
2 'ldc' commands, 3 'ldc' commands ....
As 'lcd' takes one cycle I expected that the time from one run to the next 
always increases approximately by the same amount. But I was wrong!!!
Sometimes the time was even smaller when I added a new 'ldc' command!!!
Sometimes the time was the same as in the previous run!!

I guess that one reason could be that memory access is always word-long, but
I really have no explanation. The lack of word-alignment cannot be an 
explanation since 'ldc' is a direct instruction. 
Do you have a sneaky suspicion?


Cheers
Lothar


PS: Subsequently my results for gnuplot. As you can see every forth result is 
smaller than the previous.

#testfile for t7.c t800 transputer
#measuring 'ldc' command

#sample no.   runtime of code (one function call)
  1 	150006         
  2     158248      
  3 	158248          
  4     170329      
  5     166160      
  6     174552      
  7     174552      
  8     186673      
  9     182542       
 10     190691      
 11     203083      
 12	198901           
 13     205721      
 14     205721      
 15     219296      
 16     215333        
 17     222864      
 18     223104      
 19     235642      
 20     231435  
 21     240006  
 22     240006
 23     252006
 24     247748
 25     255707
 26     256006     
 27     267913
 28     264006
 29     271705
 30     272006
 31     284450 
 32     280360
 33     288006
 34     288006
 35     300438     
 36     296477
 37     304231
 38     304622
 39     316806
 40     313049

