CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

How to check how long code takes to run?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jseidmann



Joined: 04 Nov 2004
Posts: 67

View user's profile Send private message Send e-mail

How to check how long code takes to run?
PostPosted: Fri Jan 07, 2005 4:25 pm     Reply with quote

Hi, I wanted to know what ways there are to find out how long a section of code will take to run. I have an EEPROM connected and can store that time value in it to access later on. Is there a command that can store the time delayed between two points? What means have all of you used to see how long your code takes to execute some portion?

Jon
NikkiC



Joined: 21 Jun 2004
Posts: 3
Location: London, UK

View user's profile Send private message

PostPosted: Fri Jan 07, 2005 5:25 pm     Reply with quote

Three ways: using an oscilloscope, using the simulator in MPLAB or simply counting the number of clock cycles required to execute any chunk of code.

Nikki
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jan 07, 2005 5:28 pm     Reply with quote

See this post:
http://www.ccsinfo.com/forum/viewtopic.php?t=20463
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Sat Jan 08, 2005 10:49 pm     Reply with quote

Set up a timer interrupt. Count the interrupts in the ISR. Sample the counter before and after the code of interest executes (assumption: code of interest is not inside another ISR). Calculate the difference of the counter and store it in the EEPROM.

Nick
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group