Example: test execution speed of several methods to toggle a GPIO pin. More...
Go to the source code of this file.
Functions | |
def | performance.FREQ (_N_) |
Macro to measure the frequency and compute statistics. | |
def | performance.DIRECT (_O_) |
Macro to set output pin by fast direct PRU command (no error checking). | |
Variables | |
performance.C_IN = P9_42 | |
The pin to use for CAP input. | |
performance.GOUT = P8_16 | |
The pin to use for GPIO output. | |
performance.G_IN = P8_14 | |
The pin to use for GPIO input. | |
list | performance.desc |
Test descriptions. More... | |
performance.f0 = c_float(0.) | |
The current measurement result. | |
list | performance.nf = [100e6,100e6,100e6,100e6,100e6,100e6,100e6] |
Array for minimal frequency (initialized high) | |
list | performance.sf = [0.,0.,0.,0.,0.,0.,0.] |
Array for frequency. | |
list | performance.xf = [0.,0.,0.,0.,0.,0.,0.] |
Array for maximal frequency. | |
performance.r0 = c_ubyte(0) | |
Input Gpio. | |
performance.r1 = c_ubyte(0) | |
Output Gpio. | |
performance.m0 = c_ulong(0) | |
Input bit mask. | |
performance.m1 = c_ulong(0) | |
Output bit mask. | |
performance.ad = c_ulong(0) | |
Adress of GPIO subsystem. | |
performance.oe = c_ulong(0) | |
Adress of Output Enable register in GPIO subsystem. | |
performance.cd = c_ulong(0) | |
Adress of Clear Data register in GPIO subsystem. | |
performance.sd = c_ulong(0) | |
Adress of Set Date register in GPIO subsystem. | |
performance.io = pruio_new(PRUIO_DEF_ACTIVE, 4, 0x98, 0) | |
Create a ctypes pointer to the pruio structure. | |
performance.IO = io.contents | |
The pointer dereferencing, using contents member. | |
Example: test execution speed of several methods to toggle a GPIO pin.
This file contains an example on measuring the execution speed of different controllers that toggles a GPIO output. It measures the frequency of the toggled output from open and closed loop controllers and computes their mimimum, avarage and maximum execution speed. Find a functional description in section performance.
The code performs 50 tests of each controller version and outputs the toggling frequencies in Hz at the end. The controllers are classified by
Licence: GPLv3, Copyright 2017-2023 by Thomas{ doT ]Freiherr[ At ]gmx[ DoT }net
Run by: python performance.py
Definition in file performance.py.
list performance.desc |