diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2022-04-16 02:36:04 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2022-04-16 02:36:04 +0300 |
commit | 5b0ed834d4875156af5654c60279ccc0ef399f47 (patch) | |
tree | 0fadaddc7c37b59ea8b91a1317f67b98b7c4d3a4 | |
parent | c2b5e6abe44614341e563353c907126683548346 (diff) |
Cherry pick github actions fixes from networking branch.
-rw-r--r-- | .ci.cmake | 10 | ||||
-rw-r--r-- | .github/workflows/documentation.yml | 5 | ||||
-rw-r--r-- | .github/workflows/programs.yml | 5 | ||||
-rw-r--r-- | .github/workflows/unittests_linux.yml | 7 | ||||
-rw-r--r-- | .github/workflows/unittests_windows.yml | 32 | ||||
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | programs/benchmark-async/main.cpp | 57 |
7 files changed, 84 insertions, 33 deletions
@@ -7,6 +7,12 @@ include(QuickCppLibUtils) CONFIGURE_CTEST_SCRIPT_FOR_CDASH("llfio" "prebuilt") #list(APPEND CTEST_CONFIGURE_OPTIONS -DCMAKE_BUILD_TYPE=${CTEST_CONFIGURATION_TYPE} -DCXX_COROUTINES_FLAGS=) ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) +if(WIN32) + find_program(BASH_COMMAND bash HINTS "C:/Program Files/Git/bin") + checked_execute_process("Checking bash binary works" + COMMAND "${BASH_COMMAND}" --version + ) +endif() include(FindGit) set(CTEST_GIT_COMMAND "${GIT_EXECUTABLE}") @@ -81,8 +87,8 @@ if(WIN32) ) endif() checked_execute_process("Tarring up binaries 9" - COMMAND bash -c "mv ned14-outcome* llfio/include/outcome" - COMMAND bash -c "mv ned14-quickcpplib* llfio/include/quickcpplib" + COMMAND "${BASH_COMMAND}" -c "mv ned14-outcome* llfio/include/outcome" + COMMAND "${BASH_COMMAND}" -c "mv ned14-quickcpplib* llfio/include/quickcpplib" ) checked_execute_process("Tarring up binaries final" COMMAND "${CMAKE_COMMAND}" -E tar cfv llfio-v2.0-binaries-win64.zip --format=zip llfio/ diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index a7251b4c..8e96ab1a 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -23,6 +23,11 @@ jobs: fetch-depth: 0 submodules: recursive + - name: Force cmake version to older than runner's + uses: jwlawson/actions-setup-cmake@v1.12 + with: + cmake-version: '3.22.2' + - name: Regenerate Documentation shell: bash run: | diff --git a/.github/workflows/programs.yml b/.github/workflows/programs.yml index d135d4f2..bc3ea80a 100644 --- a/.github/workflows/programs.yml +++ b/.github/workflows/programs.yml @@ -23,6 +23,11 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Force cmake version to older than runner's + uses: jwlawson/actions-setup-cmake@v1.12 + with: + cmake-version: '3.22.2' + - name: Build shell: bash run: | diff --git a/.github/workflows/unittests_linux.yml b/.github/workflows/unittests_linux.yml index afe45f79..3e3276e1 100644 --- a/.github/workflows/unittests_linux.yml +++ b/.github/workflows/unittests_linux.yml @@ -25,6 +25,11 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Force cmake version to older than runner's + uses: jwlawson/actions-setup-cmake@v1.12 + with: + cmake-version: '3.22.2' + - name: CMake tests Linux shell: bash run: | @@ -42,7 +47,7 @@ jobs: fi if [ "${{ matrix.compiler }}" = "arm-linux-gnueabihf-g++" ]; then sudo apt install g++-arm-linux-gnueabihf; - ctest -S .ci.cmake -VV --timeout 900 -DCTEST_DISABLE_TESTING=1 "-DCTEST_CONFIGURE_OPTIONS=$CMAKE_CONFIGURE_OPTIONS;-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-linux-arm.cmake"; + ctest -S .ci.cmake -VV --timeout 900 -DCTEST_DISABLE_TESTING=1 "-DCTEST_CONFIGURE_OPTIONS=$CMAKE_CONFIGURE_OPTIONS;-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-linux-arm.cmake;-DLLFIO_FORCE_OPENSSL_OFF=On"; else ctest -S .ci.cmake -VV --timeout 900 "-DCTEST_CONFIGURE_OPTIONS=$CMAKE_CONFIGURE_OPTIONS"; fi diff --git a/.github/workflows/unittests_windows.yml b/.github/workflows/unittests_windows.yml index 86601177..21644d17 100644 --- a/.github/workflows/unittests_windows.yml +++ b/.github/workflows/unittests_windows.yml @@ -11,37 +11,53 @@ on: jobs: WinVS2017: - name: Windows VS2017 - runs-on: windows-2016 + name: Visual Studio strategy: fail-fast: false matrix: + image: [windows-2019, windows-latest] configuration: [error_code, status_code] - env: - NAME: WinVS2017-${{ matrix.configuration }} - + runs-on: ${{ matrix.image }} + steps: - uses: actions/checkout@v2 + - name: Set name + id: vars + shell: bash + run: | + if [ "${{ matrix.image }}" = "windows-2019" ]; then + NAME=VS2017; + GENERATOR="Visual Studio 16 2019"; + else + NAME=VS2019; + GENERATOR="Visual Studio 17 2022"; + fi + echo ::set-output name=NAME::${NAME} + echo ::set-output name=GENERATOR::${GENERATOR} + + - name: CMake tests Windows shell: bash + env: + NAME: ${{ steps.vars.outputs.NAME }}-${{ matrix.configuration }} run: | if [ "${{ matrix.configuration }}" = "status_code" ]; then export CMAKE_CONFIGURE_OPTIONS="-DLLFIO_USE_EXPERIMENTAL_SG14_STATUS_CODE=ON" fi - ctest -S .ci.cmake -VV --timeout 900 "-DCTEST_CONFIGURE_OPTIONS=$CMAKE_CONFIGURE_OPTIONS" -DCTEST_SITE=$NAME -DCTEST_CMAKE_GENERATOR="Visual Studio 15 2017 Win64" + ctest -S .ci.cmake -VV --timeout 900 "-DCTEST_CONFIGURE_OPTIONS=$CMAKE_CONFIGURE_OPTIONS" -DCTEST_SITE=$NAME -DCTEST_CMAKE_GENERATOR="${{ steps.vars.outputs.GENERATOR }}" - name: Upload Prebuilt Binaries uses: actions/upload-artifact@v2 with: - name: Windows VS2017 ${{ matrix.configuration }} prebuilt binaries + name: Windows ${{ steps.vars.outputs.NAME }} ${{ matrix.configuration }} prebuilt binaries path: llfio-v2.0-binaries-win64.zip - name: Upload Test Results if: always() uses: actions/upload-artifact@v2 with: - name: Windows VS2017 ${{ matrix.configuration }} test results + name: Windows ${{ steps.vars.outputs.NAME }} ${{ matrix.configuration }} test results path: prebuilt/merged_junit_results.xml publish-test-results: diff --git a/CMakeLists.txt b/CMakeLists.txt index 292d88ec..15055784 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,6 +201,7 @@ else() find_package(OpenSSL 1.1 COMPONENTS Crypto SSL) if(OPENSSL_FOUND) all_link_libraries(PRIVATE OpenSSL::Crypto OpenSSL::SSL $<$<PLATFORM_ID:Windows>:Crypt32>) + target_link_libraries(llfio_hl INTERFACE OpenSSL::Crypto OpenSSL::SSL $<$<PLATFORM_ID:Windows>:Crypt32>) endif() endif() if(TARGET outcome::hl) diff --git a/programs/benchmark-async/main.cpp b/programs/benchmark-async/main.cpp index 1b4a69e3..2e803338 100644 --- a/programs/benchmark-async/main.cpp +++ b/programs/benchmark-async/main.cpp @@ -404,7 +404,7 @@ struct test_results LLFIO_TEMPLATE(class C, class... Args) LLFIO_TREQUIRES(LLFIO_TPRED(std::is_constructible<C, int, Args...>::value)) -test_results do_benchmark(int handles, Args &&... args) +test_results do_benchmark(int handles, Args &&...args) { const bool doing_warm_up = (handles < 0); handles = abs(handles); @@ -483,7 +483,7 @@ test_results do_benchmark(int handles, Args &&... args) { timings[x].emplace_back(); // this may reallocate, very expensive } - // Begin all the reads + // Begin all the reads for(int x = 0; x < handles; x++) { timings[x].back().initiate = std::chrono::high_resolution_clock::now(); @@ -502,7 +502,8 @@ test_results do_benchmark(int handles, Args &&... args) // Reap the completions ios.check(); } - if(std::chrono::duration_cast<std::chrono::seconds>(timings[0].back().initiate - timings[0].front().initiate).count() >= (doing_warm_up ? 3U : BENCHMARK_DURATION)) + if(std::chrono::duration_cast<std::chrono::seconds>(timings[0].back().initiate - timings[0].front().initiate).count() >= + (doing_warm_up ? 3U : BENCHMARK_DURATION)) { latch = -1; break; @@ -617,7 +618,7 @@ test_results do_benchmark(int handles, Args &&... args) return ret; } -template <class C, class... Args> void benchmark(llfio::path_view csv, size_t max_handles, const char *desc, Args &&... args) +template <class C, class... Args> void benchmark(llfio::path_view csv, size_t max_handles, const char *desc, Args &&...args) { std::vector<test_results> results; for(int n = 1; n <= max_handles; n <<= 2) @@ -628,11 +629,16 @@ template <class C, class... Args> void benchmark(llfio::path_view csv, size_t ma results.push_back(res); std::cout << " per-handle create " << res.creation << " cancel " << res.cancel << " destroy " << res.destruction; std::cout << "\n total i/o min " << res.total.min << " max " << res.total.max << " mean " << res.total.mean << " stddev " << sqrt(res.total.variance); - std::cout << "\n @ 50% " << res.total._50 << " @ 95% " << res.total._95 << " @ 99% " << res.total._99 << " @ 99.9% " << res.total._999 << " @ 99.99% " << res.total._9999; - std::cout << "\n initiate i/o min " << res.initiate.min << " max " << res.initiate.max << " mean " << res.initiate.mean << " stddev " << sqrt(res.initiate.variance); - std::cout << "\n @ 50% " << res.initiate._50 << " @ 95% " << res.initiate._95 << " @ 99% " << res.initiate._99 << " @ 99.9% " << res.initiate._999 << " @ 99.99% " << res.initiate._9999; - std::cout << "\ncompletion i/o min " << res.completion.min << " max " << res.completion.max << " mean " << res.completion.mean << " stddev " << sqrt(res.completion.variance); - std::cout << "\n @ 50% " << res.completion._50 << " @ 95% " << res.completion._95 << " @ 99% " << res.completion._99 << " @ 99.9% " << res.completion._999 << " @ 99.99% " << res.completion._9999; + std::cout << "\n @ 50% " << res.total._50 << " @ 95% " << res.total._95 << " @ 99% " << res.total._99 << " @ 99.9% " << res.total._999 + << " @ 99.99% " << res.total._9999; + std::cout << "\n initiate i/o min " << res.initiate.min << " max " << res.initiate.max << " mean " << res.initiate.mean << " stddev " + << sqrt(res.initiate.variance); + std::cout << "\n @ 50% " << res.initiate._50 << " @ 95% " << res.initiate._95 << " @ 99% " << res.initiate._99 << " @ 99.9% " + << res.initiate._999 << " @ 99.99% " << res.initiate._9999; + std::cout << "\ncompletion i/o min " << res.completion.min << " max " << res.completion.max << " mean " << res.completion.mean << " stddev " + << sqrt(res.completion.variance); + std::cout << "\n @ 50% " << res.completion._50 << " @ 95% " << res.completion._95 << " @ 99% " << res.completion._99 << " @ 99.9% " + << res.completion._999 << " @ 99.99% " << res.completion._9999; std::cout << "\n total results collected = " << res.total_readings << std::endl; } std::ofstream of(csv.path()); @@ -814,7 +820,12 @@ struct NoHandle final : public llfio::byte_io_handle template <class T> using io_result = typename llfio::byte_io_handle::template io_result<T>; NoHandle() - : llfio::byte_io_handle(llfio::native_handle_type(llfio::native_handle_type::disposition::nonblocking | llfio::native_handle_type::disposition::readable | llfio::native_handle_type::disposition::writable, -2 /* fake being open */), llfio::byte_io_handle::caching::all, llfio::byte_io_handle::flag::multiplexable, nullptr) + : llfio::byte_io_handle(llfio::native_handle_type(llfio::native_handle_type::disposition::nonblocking | llfio::native_handle_type::disposition::readable | + llfio::native_handle_type::disposition::writable | llfio::native_handle_type::disposition::cache_reads | + llfio::native_handle_type::disposition::cache_writes | + llfio::native_handle_type::disposition::cache_metadata, + -2 /* fake being open */), + llfio::byte_io_handle::flag::multiplexable, nullptr) { } ~NoHandle() @@ -918,11 +929,13 @@ template <class HandleType = NoHandle> struct benchmark_llfio } } buffer = {_buffer, sizeof(_buffer)}; - io_state = read_handle.multiplexer()->construct_and_init_io_operation({io_state_ptr.get(), 4096 /*lies*/}, &read_handle, this, {}, {}, io_request<buffers_type>({&buffer, 1}, 0)); + io_state = read_handle.multiplexer()->construct_and_init_io_operation({io_state_ptr.get(), 4096 /*lies*/}, &read_handle, this, {}, {}, + io_request<buffers_type>({&buffer, 1}, 0)); } // Called when the read completes - virtual bool read_completed(llfio::byte_io_multiplexer::io_operation_state::lock_guard & /*g*/, llfio::io_operation_state_type /*former*/, io_result<buffers_type> &&res) override + virtual bool read_completed(llfio::byte_io_multiplexer::io_operation_state::lock_guard & /*g*/, llfio::io_operation_state_type /*former*/, + io_result<buffers_type> &&res) override { when_read_completed = std::chrono::high_resolution_clock::now(); if(!res) @@ -1127,21 +1140,21 @@ int main(void) { std::cout << "Warming up ..." << std::endl; do_benchmark<benchmark_llfio<>>(-1, []() -> llfio::byte_io_multiplexer_ptr { return llfio::test::multiplexer_null(2, true).value(); }); - benchmark<benchmark_llfio<>>("llfio-null-unsynchronised.csv", 64, "Null i/o multiplexer unsynchronised", // - []() -> llfio::byte_io_multiplexer_ptr { return llfio::test::multiplexer_null(1, false).value(); }); - benchmark<benchmark_llfio<>>("llfio-null-synchronised.csv", 64, "Null i/o multiplexer synchronised", // - []() -> llfio::byte_io_multiplexer_ptr { return llfio::test::multiplexer_null(2, true).value(); }); + benchmark<benchmark_llfio<>>("llfio-null-unsynchronised.csv", 64, "Null i/o multiplexer unsynchronised", // + []() -> llfio::byte_io_multiplexer_ptr { return llfio::test::multiplexer_null(1, false).value(); }); + benchmark<benchmark_llfio<>>("llfio-null-synchronised.csv", 64, "Null i/o multiplexer synchronised", // + []() -> llfio::byte_io_multiplexer_ptr { return llfio::test::multiplexer_null(2, true).value(); }); #ifdef _WIN32 std::cout << "\nWarming up ..." << std::endl; - do_benchmark<benchmark_llfio<llfio::pipe_handle>>(-1, // - []() -> llfio::byte_io_multiplexer_ptr { return llfio::test::multiplexer_win_iocp(2, true).value(); }); + do_benchmark<benchmark_llfio<llfio::pipe_handle>>(-1, // + []() -> llfio::byte_io_multiplexer_ptr { return llfio::test::multiplexer_win_iocp(2, true).value(); }); // No locking, enable IOCP immediate completions. ASIO can't compete with this. - benchmark<benchmark_llfio<llfio::pipe_handle>>("llfio-pipe-handle-unsynchronised.csv", 64, "llfio::pipe_handle and IOCP unsynchronised", // - []() -> llfio::byte_io_multiplexer_ptr { return llfio::test::multiplexer_win_iocp(1, false).value(); }); + benchmark<benchmark_llfio<llfio::pipe_handle>>("llfio-pipe-handle-unsynchronised.csv", 64, "llfio::pipe_handle and IOCP unsynchronised", // + []() -> llfio::byte_io_multiplexer_ptr { return llfio::test::multiplexer_win_iocp(1, false).value(); }); // Locking enabled, disable IOCP immediate completions so it's a fair comparison with ASIO - benchmark<benchmark_llfio<llfio::pipe_handle>>("llfio-pipe-handle-synchronised.csv", 64, "llfio::pipe_handle and IOCP synchronised", // - []() -> llfio::byte_io_multiplexer_ptr { return llfio::test::multiplexer_win_iocp(2, true).value(); }); + benchmark<benchmark_llfio<llfio::pipe_handle>>("llfio-pipe-handle-synchronised.csv", 64, "llfio::pipe_handle and IOCP synchronised", // + []() -> llfio::byte_io_multiplexer_ptr { return llfio::test::multiplexer_win_iocp(2, true).value(); }); #endif #if ENABLE_ASIO |