-
Notifications
You must be signed in to change notification settings - Fork 2
4 UI Information
This page explains the operation of the User Interface (UI) of the PRiME Framework. The UI provides a mechanism for researchers to run scripted experiments and demonstrate their work using the PRiME Framework. The UI operates in one of two modes; Auto mode or Demo mode. The function of these modes is explained in the sections below. These modes can be accessed from a main menu:
The device and RTM processes must first be started from this page:
- Locate the device binary file and select it.
- Enter any input arguments the device process requires.
- Start the device process.
- Locate the RTM binary file and select it.
- Enter any input arguments for the RTM process.
- Start the RTM process.
Once these steps have been completed, continue to either Auto or Demo Mode.
In demo mode, the UI enables manual control of the operation of the framework. Standard commands can be called from the UI to instruct the relevant modules to perform particular actions and call the corresponding API functions.
In auto mode, the UI operates as a test harness for running scripted experiments. Test scripts are composed of test commands, written in JSON, and are used to control the operation of any part of the framework or system.
Two time modes are supported for setting the execution times of commands in test scripts:
- Cumulative execution times, which must increase monotonically (e.g. 1, 2, 3, 5, 6, 8, 10...).
- Additive execution times, which indicate the time from the previous command (e.g. 1, 1, 2, 1, 5, 2, 1...).
The table below lists valid test commands that can be used in test scripts. Erroneous commands will be ignored by the UI but a notifying message will be printed on the screen's log.
Example commands:
Add the app_example application to the UI, specifying its path and arguments:
{"type":"PRIME_UI_ADD_APP", "name":"app_example", "abspath":"../build/app", "arguments":"../../video.mp4 0.040 5"}
Start the app_example application after 1 second:
{ "exec_time":1, "type":"PRIME_UI_APP_START", "name":"app_example", "UIID":"1" }
Register the app_example application 1 second later (using cumulative timing):
{ "exec_time":2, "type":"PRIME_UI_APP_REG", "UIID":"1" }
Update the minimum bound of continuous monitor 1 of app_example to 100:
{ "exec_time":4, "type":"PRIME_UI_APP_MON_CONT_MIN", "UIID":"1", "data":{ "mon":{ "id":"1", "min":"100"} }
A test script generator expedites the creation of test scripts by generating JSON from the provided fields.
**** This is an experimental feature at the present and should not be used ****
The test script generator expedites the creation of test scripts by generating JSON from the provided fields. In a similar way to demo mode, the generator presents valid test script commands and they can be selected in sequence. However, instead of triggering actual messages to be sent from the UI, they cause JSON test script commands to be written to file.
- Python 3
- Python modules used that are NOT in the standard distribution:
npyscreen
- Python modules used that are in the standard distribution:
socket, sys, os, signal, subprocess, json, time, npyscreen, curses
- Modules can be installed using using
pip install <module name>
)- pip may need to be installed with
sudo apt-get install python3-pip
- pip may need to be installed with
To start the UI, open a terminal on the target system.
Navigate to the ui/
directory and enter python ui.py
.
All further instructions are provided in the UI pages themselves or in the above sections.
This table shows all of the commands that may be used in a test script for the UI to run an experiment.
Type & Fields | Description |
---|---|
PRIME_UI_ADD_APP string name, string abspath, string arguments
|
Make the framework aware of an application. The purpose of this command is to inform the UI of the application's name, absolute path and pass any arguments to the binary. Arguments will be split by spaces. |
PRIME_UI_APP_START exec_time, string name, UIID
|
Start application "name" at exec_time seconds and link the proc_id to "UIID". This allows the application to call the required startup functions and constructors. This does not register the application. |
PRIME_UI_APP_STOP exec_time, UIID
|
Stop application "UIID" at exec_time seconds. This allows the application to call the required shutdown functions and destructors. The application is responsible for ensuring that it stopped safely. |
PRIME_UI_APP_REG exec_time, UIID
|
Register application "UIID" with the RTM at exec_time seconds. The application is also responsible for registering all knobs and monitors at this point. |
PRIME_UI_APP_DEREG exec_time, UIID
|
Deregister application "UIID" from the RTM at exec_time seconds. The application is responsible for deregistering all knobs and monitors before it deregisters. |
PRIME_UI_APP_MON_DISC_MIN exec_time, UIID, data:{int id, int min}
|
Update the minimum value of the discrete monitor "id" of application "UIID" to "min" at exec_time seconds. |
PRIME_UI_APP_MON_DISC_MAX exec_time, UIID, data:{int id, int max}
|
Update the maximum value of the discrete monitor "id" of application "UIID" to "max" at exec_time seconds. |
PRIME_UI_APP_MON_DISC_WEIGHT exec_time, UIID, data:{int id, float weight}
|
Update the relative weighting of the discrete monitor "id" of application "UIID" to "weight" at exec_time seconds. |
PRIME_UI_APP_MON_CONT_MIN exec_time, UIID, data:{int id, float min}
|
Update the minimum value of the continuous monitor "id" of application "UIID" to "min" at exec_time seconds. |
PRIME_UI_APP_MON_CONT_MAX exec_time, UIID, data:{int id, float max}
|
Update the maximum value of the continuous monitor "id" of application "UIID" to "max" at exec_time seconds. |
PRIME_UI_APP_MON_CONT_WEIGHT exec_time, UIID, data:{int id, float weight}
|
Update the relative weighting of the continuous monitor "id" of application "UIID" to "weight" at exec_time seconds. |
PRIME_UI_APP_WEIGHT exec_time, UIID, data:{float weight}
|
Update, to the RTM, the relative weighting of application "UIID" to "weight" at exec_time seconds. |
PRIME_UI_RTM_POLICY_SWITCH exec_time, data:{policy, params}
|
Change the RTM policy to "policy" at exec_time seconds and pass the policy dependent parameters "params". |
PRIME_UI_LOG_FILE_FILTER_MUX exec_time, data:{list[] messages}
|
Set the filter for the messages that the logger saves to file to the list "messages" at exec_time seconds. |
PRIME_UI_LOG_VISUAL_FILTER_MUX exec_time, data:{list[] messages}
|
Set the filter for the messages that the logger forwards to the visualiser to the list "messages" at exec_time seconds. |
This table shows all of the valid messages that the UI can send to the Application and the required fields.
Type & Fields | Description |
---|---|
PRIME_UI_APP_STOP int ts, data:{pid_t proc_id}
|
Stop application "proc_id". This allows the application to call the required shutdown functions and destructors. The application is responsible for ensuring that it stopped safely. |
PRIME_UI_APP_REG int ts, data{pid_t proc_id}
|
Register application "proc_id" with the RTM. The application is also responsible for registering all knobs and monitors at this point. |
PRIME_UI_APP_DEREG int ts, data:{pid_t proc_id}
|
Deregister application "proc_id" from the RTM. The application is responsible for deregistering all knobs and monitors before it deregisters. |
PRIME_UI_APP_MON_DISC_MIN int ts, data:{int id, int min}
|
Update the minimum value of the discrete monitor "id" of application "proc_id" to "min". |
PRIME_UI_APP_MON_DISC_MAX int ts, data:{int id, int max}
|
Update the maximum value of the discrete monitor "id" of application "proc_id" to "max". |
PRIME_UI_APP_MON_DISC_WEIGHT int ts, data:{int id, float weight}
|
Update the relative weighting of the discrete monitor "id" of application "proc_id" to "weight". |
PRIME_UI_APP_MON_CONT_MIN int ts, data:{int id, float min}
|
Update the minimum value of the continuous monitor "id" of application "proc_id" to "min". |
PRIME_UI_APP_MON_CONT_MAX int ts, data:{int id, float max}
|
Update the maximum value of the continuous monitor "id" of application "proc_id" to "max". |
PRIME_UI_APP_MON_CONT_WEIGHT int ts, data:{int id, float weight}
|
Update the relative weighting of the continuous monitor "id" of application "proc_id" to "weight". |
PRIME_UI_APP_WEIGHT int ts, data:{pid_t proc_id, float weight}
|
Update, to the RTM, the relative weighting of application "proc_id" to "weight". |
PRIME_UI_RTM_POLICY_SWITCH int ts, data:{policy, params}
|
Change the RTM policy to "policy" and pass the policy dependent parameters "params". |
PRIME_UI_LOG_FILE_FILTER_MUX int ts, data:{list[] messages}
|
Set the filter for the messages that the logger saves to file to the list "messages". |
PRIME_UI_LOG_VISUAL_FILTER_MUX int ts, data:{list[] messages}
|
Set the filter for the messages that the logger forwards to the visualiser to the list "messages". |
This table shows all of the valid messages that the Application can send to the UI and the required fields.
Type & Fields | Description |
---|---|
PRIME_UI_APP_START_RETURN int ts, data:{pid_t proc_id}
|
Return message sent by application once the start (constructor) process has completed. |
PRIME_UI_APP_STOP_RETURN int ts, data:{pid_t proc_id}
|
Return message sent by application once the stop (destructor) process has completed. |