I'm trying to get the nearest to real-time processing I can with a Raspbian distribution on a Raspberry Pi for manipulating its GPIO pins. I want to get a "feel" for the kind of performance I can expect.
I was going to do this by writing a simple C program that toggles a pin repeatedly as fast as possible, and monitoring it with a logic analyser.
But perhaps there's another way, by writing the above program but simply logging context switches to see exactly when that thread/process has control over a sample period of say a couple of seconds.
This previous question answers how to see how many context switches are made in some period of time for a given process, but is there a way of logging the precise timing of switches, and perhaps for every process, not just one? Obviously this would create overhead, but could still be useful. Obviously the data should be stored in RAM to minimise overhead
Note to self: possible solutions:
- Command to list in real time all the actions of a process
- Hacky: make the program repeatedly get and store the current time (and save it to a file once the log reaches a certain limit). Or, a slight improvement to avoid enormous logs: use an algorithm that eliminates consecutive times if they are close enough together that it can be deduced they were not pre-empted by some other process.