Commit 0bcfce8f authored by chensong's avatar chensong Committed by Jan Kiszka

testsuite: App of gpio loopback/react benchmark

This a tool to benchmark the latency of GPIO driver,
it's able to run 2 kinds of benchmark test:

1, loopback mode
1) apply 2 gpio pins by calling service in gpio RTDM driver
   like gpio-bcm2835 and gpio-core.c, one is as output,
   the other is as interrupt
2) call write_rt to send a pulse from output
3) call read_rt to get timestamps recorded in driver (inner loop)
4) also record timespace in user space(outer_loop)
   outer_loop is inner_loop plus overhead of event wakeup
5) ftrace enable/disable

2, react mode
1) apply 2 gpio pins by calling service in gpio RTDM driver
   like gpio-bcm2835 and gpio-core.c, one is as ourput,
   the other is as interrupt
2) call read_rt to wait for a pulse from latency box
3) call write_rt to send a signal back to latency box
   as a reaction
4) latency box calculates the diff and makes the histogram

e.g.:
1) react mode:
   gpiobench -o 20 -i 21 -c pinctrl-bcm2835 -m 1 -l 1000
2) loopback mode:
   gpiobench -o 20 -i 21 -c pinctrl-bcm2835 -m 0 -l 1000 -h 100 -b 50

CC: Jan Kiszka <jan.kiszka@siemens.com>
CC: Greg Gallagher <greg@embeddedgreg.com>
Signed-off-by: default avatarchensong <chensong@tj.kylinos.cn>
[Jan: fixed time delta calculation and output for 32-bit targets]
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 3d314bea
......@@ -939,6 +939,7 @@ AC_CONFIG_FILES([ \
testsuite/latency/Makefile \
testsuite/switchtest/Makefile \
testsuite/gpiotest/Makefile \
testsuite/gpiobench/Makefile \
testsuite/spitest/Makefile \
testsuite/smokey/Makefile \
testsuite/smokey/arith/Makefile \
......
// ** The above line should force tbl to be a preprocessor **
// Man page for gpiobench
//
// Copyright (C) 2020 song chen <chensong@tj.kylinos.cn>
//
// You may distribute under the terms of the GNU General Public
// License as specified in the file COPYING that comes with the
// Xenomai distribution.
//
//
GPIOBENCH(1)
==========
:doctype: manpage
:revdate: 2020/08/03
:man source: Xenomai
:man version: {xenover}
:man manual: Xenomai Manual
NAME
-----
gpiobench - Xenomai gpio latency benchmark
SYNOPSIS
---------
// The general command line
*gpiobench* [ options ]
DESCRIPTION
------------
*gpiobench* is part of the Xenomai test suite. It is a gpio latency
benchmark program. The system must run a suitable Xenomai enabled kernel with
the respective module (xeno_timerbench).
OPTIONS
--------
*gpiobench* accepts the following options:
*-h <histogram-size>*::
default = 100, increase if your last bucket is full
*-l <num-of-loops>*::
default=1000, number of loops to run the test
*-q <quiet>*::
print only a summary on exit
*-m <test-mode>*::
0 = loopback (default), 1 = react
*-c <pin-controller>*::
name of pin controller
*-o <output-pin>*::
number of gpio pin as output
*-i <interrupt-pin>*::
number of gpin pin as interrupt
*-p <priority>*::
default = 99, task priority
*-b <bracktrace>*::
default = 1000, send break trace command when latency > breaktrace
AUTHOR
-------
*gpiobench* was written by song chen. This man page
was written by song chen.
SUBDIRS = latency smokey
SUBDIRS = latency smokey gpiobench
if XENO_COBALT
SUBDIRS += \
......@@ -13,6 +13,7 @@ endif
DIST_SUBDIRS = \
clocktest \
gpiotest \
gpiobench \
latency \
smokey \
spitest \
......
testdir = @XENO_TEST_DIR@
CCLD = $(top_srcdir)/scripts/wrap-link.sh $(CC)
test_PROGRAMS = gpiobench
gpiobench_SOURCES = gpiobench.c
gpiobench_CPPFLAGS = \
$(XENO_USER_CFLAGS) \
-I$(top_srcdir)/include
gpiobench_LDFLAGS = @XENO_AUTOINIT_LDFLAGS@ $(XENO_POSIX_WRAPPERS)
gpiobench_LDADD = \
@XENO_CORE_LDADD@ \
@XENO_USER_LDADD@ \
-lpthread -lrt -lm
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment