From 73f5571337a4760d526ea378d96f5b93693beb17 Mon Sep 17 00:00:00 2001 From: "Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com)" Date: Fri, 15 Jan 2021 11:26:12 +0000 Subject: Make the dynamic thread pool work scheduling not quite as strict in the native Linux implementation, now we only examine higher priority groups once per group cycle. This produces behaviours much more consistent with the Win32 thread pool and Grand Central Dispatch. --- test/tests/dynamic_thread_pool_group.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/tests/dynamic_thread_pool_group.cpp b/test/tests/dynamic_thread_pool_group.cpp index a40d3b05..6e985fc8 100644 --- a/test/tests/dynamic_thread_pool_group.cpp +++ b/test/tests/dynamic_thread_pool_group.cpp @@ -226,6 +226,11 @@ static inline void TestDynamicThreadPoolGroupWorks() static inline void TestDynamicThreadPoolGroupNestingWorks() { + if(std::thread::hardware_concurrency() < 4) + { + std::cout << "NOTE: Skipping TestDynamicThreadPoolGroupNestingWorks as hardware concurrency is below 4." << std::endl; + return; + } namespace llfio = LLFIO_V2_NAMESPACE; static constexpr size_t MAX_NESTING = 10; static constexpr int COUNT_PER_WORK_ITEM = 1000; @@ -299,6 +304,7 @@ static inline void TestDynamicThreadPoolGroupNestingWorks() } uint64_t idx = std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count(); std::lock_guard g(shared_states[nesting].lock); + //std::cout << "wi " << this << " nesting " << nesting << " work " << work << std::endl; if(COUNT_PER_WORK_ITEM == work && childwi) { if(!shared_states[nesting].tpg) @@ -438,8 +444,8 @@ static inline void TestDynamicThreadPoolGroupIoAwareWorks() BOOST_CHECK(paced > 0); } -//KERNELTEST_TEST_KERNEL(integration, llfio, dynamic_thread_pool_group, works, "Tests that llfio::dynamic_thread_pool_group works as expected", -// TestDynamicThreadPoolGroupWorks()) +KERNELTEST_TEST_KERNEL(integration, llfio, dynamic_thread_pool_group, works, "Tests that llfio::dynamic_thread_pool_group works as expected", + TestDynamicThreadPoolGroupWorks()) KERNELTEST_TEST_KERNEL(integration, llfio, dynamic_thread_pool_group, nested, "Tests that nesting of llfio::dynamic_thread_pool_group works as expected", TestDynamicThreadPoolGroupNestingWorks()) //KERNELTEST_TEST_KERNEL(integration, llfio, dynamic_thread_pool_group, io_aware_work_item, -- cgit v1.2.3