How can I profile code when running on RaspBerry Pi (Linux ARM32)?
I’ve profiled the code on my Mac in the IDE and worked on isolating where the CPU is spending a lot of time, but those fixes don’t lower the CPU% on the Raspberry Pi. Yes, I understand that the Mac is a bit more powerful than the Pi, but this app is doing very light work so I’m trying to determine if it’s my code or possibly something with the Xojo framework on the Pi that I need to help isolate and file a bug report on.
I was hoping that compiling with Profile Code would create a binary for Arm32 that would include the profile code file when exiting, or when running remotely, but no luck.
Any suggestions on how to profile code when running on the Pi?
I ended up creating a timer to do the quit of the app that then correctly creates the Profile.txt file. Manually quitting the app with Control+Q doesn’t work because the CPU is that busy. Now I need to dive into the profile.txt file …
I’ve narrowed it down to the Xojo provided ‘Task’ class (subclassed from Thread) that is in the ‘UIThreadingWithTask.xojo_binary_project’ example project with Xojo 2017r3. I use this class in my app and the profile report shows that this class is the one that is taking a lot of the CPU time.
The example app maxes out the CPU to 100% when running on Raspberry Pi with “Linux Raspbian GNU/Linux 8 (jessie)”.
I’ve not yet dived in further to figure out where I can throttle the class with the internal timer or thread properties. It’s a complicated class so if anyone has any suggestions on it I’d greatly appreciate it.
Case filed on this issue: feedback://showreport?report_id=51062
What are the priority and stack size properties on the thread? If you lesson the priority does it get better?
So youre using threads. Does it yield time back to the main thread with the Thread.Sleep method at all?
Thanks for the help guys, much appreciated.
I’ve changed the thread priority and added .sleep(1000, false) and they have not helped.
The keyboard blocking issue was my own stupidity - I had a debug window that had the focus and was not passing on the keystrokes.
But the ‘UIThreadingWithTask.xojo_binary_project’ still pegs 1 of the 4 cores on the Raspberry Pi even when I added sleeps to the busy wait loop and lowered the priority on the thread. Maybe this is the nature of the beast on RPi?