Calculating Function Time in LPCXpresso IDE

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Calculating Function Time in LPCXpresso IDE

1,833 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by shilpa on Sun Feb 26 12:36:24 MST 2012
I am using LPC1769 LPCXpresso board

the link to the board is given here [http://www.embeddedartists.com/products/lpcxpresso/lpc1769_xpr.php]

can anyone tell me hoe to calculate the function time (in cycles/second) on the LPCXpresso IDE?

thanks in advance.
0 Kudos
Reply
5 Replies

1,567 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Mon Feb 27 14:56:55 MST 2012

Quote: ArneB

There are two special clock cycle registers in the Core Registers View.


and if I remember well these are registers can not be read by the Arm processor - they are only available to the debugger.
but indeed, if all you want to know is the amount of clock cycles that took place between two breakpoints then this is the easiest way to go.

Thanks for reminding me.

Rob
0 Kudos
Reply

1,567 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ArneB on Mon Feb 27 10:38:55 MST 2012
It is even easier:
http://knowledgebase.nxp.com/showthread.php?t=395

There are two special clock cycle registers in the Core Registers View which can be used to calculate the processing time (unfortunately only for the Cortex M3 / M4 processors...).
0 Kudos
Reply

1,567 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Mon Feb 27 09:32:56 MST 2012
Angelo is on the right track here.
There is no way you will be able to calculate the execution time using a disassembly of the code: there are too many variables concerning memory timing, and IP access timing.

Just program a timer to count CPU cycles (systick is always counting in CPU clock cycles so that might be a good source). I have described something like this for the lpc2106 some years ago ([U]link[/U]).
I used both the timer method and the oscilloscope/logic analyzer (setting a GPIO pin) to measure timing in my programs.

Alternatively, if you use an OS like FreeRTOS, there are some ways to measure CPU load also.

Regards,
[INDENT]Rob
[/INDENT]
0 Kudos
Reply

1,567 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Polux rsv on Mon Feb 27 07:00:27 MST 2012

Quote: shilpa

can anyone tell me hoe to calculate the function time (in cycles/second) on the LPCXpresso IDE?



What do you try to measure? execution time? You could setup a timer and read its TC before and after the execution of your function. but remember, execution time could vary depending on the optimisation setup for the compiler.

Angelo
0 Kudos
Reply

1,567 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dima2611 on Sun Feb 26 16:17:26 MST 2012
If there are not much loops in this function, the disassembler is your firend.
0 Kudos
Reply