On Fri, Jan 6, 2012 at 12:08 PM, Mark Rages <markra...@gmail.com> wrote:
> Hi,
>
> I have a moderately complex algorithm implemented on the MSP430.
>
> Since profiling is the first step towards optimization, I would like
> to measure the timing of this algorithm in instruction cycles using
> free software.  I have looked around before and gotten answers like
> "msp430-gdb has a simulator" but not actually seen an example of how
> it might be used to count instruction cycles.
>
> Has anyone done this before?  I would especially appreciate seeing a
> script or Makefile rule as an example of this.

It's probably possible to get this information from a simulator (mspdebug,
or mspsim; google for refs), but the simplest solution would be to
configure a timer to use SMCLK with the divisors set so it counts MCLK
ticks, and read the timer counter before and after the algorithm executes.

The test430 
infrastructure<https://sourceforge.net/projects/mspgcc/files/test430/>includes
this feature for most of its supported platforms, though only to
16-bit counter resolution: more than that would require an interrupt
handler to count rollovers.  A basic cycle timer example is in
tests/sanity<http://mspgcc.git.sourceforge.net/git/gitweb.cgi?p=mspgcc/test430;a=blob;f=tests/sanity/test.c;h=643ae58a08da3c692927f284668525fa2038352e;hb=HEAD>.
An example of counter rollover tracking is in the
freqcount<http://mspgcc.git.sourceforge.net/git/gitweb.cgi?p=mspgcc/test430;a=blob;f=demos/launchpad/freqcount/test.c;h=d9190559d0d8a1befaf5f773732112426870a1cb;hb=HEAD>demo
for the launchpad.

Of course, if you can't run the algorithm without using all available
timers on the MCU, you're back to having to find a simulator.

Peter

>
> Regards,
> Mark
> markrages@gmail
>
>
------------------------------------------------------------------------------
> Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
> infrastructure or vast IT resources to deliver seamless, secure access to
> virtual desktops. With this all-in-one solution, easily deploy virtual
> desktops for less than the cost of PCs and save 60% on VDI infrastructure
> costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
> _______________________________________________
> Mspgcc-users mailing list
> Mspgcc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to