Presentation is loading. Please wait.

Presentation is loading. Please wait.

Test for timestamp : measure code execution time.

Similar presentations


Presentation on theme: "Test for timestamp : measure code execution time."— Presentation transcript:

1 Test for timestamp : measure code execution time

2 The function of timestamp Alt_timestamp_start(); –start the timer. –Calling the function again will reset the counter to zero. Alt_timestamp(); –Read the timer value Alt_timestamp_freq(); –Number of ticks per second If the number of clock ticks reaches(2^32-1) the value is undefined.

3 Example #include // required header file #include “sys/alt_timestamp.h” #include “alt_types.h” // variable declaration Alt_u32 time1; Alt_u32 time2; // start the timestamp device alt_timestamp_start(); Time1 = alt_timestamp(); Function1(); Time2 = alt_timestamp(); // function1() execution time is time2 - time1;

4 reference NiosII software development handbook : chapter 4 Developing programs using the HAL

5 Experimental result We use DMA to read data from system memory and write data to system memory. CPU will read the system memory at the same time. Then CPU and DMA will have bus contention. With cache –CPU contention : 4731 ticks –No contention : 4719 ticks Without cache –CPU contention : 4905 ticks –No Contention : 4719 ticks

6 Conclusion The read operation needs about 2 clock cycle so do the write operation. 1024 *4 = 4096. with some other control signal. The execution time looks correct. The cache mechanism can enhance the performance a lot. If the device support burst transfer ( like memory), we can use a buffer to speed up the system. My next project will try to add a buffer to the DMA to see if this idea works or not.


Download ppt "Test for timestamp : measure code execution time."

Similar presentations


Ads by Google