Skip to content

Reactor runtime implementation in Rust

License

Notifications You must be signed in to change notification settings

chanijjani/reactor-rs

 
 

Repository files navigation

Rust reactor runtime

This is the runtime crate depended on by reactor programs generated by the Rust backend of LFC. You'll find information about the Rust target on the wiki.

Documentation for this crate: https://lf-lang.github.io/reactor-rust

⚠️ Important: The crate is unstable for now as the code generator is still in development. Don't use it directly. For that reason it's not on crates.io either.

Testing

cargo test

Note that the code sample included in documentation comments are also tests. See rustdoc reference.

Tests are organised into

  • a test module for unit tests
  • a /tests directory for integration tests (TODO)

Note the #[cfg(test)] attribute in some places, which means that an item is only compiled when running a test target.

Benchmarking

cargo bench

You can then find plots in target/criterion/$BENCHMARK_NAME/report (see Criterion report structure).

Profiling a binary

Compile the binary with debug symbols (-g) and optimisations (--release)

cargo rustc --release --bin savina_pong_bin -- -g

(you can use whatever binary)

Make sure Oprofile is installed

sudo apt-get install linux-tools-generic oprofile

Run the profiler

$ operf target/release/savina_pong_bin

operf: Profiler started
Iteration: 1	 Duration: 540 ms

Iteration: 2	 Duration: 546 ms

Iteration: 3	 Duration: 538 ms

Iteration: 4	 Duration: 540 ms

Iteration: 5	 Duration: 554 ms

Exec summary
Best time:	538 ms
Worst time:	554 ms
Median time:	540 ms
Shutting down scheduler, channel timed out after 2 ms
* * * * WARNING: Profiling rate was throttled back by the kernel * * * *
The number of samples actually recorded is less than expected, but is
probably still statistically valid.  Decreasing the sampling rate is the
best option if you want to avoid throttling.

Profiling done.

Inspect results

$ opannotate --source | less

About

Reactor runtime implementation in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 99.9%
  • Other 0.1%