Hi, The project i'm currently working on is essentially trying to make a synth, 4-operator FM with 2 IIR filters and a ADSR volume envelope, all triggered by MIDI messages.
My question is if there are any tools I can use to see which parts of my program are taking the most time.
I was able to get the FM synth, filters and ADSR working but when I finally added in the MIDI support I ran into the following error
CPU PID MSW CSW XSC PF STAT %CPU NAME
0 0 0 889246 0 0 00018000 90.2 [ROOT]
0 14802 17 18 37 0 000600c0 0.0 Timbre_Explorer
0 14810 2 3 4 0 000480c0 0.0 bela-midiIn_hw:1,0,0
0 14811 1 1 2 0 000600c0 0.0 WSServer_5555
0 14812 1 1 2 0 000600c0 0.0 WSClient_gui_data
0 14813 1 1 2 0 000600c0 0.0 WSClient_gui_control
0 14814 1 9752 9754 0 00048046 8.8 bela-audio
0 0 0 1983721 0 0 00000000 0.3 [IRQ16: [timer]]
0 0 0 4883 0 0 00000000 0.5 [IRQ180: rtdm_pruss_irq_irq]
Xenomai/cobalt: watchdog triggered
Makefile:581: recipe for target 'runide' failed
CPU time limit exceeded
make: *** [runide] Error 152
I saw on a previous post: https://forum.bela.io/d/458-runide-error-152-cpu-time-limit-exceeded-and-skipping-sigmund that this is triggered by render taking too long or an infinite loop, but I was able to get all the parts of my code working in various combinations (commenting out other parts to lower the time) so I'm reasonably sure this just an issue of my code taking too long.
I also found this tutorial on measuring cpu cycles, but it was some time ago so I wasn't sure if there's a better alternative/if it still works.
https://forum.bela.io/d/362-measuring-cpu-cycles
Any general suggestions/resources on how to write more efficient C++ would also be welcome. I've been trying to keep all my operations to either multiplications/adds and running pre-calculations in setups and initializations where possible. I'm also considering trying to use Auxiliary Tasks. If anyone's interested I could post the code, but currently the project is spread across 9 class files (and their headers) in addition to render, so it's a lot to go through.