02-17-2012 01:52 PM
While debuggin something else, I would watch CPU usage on the charts screen of the driver station. With the gyro in, we were consistantly at 100%. When it was commented out, we dropped back to 80%. However, I had to find this out through trial and error. I commented out different loops in periodic tasks until I found it. Is there an easier way to find the CPU hog rather than trial and error?
Solved! Go to Solution.
02-17-2012 02:02 PM
With just the tools for FRC the best way to is strategically benchmark your code - divide the code in half bench mark each half, divide each part in half again. You can also use this tool:http://sine.ni.com/nips/cds/view/p/lang/en/nid/209041 (there is a 30 day trial)
02-17-2012 02:20 PM
Thanks
02-17-2012 02:40 PM
Another thing to note in all of this debugging is that running the code in interactive mode (with all the front panels updating) takes more resources than running the executable so if you want to do true debugging of how it is going to behave at competition you should do the debug of the compiled executable running on the cRIO. Thats harder to do since you don't have the instant feedback of the sensors but you can do things like write the time the loop is taking to a network shared variable - or broadcast over UDP (sparingly).