Commit 14b3fe8e authored by Sven Liefgen's avatar Sven Liefgen
Browse files

Update Readme

parent 254dfd5a
# X-Lap: A Systems Approach for Cross-Layer Profiling and Latency Analysis for Cyber-Physical Networks
## How to install X-Lap?
## X-Lap as rust library
A rust crate is located at the root of this repository. It is currently not
published to crates.io.
To use xlap, add xlap as a dependecy to your `Cargo.toml` and enable it with
the `xlap` feature.
With the `xlap` feature disabled, all xlap related code will be stripped out
before comilation.
```toml
[dependencies.xlap]
git = "https://git.nt.uni-saarland.de/LARN/X-Lap.git"
branch = "rust"
```
### How to use
The crate exposes several functions to use X-Lap and an additional macro for
each function.
The preferred method to use X-Lap is through the macros as these effectively
don't generate code if X-Lap is disabled.
### Generate definitions
X-Lap relies on definitions generated from the `xlap.yml`.
To generate these, the path to this file has to be passed during the first
build via the `XLAP` environment variable. (This seems the only way to
communicate with the build script)
```
XLAP=/absolute/path/to/xlap.yml cargo build
```
Or export it so that it persists.
The structure of the `xlap.yml` can be found below.
The important parts for the code generation will be listed here:
- Each entry in the `stamps` table will be an enum variant of the `TimestampId` enum.
- Each entry in the `packet_types` table will be an enum variant of the
`Kind` enum.
- The `rows` key denotes how much rows should be recorded for each
Timestamp table. (On segfaults, try lowering this value)
### Instrument the code
In the file that you want to instrument, import the xlap-enums:
```rust
use xlap::Kind::*;
use xlap::TimestampId::*;
```
Whereever you want to instrument your code, put one of the macros wrapped in
an `unsafe` block.
This is currently necessary as the safty analysis has not been done yet.
In the main application, initialize X-Lap.
```rust
unsafe { xlap::init!() };
```
Finally dump the recorded data to a csv file.
```rust
unsafe { xlap::dump_all!("path/to/output.csv") }
```
or
```rust
unsafe { xlap::dump!("path/to/output.csv", &[TABLE1, TABLE2]) }
```
to select which table to dump.
## How to install X-Lap? (C-version / python analysis tools)
Install the following prerequisites via pip: `numpy`, `scipy`, `pandas`, `matplotlib`, `scikit-learn`, `ruamel.yaml`.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment