From 8ead37a610a7f0424fccb1cca91f1ebeb55485a5 Mon Sep 17 00:00:00 2001 From: "Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com)" Date: Tue, 3 Aug 2021 21:15:43 +0100 Subject: Try fix last commit on Mac OS. --- include/llfio/revision.hpp | 6 +++--- include/llfio/v2.0/detail/impl/posix/utils.ipp | 6 +++--- test/tests/utils.cpp | 15 ++++++++------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/include/llfio/revision.hpp b/include/llfio/revision.hpp index 905c3a59..57cfc606 100644 --- a/include/llfio/revision.hpp +++ b/include/llfio/revision.hpp @@ -1,4 +1,4 @@ // Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time -#define LLFIO_PREVIOUS_COMMIT_REF d867bd612097979ca40b07852abbf7332538ab98 -#define LLFIO_PREVIOUS_COMMIT_DATE "2021-08-03 17:03:03 +00:00" -#define LLFIO_PREVIOUS_COMMIT_UNIQUE d867bd61 +#define LLFIO_PREVIOUS_COMMIT_REF 5544436fd6654fcc6cd6b3a9c3f3b9b7e0b21865 +#define LLFIO_PREVIOUS_COMMIT_DATE "2021-08-03 19:34:21 +00:00" +#define LLFIO_PREVIOUS_COMMIT_UNIQUE 5544436f diff --git a/include/llfio/v2.0/detail/impl/posix/utils.ipp b/include/llfio/v2.0/detail/impl/posix/utils.ipp index 1461ae8f..4a1649b7 100644 --- a/include/llfio/v2.0/detail/impl/posix/utils.ipp +++ b/include/llfio/v2.0/detail/impl/posix/utils.ipp @@ -1,5 +1,5 @@ /* Misc utilities -(C) 2016-2017 Niall Douglas (6 commits) +(C) 2016-2021 Niall Douglas (6 commits) File Created: Jan 2015 @@ -555,12 +555,12 @@ namespace utils ret.system_ns_in_kernel_mode += cpuInfo[CPU_STATE_MAX * n + CPU_STATE_SYSTEM]; ret.system_ns_in_idle_mode += cpuInfo[CPU_STATE_MAX * n + CPU_STATE_IDLE]; } - vm_deallocate(mach_task_self(), cpuInfo, sizeof(integer_t) * numCPUInfo); + vm_deallocate(mach_task_self(), cpuInfo, sizeof(integer_t) * numCpuInfo); static const double ts_multiplier = [] { mach_timebase_info_data_t timebase; mach_timebase_info(&timebase); return (double) timebase.numer / timebase.denom; - }; + }(); ret.system_ns_in_user_mode = (uint64_t)(ts_multiplier * ret.system_ns_in_user_mode); ret.system_ns_in_kernel_mode = (uint64_t)(ts_multiplier * ret.system_ns_in_kernel_mode); ret.system_ns_in_idle_mode = (uint64_t)(ts_multiplier * ret.system_ns_in_idle_mode); diff --git a/test/tests/utils.cpp b/test/tests/utils.cpp index 2598156c..6bd6c121 100644 --- a/test/tests/utils.cpp +++ b/test/tests/utils.cpp @@ -29,7 +29,7 @@ static inline void TestCurrentProcessCPUUsage() namespace llfio = LLFIO_V2_NAMESPACE; std::vector threads; std::atomic done{0}; - for(size_t n = 0; n < std::thread::hardware_concurrency() / 4; n++) + for(size_t n = 0; n < std::thread::hardware_concurrency() / 2; n++) { threads.push_back(std::thread([&] { while(!done) @@ -41,12 +41,13 @@ static inline void TestCurrentProcessCPUUsage() std::this_thread::sleep_for(std::chrono::seconds(1)); llfio::utils::process_cpu_usage pcu2 = llfio::utils::current_process_cpu_usage().value(); auto diff = pcu2 - pcu1; - BOOST_CHECK(diff.process_ns_in_user_mode >= 900000000ULL * std::thread::hardware_concurrency() / 4); - BOOST_CHECK(diff.system_ns_in_user_mode >= 900000000ULL * std::thread::hardware_concurrency() / 4); - BOOST_CHECK(diff.system_ns_in_idle_mode <= 1100000000ULL * std::thread::hardware_concurrency() * 3 / 4); - std::cout << "With " << (std::thread::hardware_concurrency() / 4) << " threads busy the process spent " << diff.process_ns_in_user_mode << " ns in user mode and " - << diff.process_ns_in_kernel_mode << " ns in kernel mode. The system spent " << diff.system_ns_in_user_mode << " ns in user mode, " - << diff.system_ns_in_kernel_mode << " ns in kernel mode, and " << diff.system_ns_in_idle_mode << " in idle mode." << std::endl; + BOOST_CHECK(diff.process_ns_in_user_mode >= 900000000ULL * std::thread::hardware_concurrency() / 2); + BOOST_CHECK(diff.system_ns_in_user_mode >= 900000000ULL * std::thread::hardware_concurrency() / 2); + BOOST_CHECK(diff.system_ns_in_idle_mode <= 1100000000ULL * std::thread::hardware_concurrency() * 2); + std::cout << "With " << (std::thread::hardware_concurrency() / 2) << " threads busy the process spent " << diff.process_ns_in_user_mode + << " ns in user mode and " << diff.process_ns_in_kernel_mode << " ns in kernel mode. The system spent " << diff.system_ns_in_user_mode + << " ns in user mode, " << diff.system_ns_in_kernel_mode << " ns in kernel mode, and " << diff.system_ns_in_idle_mode << " in idle mode." + << std::endl; done = true; for(auto &t : threads) { -- cgit v1.2.3