diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 0000000..3ffa384 --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,69 @@ +name: CMake + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + +jobs: + format-check: + name: Format Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: jidicula/clang-format-action@v4.13.0 + with: + clang-format-version: '18' + exclude-regex: '(dependencies)' + + build: + # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. + # You can convert this to a matrix build if you need cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + strategy: + matrix: + os: [ macos-latest, ubuntu-22.04 ] + + runs-on: ${{ matrix.os }} + continue-on-error: true + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Packages (macOS) + run: | + brew install llvm go + ln -s "$(brew --prefix llvm)/bin/clang-tidy" "/usr/local/bin/clang-tidy" + if: matrix.os == 'macos-latest' + + - name: Install Packages (Ubuntu) + run: | + sudo apt-get install -y clang-tidy-15 + if: matrix.os == 'ubuntu-22.04' + + - name: Configure CMake (Ubuntu) + if: matrix.os == 'ubuntu-22.04' + env: + CC: "/usr/bin/gcc-12" + CXX: "/usr/bin/g++-12" + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -B ${{github.workspace}}/build -DLINT=ON -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTING=ON -DBUILD_BENCHMARKING=ON + + - name: Configure CMake (macOS) + if: matrix.os == 'macos-latest' + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -B ${{github.workspace}}/build -DLINT=ON -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTING=ON -DBUILD_BENCHMARKING=ON + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j $(getconf _NPROCESSORS_ONLN) + diff --git a/.gitignore b/.gitignore index 796b96d..7e40d76 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,60 @@ +# Compiled Object files +*.slo +*.lo +*.o +*.obj +*.d +*.tmp + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +# Temp Files +.DS_Store +*.swp +*~ /build + +# log files +*.log + +# IDEA +.idea +cmake-build-debug +cmake-build-release + +# Editor files/directories +/.vscode +/.vs +/CMakeSettings.json +.projections.json + +# vcpkg +/vcpkg_installed + +# Other +.tmp.dprobes.h +libquicr.spdx + +# Python +.venv +.vscode/ +__pycache__/ + diff --git a/CMakeLists.txt b/CMakeLists.txt index 71a4d61..674a741 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,9 @@ set(CPM_USE_LOCAL_PACKAGES ON) include(cmake/CPM.cmake) +## hack fix for picotls and other older submodules of libquicr +set(CMAKE_POLICY_VERSION_MINIMUM 3.5) + CPMAddPackage("gh:Quicr/libquicr#main") CPMAddPackage("gh:jarro2783/cxxopts@3.3.1") diff --git a/README.md b/README.md index 4cbb7ff..e124060 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,45 @@ # qperf -Performance Measurement for Relay +Utility to evaluate relay performance. + +## Command Line Programs + +### > src/qperf_pub + +**qperf_pub** is a publisher that publishes based on the `-c ` profile. + +### > src/qperf_sub + +**qperf_sub** is a subscriber that consumes the tracks based on the `-c ` profile. + +It is intended that the same `config.ini` file be used for both pub and sub. This way they have +the same settings. + +## config.ini + +Profile configuration per track is configured in a `config.ini` file that is provided to the program using +the `-c` option. See the [config.ini template](templates/config.template.ini) for an example configuration. + +Each section in the `config.ini` defines a test for a publish track and subscribe track. +The `namespace` and `name` together should be **unique** for the section, which is the track. + + +> [!IMPORTANT] +> Each section **MUST** not share the same `namespace + name`. If namespace is the same, the name +> should be different. + +## Building + +Configure cmake using the following: + +``` +cmake -B ./build -DLINT=ON -DCMAKE_BUILD_TYPE=Release +``` + +Build the programs using the following: + +``` +cmake --build build -j 4 +``` + +The binaries will be under `./build` \ No newline at end of file diff --git a/src/qperf_pub.cc b/src/qperf_pub.cc index a76cf51..42fdcfa 100644 --- a/src/qperf_pub.cc +++ b/src/qperf_pub.cc @@ -62,6 +62,12 @@ namespace qperf { case Status::kSendingUnannounce: SPDLOG_INFO("PerfPublishTrackeHandler - status kSendingUnannounce"); break; + case Status::kPaused: + SPDLOG_INFO("PerfPublishTrackeHandler - status kPaused"); + break; + case Status::kNewGroupRequested: + SPDLOG_INFO("PerfPublishTrackeHandler - status kNewGroupRequested"); + break; default: SPDLOG_INFO("PerfPublishTrackeHandler - status UNKNOWN"); break; @@ -247,7 +253,7 @@ namespace qperf { auto transmit_time_ms = std::chrono::milliseconds(perf_config_.total_test_time); auto end_transmit_time = start_transmit_time + transmit_time_ms; - // Delay befor trasnmitting + // Delay before transmitting if (perf_config_.start_delay > 0) { std::this_thread::sleep_for(std::chrono::milliseconds(33)); test_mode_ = qperf::TestMode::kWaitPreTest; diff --git a/templates/config-audio.ini b/templates/config-audio.ini new file mode 100644 index 0000000..cc67f21 --- /dev/null +++ b/templates/config-audio.ini @@ -0,0 +1,13 @@ +[Audio] +namespace = perf/1 ; track namespace +name = 1 ; track name +track_mode = datagram ; track mode {datagram,stream} +priority = 2 ; priority (0-255) +ttl = 5000 ; ttl in ms +time_interval = 20 ; transmit interval in floating point ms +objs_per_group = 1 ; objects per group count >=1 +bytes_per_group_start = 120 ; size of a group 0 object +bytes_per_group = 120 ; size of a group <> 0 object +start_delay = 5000 ; start delay in ms - after subscribes +total_test_time = 40000 ; total transmit time in ms - including startdelay +; (not configured): total_transmit_time - is calculated total_transmit_time = total_test_time - start_delay diff --git a/templates/config-av.ini b/templates/config-av.ini new file mode 100644 index 0000000..2a22f4c --- /dev/null +++ b/templates/config-av.ini @@ -0,0 +1,26 @@ +[Audio] +namespace = perf/1 ; track namespace +name = 1 ; track name +track_mode = datagram ; track mode {datagram,stream} +priority = 2 ; priority (0-255) +ttl = 5000 ; ttl in ms +time_interval = 20 ; transmit interval in floating point ms +objs_per_group = 1 ; objects per group count >=1 +bytes_per_group_start = 120 ; size of a group 0 object +bytes_per_group = 120 ; size of a group <> 0 object +start_delay = 5000 ; start delay in ms - after subscribes +total_test_time = 40000 ; total transmit time in ms - including start delay +; (not configured): total_transmit_time - is calculated total_transmit_time = total_test_time - start_delay + +[360p Video] +namespace = perf/2 ; track namespace +name = 1 ; track name +track_mode = stream ; track mode {datagram,stream} +priority = 3 ; priority (0-255) +ttl = 5000 ; ttl in ms +time_interval = 33.33 ; transmit interval in floating point ms +objs_per_group = 150 ; objects per group count >=1 +bytes_per_group_start = 21333 ; size of a group 0 object +bytes_per_group = 2666 ; size of a group <> 0 object +start_delay = 5000 ; start delay in ms - after subscribes +total_test_time = 40000 ; total transmit time in ms - including start delay diff --git a/templates/config.template.ini b/templates/config.template.ini index 651cb2a..36415cb 100644 --- a/templates/config.template.ini +++ b/templates/config.template.ini @@ -1,6 +1,6 @@ -[TRACK Name] -namespace = perf/1 ; track namespace -name = 1 ; track name +[TRACK 1] +namespace = perf/1 ; track namespace - can be the same or different than other section tracks +name = 1 ; track name - Should be different than other section tracks track_mode = datagram ; track mode {datagram,stream} priority = 1 ; priority (0-255) ttl = 5000 ; ttl in ms @@ -8,6 +8,18 @@ time_interval = 20.00 ; transmit interval in floating point ms objs_per_group = 1 ; objects per group count >=1 bytes_per_group_start = 60 ; size of a group 0 object bytes_per_group = 60 ; size of a group <> 0 object -end_delay = 5000 ; start delay in ms - after subscribes start_delay = 10000 ; start delay in ms - after subscribes -total_test_time = 35000 ; total transmit time in ms - including startdelay +total_test_time = 35000 ; total transmit time in ms - including start delay + +[TRACK 2] +namespace = perf/1 ; track namespace - can be the same or different than other section tracks +name = 2 ; track name - Should be different than other section tracks +track_mode = stream ; track mode {datagram,stream} +priority = 2 ; priority (0-255) +ttl = 5000 ; ttl in ms +time_interval = 33.33 ; transmit interval in floating point ms +objs_per_group = 150 ; objects per group count >=1 +bytes_per_group_start = 22000 ; size of a group 0 object +bytes_per_group = 2500 ; size of a group <> 0 object +start_delay = 10000 ; start delay in ms - after subscribes +total_test_time = 35000 ; total transmit time in ms - including start delay