New CPU profiling tool
Jeffrey Lee (213) 6048 posts |
For the past couple of days I’ve been playing around with some code I’ve written that uses a custom FIQ handler to sample the CPU state every time one of the HAL timers generates an interrupt. This has resulted in two tools – FIQProf and profanal – which can both be downloaded from my site here A few notes:
So far I’ve used it to determine that the long delay when starting the WIMP on the beagleboard is due to almost all the CPU time being spent flushing the caches due to dynamic areas being resized – which either means there’s a bug or some serious optimisation is needed! Hopefully we can also use this tool to help track down exactly what’s going on with the poor performance of USB mass storage. |
Alan Robertson (52) 420 posts |
who let you out of the basement? Get back down there and carry on with your coding. ;) All well over my head unfortunately, but certainly sounds impressive – and more importantly very useful for the future. |
Ben Avison (25) 445 posts |
In IOMD, the assignment of each given interrupt as an IRQ or FIQ is fixed, so no you won’t be able to support IOMD with this scheme. |
Theo Markettos (89) 919 posts |
I suppose it might just be possible to abuse the floppy controller into generating a FIQ (after a timeout, say), though it probably wouldn’t be too accurate. Otherwise, if you really want to do this, a little bit of podule hardware would be required. It probably only needs 1-3 chips if you design it carefully (and take liberties with the podule specification ;-) |
Jeffrey Lee (213) 6048 posts |
I’ve now released a new version with fixed GPA handling, and added a page to my website where all future releases will be announced: http://www.phlamethrower.co.uk/riscos/fiqprof.php |
Jeffrey Lee (213) 6048 posts |
For anyone taking notes, I’ve just released a new version, which supports the sampling of the IOP & Cortex-A8 performance counters. Admittedly I’m not sure just how useful this new feature will be, but at least it’s there now just in case. |
Jeffrey Lee (213) 6048 posts |
It’s finally time for another new version. This fixes some (years-old) bugs and compatibility issues, allowing FIQProf to once again run correctly on current ROMs (assuming they support routing timer interrupts to FIQ – i.e. Iyonix, OMAP3 and iMx6. Pi also works in theory, but I believe it clashes with DWCDriver’s use of FIQs). profanal now also has a ‘hist’ command for plotting a histogram. http://www.phlamethrower.co.uk/riscos/fiqprof.php The next release is likely to remove support for the performance counters, since there’s now a better tool for those (I was thinking about removing them for this release, until I saw that I’d actually prepared this new FIQProf release back in February but had neglected to upload it) |
Michael Drake (88) 336 posts |
Out of interest, did anything come of that? And has it been used to uncover anything else? |
Jeffrey Lee (213) 6048 posts |
Hopefully we can also use this tool to help track down exactly what’s going on with the poor performance of USB mass storage. Yes. Using profanal to look at the timeline made it easy to spot that there were regular bursts of CPU activity followed by (relatively) long stretches of inactivity. Conclusion: we had poor performance because SCSISoftUSB was scheduling all the USB transfers using TickerV, and the transfers were too small to max out the bandwidth of USB2. https://www.riscosopen.org/forum/forums/5/topics/253
Other things I can remember using it for:
I also use profanal a lot just for it’s ability to do an addr2line lookup for ROM images (it can load the symbol files from a ROM build tree) |
Michael Drake (88) 336 posts |
Thanks, those were interesting! Looks like the USB performance issues were fixed, and the network one is still open. |