Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

EK-TM4C123GXL: How to benchmark code?

$
0
0

Part Number:EK-TM4C123GXL

Hello,

I tried to use SysTick to time a segment of code, but I am getting an answer that I can tell is wrong. This is what I have done:

SysTickPeriodSet(16777216);

SysTickEnable();

uint32_t numCycles = SysTickValueGet();

// time-intensive code runs here

numCycles = SysTickValueGet() - numCycles;

uint32_t clockRate = SysCtlClockGet();

I then calculate numCycles/clockRate and get 53 seconds as my time, when I can clearly tell that the code is running in less than a second. Am I using SysTick incorrectly/is there a better way to time code on the TM4C123? I need microsecond resolution.

Thanks.


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>