Skip to content

visualengineers/reflex-performance

Repository files navigation

ReFlex.Perfomance

Logging server from ReFlex Framework and measurement data sets.

Table of Contents

  1. Content and repo structure
  2. Logging Server

Content and repo structure

The repository contains the source code for the logging server. Additionally, the following data sets are included:

  • app usage during public demonstration of the Elastic Display (LNdW 2025)
  • measurements for depth accuracy of Azure Kinect sensor (stored point clouds from different time stamps)
  • performance measurements for ReFlex Framework (memory consumption and CPU load) when using server and emulator for testing applications
Directory Content
common Logging Server: data structures and route config
data Logging Server: working directory for logging
dist Logging Server: build output
lndw App usage dataset
measurements depth accuracy measurement data
memoryProfiling perfomance measurements data
routes LoggingServer: server routes
scripts LoggingServer: Startup / automation scripts
util LoggingServer: utilities
  • data directories are structured as follows:
Directory Content
code Jupyter notebooks for data processing and generating plots
data raw and processed data
export plots (partially omitted due to file size limitations)

Logging Server

Start Logging Server

  • start logging / data service with npm run debug (when debugging is necessary) or npm run start
  • server runs at http://localhost:4302
  • Test request can be found in test/Insomnia/Insomnia_Workspace.json for testing the REST_API with Insomnia

⬆ back to top

Start Performance Logging

  • PerformanceLogger (dist/performance-logger.js) subscribes to SignalR Hub perfHub of ReFlex.TrackingServer and fetches all diagnostics measurements from there.
  • KNOWN ISSUE: Reconnecting to the SignalR Hub does not work after restart of TrackingServer as connectionId changes and will not be reassociated when reconnecting. Therefore the process exits after a failed connection attempt
  • PerfromanceMeasurement is automatically enabled in ReFlex TrackingServer by periodically checking /api/Settings/MeasurePerformance
  • if MeasurePerfromance is not active a POST request to /api/Settings/MeasurePerformance containing the json body { name: 'MeasurePerformance', value: true } enables PerfromanceMeasuring
  • PerfromanceLogger also writes header for appData log (if not already existing)

⬆ back to top

REST API

endpoint Method Description Example Request Body Example Response Body
/log/create POST create log file / start logging { "message": "FrameId, IsValid, Comment;" } { "file": "2023-07-27T205105.042Z" }
/log/data POST log message to file {Date}_data.csv { "message": "2, false, +++;" }
/log/appData POST log message to file {Date}_appData.csv { "message": "2, false, +++;" }
/log/data/2023-07-27T205105.042Z GET retireve data logs FrameId, IsValid, Comment;
2, false, +++;
/log/result POST log result to file { "ProbandId": 3, "test": true, "result": "result" }
/log/result GET retrieve results { "ProbandId": 3, "test": true, "result": "result" }
/data/11 POST create data file data_011.json {
"data0": "test"
"data1": "abc"
"data3": "123"
}
{ "file": "data/data_011.json" }
/data/11 GET retrieve data file data_011.json {
"data0": "test"
"data1": "abc"
"data3": "123"
}
/data GET list of available data sets [ 11 ]

⬆ back to top

Logging

  • first create Log file with a POST-Request to /log/create
  • as body, provide the header as message: { "message": "FrameId, IsValid, Comment;" } writes "FrameId, IsValid, Comment; in the first line of the data.csv The response contains the current log file name, in the form { "file": "2023-07-27T204421.294Z" } This can be used for querying data logs (see Query Logs).
  • sensor data can be written in the same way by sending a POST request to log/data with the same body format ({ "message": "1, true, testresult;" } writes 1, true, testresult; as line in the csv)
  • results are written by sending a json string to /log/result. The body of the POST request is written as line in the result file without unmodified.
  • logs are stored in /data/log in the format %DATE%_data.csv for tracking data and %DATE%_result.json for results.
  • errors are logged in the same directory as %DATE%_error.log

⬆ back to top

Query Logs

  • Result sets can be retrieved by executing a GET request to /log/result
  • Data Logs can be retrieved by executing a get request to log/data/{file}, where file is the file name returned by /log/create

⬆ back to top

Saving data sets

When generating data, these can be stored and retrieved in the data directory:

  • save a data set in json format by sending a request to /data/{id} with id being the identifier for the data set.
  • the json data provided in the body of the POST request is stored as data_{id} in the data directory
  • to retrieve this data set, just send a GET request to /data/{id}

⬆ back to top

Automation using pm2

  • in the folder /scripts are two scripts (bash for unix/linux/mac, PowerShell for Windows) executing the npm run script for starting both LogginServer and PerformanceLogger using the node process manager pm2
  • the scripts contain the initial install of pm2 as comment, because this usually needs elevated permission, so better install pm2 manually beforehand using npm install pm2@latest -g
  • pm2 automatically restarts the processes after they exited
  • to stop restarting the processes, execute pm2 stop all on bash/concole/powershell and pm2 delete all to remove the processes from the process list.
  • the pm2 daemon can be closed using pm2 kill (which also stops all running processes)

⬆ back to top

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors