



C-based function performance measurement
by pk21 on Jul 24, 2014 |
pk21
Posts: 1 Joined: Jun 18, 2012 Last seen: Sep 15, 2014 |
||
Hello,
I am trying to measure the number of clock cycles required by one of the functions implemented in my application code (baremetal). I tried to use the tick timer but it doesn't give me the clock cycle utilization by the or1200 processor.
I want to compare SW performance for AES encryption vs. clocks taken by an AES HW coprocessor.
It would be great if anyone could tell me an alternative way/solution to measuring accurate clock cycle requirement or fix the error in my code as below:
_____________________________________________________________________
#include
#include
int main() {
int init = or1k_timer_init(5000);
or1k_timer_enable();
or1k_timer_set_mode(SPR_TTMR_CR);
unsigned long start_tick, end_tick, count = 0;
start_tick = or1k_timer_get_ticks();
//~~Application function inserted here
end_tick = or1k_timer_get_ticks();
count = end_tick - start_tick;
printf("Clock counts = %u\n", count);
return 0;
}
_____________________________________________________________________
|



