LTCD_070816.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:45:20 +02:00
1 parent d14bbc24f9
commit 0e9364ff4c
506 files changed
+157705 -41812

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
/*
$FG,2$This program allows you to measure the
timing of various instructions.
Don't be surprised by odd results
because the CPU does instructions in
parallel sometimes and a simple
instruction might take place in parallel
with the loop instruction and it will
report zero clock cycles.
$FG$*/
#define SAMPLE_SIZE 100000000
void TimeIns()
{
I8 i;
U8 start1,end1,start2,end2,overhead_time,test_time;
double reg d=5.0; //$FG,2$Use the $FG,4$reg$FG,2$ directive to designate register variables$FG$
Preempt(OFF);
//Measure Loop Overhead
start1=GetTimeStamp;
for (i=0;i<SAMPLE_SIZE;i++) {
}
end1=GetTimeStamp;
overhead_time=end1-start1;
start2=GetTimeStamp;
for (i=0;i<SAMPLE_SIZE;i++) {
$FG,4$#exe {OPassTraceMask(0b100000000);OTrace(ON);}
//$FG,2$Put your test instructions here.$FG,4$
d*=1.00001;
#exe {OTrace(OFF);}
$FG$ }
end2=GetTimeStamp;
test_time=end2-start2;
PrintF("\r\n\r\n\r\nCycles %10.5f\r\n",
(test_time-overhead_time)*1.0/SAMPLE_SIZE);
Preempt(ON);
}
TimeIns;