EXAMPLES

Throughput

1) Description

The Throughput example allows the measurement of data throughput when receiving samples from a publisher.

2) Design

It consists of 2 units :

3) Scenario

The publisher sends samples and allows you to specify a payload size in bytes as well as allowing you to specify whether to send data in bursts. The publisher will continue to send data forever unless a time out is specified.

Configurable:

The subscriber will receive data and output the total amount received and the data rate in bytes per second. It will also indicate if any samples were received out of order. A maximum number of cycles can be specified and once this has been reached the subscriber will terminate and output totals and averages.

The subscriber executable measures:

Configurable:

Running of examples

Running the examples in a Posix environment

Environment Setup

Let's call OpenSplice_install_dir the OpenSplice installation directory.

The OpenSplice environment variables must be set in order for the examples to build/run correctly. To do this, open a terminal and source the "OpenSplice_install_dir/release.com" script supplied with the distribution.

C, C99 and ISO C++ 2 Executables

Building the examples is described on the Summary page

Two executables are generated in the example build/bin directory when the example is built:

For ISO C++ 2

For C99

For C

Java5 executables

Building the examples is described on the Summary page

Two jars are generated in the example directory when the example is built:

For Java5

Running the example

Ensure that the environment for OpenSplice is set up correctly as described above for each new terminal used.

It is recommended that you run the subscriber and publisher in separate terminals to avoid mixing the output

Running in single process (heap memory) configuration : the application starts OpenSplice middleware

Running in multiple process shared memory configuration

To enable deployment in this mode, an OpenSplice configuration file must be selected that has shared memory support e.g. one of the ospl_shmem xml configuration files found in the OpenSplice_install_dir/etc/config directory.

Starting the publisher and subscriber

    Example publisher usage (parameters must be supplied in order):
      ./c_Throughput_pub [payloadSize (bytes)] [burstInterval (ms)] [burstSize (samples)] [timeOut (seconds)] [partitionName]
    defaults:
      ./c_Throughput_pub 8192 0 1 0 "Throughput example"
    
    Example subscriber usage:
      ./c_Throughput_sub [maxCycles (0 = infinite)] [pollingDelay (ms, 0 = event based)] [partitionName]
    defaults:
      ./c_Throughput_sub 0 0 "Throughput example"
    

To achieve optimal performance it is recommended to set the CPU affinity so that the publisher and subscriber run on separate CPU cores. You must have su privileges to run the following commands.

    publisher usage:
      taskset -c 0 chrt -f 80 ./c_Throughput_pub [payloadSize (bytes)] [burstInterval (ms)] [burstSize (samples)] [timeOut (seconds)] [partitionName]
    subscriber usage:
      taskset -c 1 chrt -f 80 ./c_Throughput_sub [maxCycles (0 = infinite)] [pollingDelay (ms, 0 = event based)] [partitionName]
    

Running C/C99/ISO C++ 2/Java5 on Windows

Environment Setup

Let's call OpenSplice_install_dir the OpenSplice installation directory.

The OpenSplice environment variables must be set in order for the examples to run correctly. To do this open an OpenSplice Command Prompt which will set up the environment variables for OpenSplice automatically. The OpenSplice Command Prompt can be selected from the start menu. Alternatively, open a windows Command Prompt and execute the "OpenSplice_install_dir\release.bat" batch script supplied with the distribution.

C/C++/ISO C++ 2

Building the examples is described on the Summary page

Two executables are generated in the example build/bin directory when the example is built:

For C

For C99

For ISO C++ 2

Java5 executables

Building the examples is described on the Summary page

Two jars are generated in the example directory when the example is built:

For Java5

Running the C/C99/ISO C++ 2 Examples

Ensure that the environment for OpenSplice is set up correctly as described above for each new command prompt used.

The following steps describe how to run the examples:

Running in single process (heap memory) configuration : the application starts OpenSplice middleware

Running in multiple process shared memory configuration

To enable deployment in this mode, an OpenSplice configuration file must be selected that has shared memory support e.g. one of the ospl_shmem xml configuration files found in the OpenSplice_install_dir\etc\config directory.

Starting the publisher and subscriber

    Example publisher usage (parameters must be supplied in order):
      c_Throughput_pub.exe [payloadSize (bytes)] [burstInterval (ms)] [burstSize (samples)] [timeOut (seconds)] [partitionName]
    defaults:
      c_Throughput_pub.exe 8192 0 1 0 "Throughput example"
    
    Example subscriber usage:
      c_Throughput_sub.exe [maxCycles (0 = infinite)] [pollingDelay (ms, 0 = event based)] [partitionName]
    defaults:
      c_Throughput_sub.exe 0 0 "Throughput example"
    

To achieve optimal performance it is recommended to set the CPU affinity so that the publisher and subscriber run on separate CPU cores

    publisher usage:
      START /affinity 1 /high cmd /k "c_Throughput_pub.exe" [payloadSize (bytes)] [burstInterval (ms)] [burstSize (samples)] [timeOut (seconds)] [partitionName]
    subscriber usage:
      START /affinity 2 /high cmd /k "c_Throughput_sub.exe" [maxCycles (0 = infinite)] [pollingDelay (ms, 0 = event based)] [partitionName]
    

Running of examples with default values

There is a binary executable in examples/dcps/PerfomanceScripts which aims to run the selected ping and pong executables without prior configuration or command line arguments.

The executable by default will -

The executable requires -

Its also recommended that for best results the benchmark is run on a shared memory multiple process configuration.

The Throughput executable provides several command line options to manipulate the ping and pong processes, a short description of each is provided in the executable options -

# Throughput --help

Some common examples -