This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

profiling on a nrf51422

Hi, have some of you expierence with profiling on a nrf51422? I think what would be nessesary, is at least one high priority timer, to sample the program counter, some kind of channel to get the data out of the µcontroller (ant for example) and something analyse the data off target, like google perftools. In addition it would be very helpfull to get the top of the callstack (just the function backtrace) for analysis of the cumulative cpu usage of some functions.

I wonder if it would be doable in conjuction with a softdevice. Especialy the high priority timer part of idea.

cheers, Torsten

Parents
  • The CrossWorks studio I've been using has something like this. In the absence of a profile/trace on the chip (which the nrf51822 doesn't have) it uses timed sampling to gather information. It's a little crude and you need to run through a load of cycles of your code to really build up a picture, but it works.

    That's external to the device however, it's CrossWorks itself, running on the laptop which is interrogating the debug interface on a constant basis to grab the current PC and then mapping it later. I suspect trying what you suggest there and trying to do it all on-chip isn't going to work too well. The cost of taking the samples, unless you are sampling very rarely, is going to affect the entire timing of the rest of your code to the point I rather doubt your results will be very worthwhile.

    I'd look for something external which uses the debug interface to gather the data off-chip if you can find one, a bit of work for sure but should give you better results.

Reply
  • The CrossWorks studio I've been using has something like this. In the absence of a profile/trace on the chip (which the nrf51822 doesn't have) it uses timed sampling to gather information. It's a little crude and you need to run through a load of cycles of your code to really build up a picture, but it works.

    That's external to the device however, it's CrossWorks itself, running on the laptop which is interrogating the debug interface on a constant basis to grab the current PC and then mapping it later. I suspect trying what you suggest there and trying to do it all on-chip isn't going to work too well. The cost of taking the samples, unless you are sampling very rarely, is going to affect the entire timing of the rest of your code to the point I rather doubt your results will be very worthwhile.

    I'd look for something external which uses the debug interface to gather the data off-chip if you can find one, a bit of work for sure but should give you better results.

Children
  • Taking the PC via JTag seems to be a very good idea. But I think that it will be hard to take the callstack. Maybe it's possible to get relevant portions of the whole stack and to extract the callstack from that of target. I like PC sampling very much, because it's easy to implement and close to non-intrusive if you use a very low sample rate. If you have an application that you can keep under typcal load, you just need more time if you lower the sample rate :-)

Related