Skip to content

Commit

Permalink
Update readme with new scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
rjwills28 committed Dec 15, 2023
1 parent 403c57f commit 09e17bb
Showing 1 changed file with 35 additions and 17 deletions.
52 changes: 35 additions & 17 deletions performance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,29 +64,39 @@ If running these performance tests against PVWS, some of the default settings of
export PV_ARRAY_THROTTLE_MS=10
export EPICS_CA_MAX_ARRAY_BYTES=10000000

### Python venv
To run the Python scripts, first create a virtual environment and pip install the dependencies:

python -m venv venv
source venv/bin/activate

pip install numpy aioca asyncio py-graphql-client websockets

## Performance tests

### Single screen
Two scripts can be used to create a DB file with _N_ EPICS PVs updating at a given rate and an OPI screen displaying _N_ PVs:
A script can be used to create a DB file with _N_ EPICS PVs updating at a given rate and another can be used to create an OPI or BOB screen displaying _N_ PVs:

./create_db.sh -n <number-of-pvs> -r <rate>
./create_opi.sh -n <number-of-pvs>
./create_bob.sh -n <number-of-pvs>

The EPICS db can then be run with:

softIoc -d performanceTestDb.db

The generated OPI file and associated JSON file are created under public. These must be moved to the build directory if using the `serve` command above to run the app. E.g.
The generated OPI/BOB file and associated JSON file are created under public. These must be moved to the build directory if using the `serve` command above to run the app. E.g.

cp public/performance* build/


### Multiple screens
The `.create_opi.sh` script can be used to create _M_ screens displaying _N_ PVs using the `-s` option:
The `.create_opi.sh` and `/create_bob.sh` scripts can be used to create _M_ screens displaying _N_ PVs using the `-s` option:

./create_opi.sh -n <number-of-pvs> -s <number-of-screens>
./create_bob.sh -n <number-of-pvs> -s <number-of-screens>

These will be created under public/performanceTestPageXX.opi and public/performancePageXX.json (the first file will have no index).
These will be created under public/performanceTestPageXX.opi or public/performanceTestPageXX.bob and public/performancePageXX.json (the first file will have no index).

Remember to adjust the number of PVs in the DB file to match this (i.e. `<number-of-pvs> x <number-of-screens>`)

Expand All @@ -98,22 +108,23 @@ A set of more representative screens with a mixture of update rates and a plotti

`./create_example_db.sh -n <number-of-screens>`
`./create_example_opi.sh -n <number-of-screens>`
`./create_example_bob.sh -n <number-of-screens>`

This will generate a set of screens each with unique PVs. Again, these will be generated in the public/ directory and will need to be copied to the build/ directory to be available at: localhost:3000/performancePage0, localhost:3000/performancePage1, localhost:3000/performancePage2, ... etc.

In order to update the plotting widget with array data, also run the `./caput_to_array.py` script with `-n` for the number of screens:
In order to update the plotting widget with array data, also run the `./update_array_pv.py` script with `-n` for the number of array elements to update (i.e. array size) and `-s` to indicate the number of separate array PVs to update (i.e. number of screens as each screen displays a different array PV):

./caput_to_array.py -n <number-of-screens>
./update_array_pv.py -n <array-size> -s <number-of-screens>


### Starting Firefox windows from the terminal
There are two methods of starting up _M_ screens automatically from the terminal.

1. Use the `./start_browser.sh` script as:

./start_browser.sh -s <number-of-screens> -w <number-of-windows>
./start_browser.sh -s <number-of-screens> -w <number-of-windows>

These can be opened in separate windows or tabs using the arguments `-w` or `-t` respectively.
These can be opened in separate windows or tabs using the arguments `-w` or `-t` respectively.
The number-of-screens specifies how many of the unique OPI screens should be opened (i.e. those generated from [Multiple screens](#multiple-screens) or [Diamond representative screens](#diamond-representative-screens)). In this case the <number-of-screens> and <number-of-windows> should match as each unique screen will be opened in a new window, e.g `./start_browser.sh -s 10 -w 10`.

This method is slightly less efficient than that described next due to requiring a pause between each window opening.
Expand Down Expand Up @@ -143,14 +154,7 @@ The Python script will put data to the waveform array at a rate of 10Hz.

There are two sets of tests, one against the Coniql back-end server and another against the PVWS back-end server. For each there are two types of test, one in Python and the other in Javascript.

To run the Python scripts, first create a virtual environment and pip install the dependencies:

python -m venv venv
source venv/bin/activate

pip install numpy aioca asyncio py-graphql-client websockets

Run the test with:
After activating the Python venv (details [above](#python-venv)), run the Python test with:

python throughput/throughput_XXX.py

Expand All @@ -161,6 +165,20 @@ To run the Javascript code run:
These tests can take up to 30 seconds to run. The rate at which data is received by the client will be printed to the console at the end of the test. The argument `-p` can be appended to both of the above commands to indicate that processing/decoding of the incoming result should be done. This tests the impact of decoding the result on the performance.


### Opening Phoebus standalone windows
There is a script to open multiple Phoebus screens: `./start_phoebus.sh `. Use as:

./start_phoebus.sh -n <number-of-screens>

By default, the state of Phoebus persists when re-opened. To prevent this, first open Phoebus with the argument:

phoebus -clear

After this, run the above script to open _n_ windows.

Note that an alternative way of doing this would be using Phoebus _layouts_ (see https://control-system-studio.readthedocs.io/en/latest/running.html)


### Electron
Install dependencies with npm:

Expand All @@ -183,4 +201,4 @@ Fix with:
sudo chown root:root node_modules/electron/dist/chrome-sandbox
sudo chmod 4755 node_modules/electron/dist/chrome-sandbox

To open multiple pages with Electron, update the `nPages` value in the `electron/main.js` script.
To open multiple pages with Electron, update the `nPages` value in the `electron/main.js` script.

0 comments on commit 09e17bb

Please sign in to comment.