Skip to content

Commit

Permalink
Plot dashboard stress tool for C++ (#4600)
Browse files Browse the repository at this point in the history
Adds stress tool to simulate end-to-end plot dashboard workloads in
order to gauge the cost of each step in the way.

The CLI arg parsing is done using
[cxxopts](https://github.com/jarro2783/cxxopts), which seems to be the
sane header-only de-facto standard the everybody recomments on the
internets.
I've vendored it besides the tool itself, which is probably not where we
want it (assuming that's what we want to use).
Also, we don't have an abstraction in C++ for standard Rerun flags 😭

`just cpp-plot-dashboard --help` gives a pretty good idea of what you're
in for:
```
Plot dashboard stress test
Usage:
  plot_dashboard_stress [OPTION...]

  -h, --help                    Print usage
      --spawn                   Start a new Rerun Viewer process and feed it data in real-time
      --connect                 Connects and sends the logged data to a remote Rerun viewer
      --stdout                  Log data to standard output, to be piped into a Rerun Viewer
      --num-plots arg           How many different plots? (default: 1)
      --num-series-per-plot arg
                                How many series in each single plot? (default: 1)
      --num-points-per-series arg
                                How many points in each single series? (default: 100000)
      --freq arg                Frequency of logging (applies to all series) (default: 1000.0)
      --order arg               What order to log the data in ('forwards', 'backwards', 'random') (applies to all series) (default: forwards)
```

## Example

- 10 plots
- 5 series per plot
- 5000 points per series
- log 1000 points per series per second

### C++

Casually breezin' through:
```
$ just cpp-plot-dashboard --num-plots 10 --num-series-per-plot 5 --num-points-per-series 5000 --freq 1000
logged 50050 scalars over 1.000277763s (freq=50036.102Hz, expected=50000.000Hz, load=31.367%)
logged 50000 scalars over 1.000359198s (freq=49982.047Hz, expected=50000.000Hz, load=31.741%)
logged 50000 scalars over 1.000592801s (freq=49970.378Hz, expected=50000.000Hz, load=33.446%)
logged 50000 scalars over 1.000630557s (freq=49968.492Hz, expected=50000.000Hz, load=46.129%)
logged 49950 scalars over 1.000663673s (freq=49916.872Hz, expected=50000.000Hz, load=34.742%)
```

Co-authored-by: Andreas Reich <[email protected]>
  • Loading branch information
teh-cmc and Wumpf authored Dec 22, 2023
1 parent e70e1dd commit 1ba9a39
Show file tree
Hide file tree
Showing 9 changed files with 2,407 additions and 2 deletions.
1 change: 1 addition & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ extend-exclude = [
"crates/re_ui/data/design_tokens.json",
"crates/re_ui/src/design_tokens.rs",
"examples/assets",
"rerun_cpp/src/rerun/third_party/cxxopts.hpp",
]


Expand Down
3 changes: 3 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ cpp-build-doc-examples:
cpp-test:
pixi run cpp-test

cpp-plot-dashboard *ARGS:
pixi run cpp-plot-dashboard {{ARGS}}


### Python

Expand Down
6 changes: 6 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,18 @@ cpp-build-doc-examples = { cmd = "cmake --build build/debug --config Debug --tar
cpp-build-log-benchmark = { cmd = "cmake --build build/release --config Release --target log_benchmark", depends_on = [
"cpp-prepare-release",
] }
cpp-build-plot-dashboard-stress = { cmd = "cmake --build build/release --config Release --target plot_dashboard_stress", depends_on = [
"cpp-prepare-release",
] }
cpp-test = { cmd = "export RERUN_STRICT=1 && ./build/debug/rerun_cpp/tests/rerun_sdk_tests", depends_on = [
"cpp-build-tests",
] }
cpp-log-benchmark = { cmd = "export RERUN_STRICT=1 && ./build/release/tests/cpp/log_benchmark/log_benchmark", depends_on = [
"cpp-build-log-benchmark",
] }
cpp-plot-dashboard = { cmd = "export RERUN_STRICT=1 && ./build/release/tests/cpp/plot_dashboard_stress/plot_dashboard_stress", depends_on = [
"cpp-build-plot-dashboard-stress",
] }
cpp-build-and-test-all = { depends_on = ["cpp-build-all", "cpp-test"] }
cpp-docs = { cmd = "doxygen docs/Doxyfile && echo '***************\nSuccess!\nOpen ./rerun_cpp/docs/html/index.html in your browser.'", cwd = "rerun_cpp" }

Expand Down
3 changes: 2 additions & 1 deletion rerun_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ file(GLOB_RECURSE rerun_sdk_SRC CONFIGURE_DEPENDS

add_library(rerun_sdk ${rerun_sdk_SRC} ${rerun_sdk_PUBLIC_HEADER})

# Make sure the compiler can find include files for rerun when other libraries or executables link to rerun:
# Make sure the compiler can find include files for rerun when other libraries or executables link to rerun.
# Mark include directories as system includes to suppress warnings from them.
target_include_directories(rerun_sdk PUBLIC
$<BUILD_INTERFACE:${RERUN_CPP_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
Expand Down
Loading

0 comments on commit 1ba9a39

Please sign in to comment.