Guest
Clifford Heath <no.spam@please.net> wrote in
news:8O7lG.17$cJ2.2@fx47.iad:
Close but no cigar!
<https://www.youtube.com/watch?v=4XV8dlFwNd0>
news:8O7lG.17$cJ2.2@fx47.iad:
On 14/4/20 10:34 am, John Larkin wrote:
On Tue, 14 Apr 2020 10:03:18 +1000, Clifford Heath
no.spam@please.net> wrote:
On 14/4/20 5:26 am, John Larkin wrote:
On Mon, 13 Apr 2020 12:13:35 +1000, Clifford Heath
no.spam@please.net> wrote:
On 13/4/20 12:07 pm, jlarkin@highlandsniptechnology.com wrote:
On Mon, 13 Apr 2020 09:33:14 +1000, Clifford Heath
I should drag out tprof again, it still fills a need that's
substantially un-met by existing tools. It also contained a
dynamic memory profiling mode that was useful.
Sometimes we raise a port pin at the entry of a chunk of code
and drop it at the end, and look at that with an
oscilloscope. A routine can be optimized for worst-case
execution time, which usually matters more than average. A
little thinking can sometimes reduce worst-case by 5:1.
One port pin can be made to blip or change state at several
places in a segment of code. That can look cool on infinite
persistance.
Great way to look at exactly one thing at a time, and quite
unlike what a proper profiler does.
I have histogrammed the program counter. That can be a
revelation. See what's hogging the resources.
That's a trivial profiler, and comes built-in to Linux tools,
always has (since 1976 at least). It tells you nothing about
context switch or interrupt latencies though, because it only
samples during the program's assigned timeslots i.e. while
it's running.
CH
Nobody has guessed about the Linux timeouts I measured. Nobody
has estimated a reasonable IRQ rate for my tiny ARM. An
oscilloscope is good enough for things like that.
Sure! If it works for you, that's great.
On a running Linux system with normal desktop peripherals, there
is a great variety of different kinds of things going on. In the
histogram of latencies, it's very instructive to see the
different spikes for different interrupts (and try to identify
which is which), and to see the variance for each spike. Kind-of
a top-down view, which would augment your bottom-up one.
CH
We were interested in how long and how often a tight application
loop might be suspended by the OS and drivers and stuff. Would a
profiler tell you that?
Exactly, that's what the histogram is. Put the contents of your
inner loop (or some fixed number of repetitions) in a profiled
function (called from the loop), and the shortest elapsed-time
spike is how long it takes to run if it's not interrupted. All
longer spikes are interrupts or one sort or another. You can see
how long each is, count how many, and see the variability in each
interrupt time (based on the width of the spike).
You do need a CPU with a fine-grained timer you can quickly read,
and you need to ensure that your inner-loop function runs for
significantly longer than the profiler overhead of doing that.
In a Zynq sort of chip, one bailout is to move "code" from the
ARM cpu's into FPGA fabric. I'm often shocked by what people can
implement in VHDL.
I wish I had time and energy to get started with the Zynq, it's
such a nice way of doing things. Someone should do an "Arduino,
but for Zynq".
CH.
Close but no cigar!
<https://www.youtube.com/watch?v=4XV8dlFwNd0>