File tree Expand file tree Collapse file tree 5 files changed +50
-1
lines changed Expand file tree Collapse file tree 5 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,24 @@ add_executable(lsl_test_internal
3232)
3333target_link_libraries (lsl_test_internal PRIVATE lslobj lslboost catch_main)
3434
35+ if (LSL_BENCHMARKS)
36+ # to get somewhat reproducible performance numbers:
37+ # /usr/bin/time -v testing/lsl_bench_exported --benchmark-samples 100 bounce
38+ # [unix only] | binary | nr. of samples | test name
39+ add_executable (lsl_bench_exported
40+ bench_ext_bounce.cpp
41+ bench_ext_common.cpp
42+ )
43+ target_link_libraries (lsl_bench_exported PRIVATE lsl catch_main)
44+ installLSLApp(lsl_bench_exported)
45+
46+ add_executable (lsl_bench_internal
47+ bench_int_sleep.cpp
48+ )
49+ target_link_libraries (lsl_bench_internal PRIVATE lslobj lslboost catch_main)
50+ installLSLApp(lsl_bench_internal)
51+ endif ()
52+
3553set (LSL_TESTS lsl_test_exported lsl_test_internal)
3654foreach (lsltest ${LSL_TESTS} )
3755 add_test (NAME ${lsltest} COMMAND ${lsltest} --wait-for-keypress never)
Original file line number Diff line number Diff line change 1+ #include " helpers.h"
2+ #include " catch.hpp"
3+ #include < lsl_cpp.h>
4+
5+ TEST_CASE (" bounce" , " [basic][latency]" ) {
6+ auto sp = create_streampair (lsl::stream_info (" bounce" , " Test" ));
7+
8+ float data = .0 ;
9+ BENCHMARK (" single bounce" ) {
10+ sp.out_ .push_sample (&data);
11+ sp.in_ .pull_sample (&data, 1 .);
12+ };
13+
14+ sp.out_ .push_sample (&data);
15+ BENCHMARK (" primed bounce" ) {
16+ sp.out_ .push_sample (&data);
17+ sp.in_ .pull_sample (&data, 1 .);
18+ };
19+ }
Original file line number Diff line number Diff line change 1+ #include " catch.hpp"
2+ #include < lsl_c.h>
3+
4+ TEST_CASE (" common" ) {
5+ BENCHMARK (" lsl_clock" ) { return lsl_local_clock (); };
6+ }
7+
Original file line number Diff line number Diff line change 1+ #include " catch.hpp"
2+ #include < thread>
3+
4+ TEST_CASE (" sleep" ) {
5+ BENCHMARK (" sleep1ms" ) { std::this_thread::sleep_for (std::chrono::milliseconds (1 )); };
6+ }
Original file line number Diff line number Diff line change 11#include " helpers.h"
22#include " catch.hpp"
33#include < lsl_cpp.h>
4- #include < iostream>
54
65namespace {
76
You can’t perform that action at this time.
0 commit comments