EPICS exampleJava/arrayPerformance

Release 4.1 - 2016.03.14

Abstract

arrayPerformance provides main programs that demonstrate performance of large arrays and can also be used to check for memory leaks. Checking for memory leaks can be accomplished by running the programs with valgrind or some other memory check program.

For more information about EPICS generally, please refer to the home page of the Experimental Physics and Industrial Control System.

Table of Contents


Overview

The programs are:

arrayPerformanceMain
This is server and also a configurable number of longArrayMonitor clients. The clients can use either the local or remote providers. The monitor code is the same code that is used by longArrayMonitorMain.
longArrayMonitorMain
Remote client that monitors the array served by arrayPerformanceMain.
longArrayGetMain
Remote client that uses channelGet to access the array served by arrayPerformanceMain.
longArrayPutMain
Remote client that uses channelPut to access the array served by arrayPerformanceMain.

Each has support for -help.

mrk> pwd
/home/epicsv4/master/exampleJava/arrayPerformance/shell
mrk> ./arrayPerformance -help
recordName size delay providerName nMonitor
default
arrayPerformance 10000000 0.0001 local 1

mrk> ./longArrayMonitor -help
channelName
default
arrayPerformance

mrk> ./longArrayGet -help
channelName iterBetweenCreateChannel iterBetweenCreateChannelGet delayTime
default
arrayPerformance 0 0 1

mrk> ./longArrayPutMain -help
channelName arraySize iterBetweenCreateChannel iterBetweenCreateChannelPut delayTime
default
arrayPerformance 10 0 0 1

mrk> 

Example output

Note: These may fail if run on a platform that does not have sufficient memory,

To see an example just execute the following commands in four different terminal windows:

./arrayPerformanceMain
./longArrayMonitorMain
./longArrayGetMain
./longArrayPutMain

Each program generates a report every second when it has something to report. Examples are:

./arrayPerformanceMain
arrayPerformance 10000000 0.0001 local 1 2 0
...
arrayPerformance value 34 time 1.055 Iterations/sec 10.42654028436019 megaElements/sec 104.26540284360189
 monitors/sec 11 first 35 last 35 changed {1, 2} overrun {} megaElements/sec 103.09278350515464
arrayPerformance value 44 time 1.002 Iterations/sec 9.980039920159681 megaElements/sec 99.80039920159682
 monitors/sec 11 first 46 last 46 changed {1, 2} overrun {} megaElements/sec 101.75763182238668
arrayPerformance value 56 time 1.088 Iterations/sec 11.029411764705882 megaElements/sec 110.29411764705881
 monitors/sec 12 first 58 last 58 changed {1, 2} overrun {} megaElements/sec 113.42155009451794
arrayPerformance value 67 time 1.037 Iterations/sec 10.607521697203472 megaElements/sec 106.07521697203472
 monitors/sec 11 first 69 last 69 changed {1, 2} overrun {} megaElements/sec 102.1355617455896
arrayPerformance value 79 time 1.035 Iterations/sec 11.594202898550726 megaElements/sec 115.94202898550725
 monitors/sec 13 first 82 last 82 changed {1, 2} overrun {} megaElements/sec 124.52107279693486
arrayPerformance value 93 time 1.025 Iterations/sec 13.658536585365855 megaElements/sec 136.58536585365854
 monitors/sec 14 first 96 last 96 changed {1, 2} overrun {} megaElements/sec 138.6138613861386
...
./longArrayMonitorMain
longArrayMonitorMain arrayPerformance 2 0
...

 monitors/sec 3 first 176 last 176 changed {1, 2} overrun {1, 2} megaElements/sec 25.10460251046025
 monitors/sec 4 first 190 last 190 changed {1, 2} overrun {1, 2} megaElements/sec 29.940119760479043
 monitors/sec 4 first 203 last 203 changed {1, 2} overrun {1, 2} megaElements/sec 31.746031746031747
 monitors/sec 3 first 213 last 213 changed {1, 2} overrun {1, 2} megaElements/sec 22.900763358778626
 monitors/sec 3 first 224 last 224 changed {1, 2} overrun {1, 2} megaElements/sec 27.598896044158234
 monitors/sec 4 first 236 last 236 changed {1, 2} overrun {1, 2} megaElements/sec 31.08003108003108
 monitors/sec 3 first 246 last 246 changed {1, 2} overrun {1, 2} megaElements/sec 28.90173410404624
...
./longArrayPutMain
longArrayPutMain arrayPerformance 10 0 0 1
...
put numChannelPut 0 Elements/sec 79.8819
put numChannelPut 1  Elements/sec 79.8598
...
./longArrayGetMain
longArrayGetMain arrayPerformance 0 0 1
...
get kiloElements/sec 7384.61
get kiloElements/sec 8726.34
...

arrayPerformance

The arguments for arrayPerforamanceMain are:

recordName
The name for the arrayPerform record.
size
The size for the long array of the value field.
delay
The time in seconds to sleep after each iteration.
providerName
The name of the channel provider for the longArrayMonitors created by the main program. This must be either local or pva.
nMonitor
The number of longArrayMonitors to create.

arrayPerformance creates a PVRecord that has the structure:.

recordName
    long[] value
    timeStamp timeStamp
    alarm alarm
Thus it holds an array of 64 bit integers.

arrayPerformance creates a separate thread that runs until stop is called. arrayPerformance does the following:

report
Once a second it produces a report. In the above example output each line starting with ArrayPerformance is an arrayPerformance report.
create array
A new array is created and each element is set equal to the iteration count.
lock
The arrayPerformance record is locked.
Begin group put
beginGroupReport is called.
pvValue.put
The value field of the record is replaced with newly created data.
process
The record is then processed. This causes the timeStamp to be set to the current time.
End group put
endGroupPut is called.
unlock
The arrayPerformance record is unlocked.
delay
If delay is greater than zero epicsThreadSleep is called.

longArrayMonitor

This is a pvAccess client that monitors an arrayPerformance record. It generates a report every second showing how many elements has received. For every monitor it also checks that the number of elements is >0 and the the first element equals the last element. It reports an error if either of these conditions is not true.

The arguments for longArrayMonitorMain are:

channelName
The name for the arrayPerform record.

longArrayGet

This is a pvAccess client that uses channelGet to access an arrayPerformance record. Every second it produces a report.

The arguments for longArrayGetMain are:

channelName
The name for the arrayPerform record.
iterBetweenCreateChannel
The number of iterations between destroying and recreating the channel. A value of 0 means never destroy and recreate.
iterBetweenCreateChannelGet
The number of iterations between destroying and recreating the channelGet. A value of 0 means never destroy and recreate.
delayTime
The time to delay between gets.

longArrayPut

This is a pvAccess client that uses channelPut to access an arrayPerformance record. Every second it produces a report.

The arguments for longArrayPutMain are:

channelName
The name for the arrayPerform record.
arraySize
The capacity and length of the array to put to the server.
iterBetweenCreateChannel
The number of iterations between destroying and recreating the channel. A value of 0 means never destroy and recreate.
iterBetweenCreateChannelPut
The number of iterations between destroying and recreating the channelPut. A value of 0 means never destroy and recreate.
delayTime
The time to delay between gets.