Hello! I am using an Arduino Due. I wanted to know how I can go about collecting hardware performance counters. I mainly work on linux-based systems, so I typically use the "perf stat" command. I've done this on Raspberry Pi, but this is my first time trying to collect HPCs from an Arduino. I haven't been able to find much information on this. Does the Due even support HPCs (ex. branch-misses, instructions, cache-misses etc.)?
Is there even a way to call perf? In the PI, we had a terminal. In arduino, I tried using system() and passing in the perf stat command, but I later found out system() isn't supported.
No. You are missing the distinction between a microcomputer and a micro controller. An Arduino is a micro controller, it doesn't have the things you're looking for.
The arduino due processor does include some hardware (Debug, watchdog, and trace unit, and the instrumentation and trace macro cell - DWT and ITM) for some of this, but I’ve never seen software that does anything with them, and they’re not even turned on by default. See the arm v7m architecture reference manual.
Many of the info tracked isn’t relevant to a cm3 processor - for example, there is no branch prediction, so there is no branch miss counter. Similarly, there isn’t traditional cache...
My Arduino performance counter is a per-second loop counter in non-blocking code. It fits the simplicity of the board.
It tells me how responsive my sketch -can- be and when an added task reduces the count much I know to chop that task into smaller steps.
One major like I have about Arduino is not having an OS in my way. I have to write my own bugs and once I fix them there are no more.
I looked up Linux on Arduino and found a thread from 2012-13 pretty much saying NO. If it takes 5 hours before login, it's a waste. https://forum.arduino.cc/index.php?topic=139912.0
Please please please please DO NOT REPLY TO THAT THREAD! It will zombie the thread, a bad thing on the forum.
Since then PJRC came out with the Teensy 4.1 (a killer Frankenduino) that can have 16MB external RAM added. https://www.pjrc.com/store/teensy41.html
And still I don't see any thing about a Linux project for it.