USER’S MANUAL__________________________________________________________________
414 _________________________________________________________________ M211322EN-D
D.5.3 Example: Real-Time Interrupt
Histogram
Refer to the source file rvp8main/site/demohist.c, which contains
demonstration code for a real-time callback that prints a histogram
showing the scatter of callback times brought about by Linux scheduling
latencies. First, arrange for this code to be attached to a user major mode
by editing rvp8main/site/mt_user.c:
1. Change the default USER1 major mode init routine to call the demo
histogram:
void mtInitMajorMode_user1( void ) {
initMajorMode_demohist() ; }
2. Include the header file consisting of a single line prototype for the
above function:
#include "demohist.h"
3. Compile, install, and run your changes with:
$ cd /usr/sigmet/src/rda/rvp8main
$ make clean
$ make –j2
$ rvp8 –noDiags
The RVP8 starts up normally.
4. Run the ascope utility and request USER1 major mode from the Gen
Setup menu.
You should see messages printed in the RVP8 startup X-Term
indicating that the major mode has been entered, and that the PROC
section has been initialized:
Beginning PROC section demohist code.
Target scheduling interval is 2.500 ms OR 5 triggers
Will print timing jitter histogram every 10 seconds
The real–time callback handler is now collecting statistics on its interrupt
times, and is scheduled every 2.5 ms or every five triggers, whichever is
fastest. Moreover, a histogram is printed every ten seconds showing the
distribution of times. Some interesting things to try:
- Type a low PRF (~500 Hz) into ascope and verify that the interrupts
cluster around 2.5 ms. Then type a high PRF (~5 KHz) and verify that
histogram peaks at 1 ms.
- While the callback handler is running, make the RVP8 machine busy
in some manner, for example, by running compilers, reading large
files, etc. You should see noticeable scatter of the histogram plot as
other processes compete for CPU scheduling.