Finding Execution time of AVR C (Microcontroller) Code

Status
Not open for further replies.

electrobuz

Member level 2
Joined
May 20, 2013
Messages
46
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Visit site
Activity points
1,638
Hey,
I want to find the clock cycles or time in ms/us for execution of my code that I am running on an AVR Atmega 16. How do I go about finding it? Any help is appreciated.
 

you can use the avr studio simulator to see the execution cycles and execution time.
use a couple of breakpoints to stop the execution in the parts you are interested in
 

I tried using AVR Studio simulator but could'nt figure out where I would see execution cycles and execution time on the simulator. Any resources where I can see where to spot these details?
 

I'm not using AVR simulator, but a few clicks on the internet confirmed my assumption that the respective function is called stop watch, as in other simulators.
 

The dialog that shows the info is on the left side when the simulator is running



The right click includes options to selectively reset stopwatch and cycle counter


Set the debug -> AVR simulator options to the correct core clock frequency to get correct timings from the given cpu cycles
 

The Processor tab on the left side is always showing this (for any code):


It does not show the run time?
Maybe I am not simulating properly? Why is this happening?
 

I don't see the problem, your image shows the same data as mine, the only difference is that you have expanded the registers

 

The Processor tab on the left side is always showing this (for any code):
View attachment 97911

It does not show the run time?
Maybe I am not simulating properly? Why is this happening?
Hi it wont show in Run time but It will show the time IF you break in some place.........
 

Like the stop watch in foot race, you need a start and stop event.

Why don't you play around with the tool a little? I'm sure you'll figure it out.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…