引入 oneTBB 删除taskflow
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <atomic>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include "renderive/scheduling/Scheduler.hpp"
|
||||
#include "renderive/scheduling/detail/OneTBB_Runtime.hpp"
|
||||
TEST(scheduler_test, reports_oneTBB_runtime_activity) {
|
||||
const auto before = renderive::scheduling::scheduler_statistics();
|
||||
EXPECT_GT(before.concurrency, 0U);
|
||||
std::mutex mutex;
|
||||
std::condition_variable completed;
|
||||
bool done{};
|
||||
renderive::scheduling::detail::OneTBB_Runtime::instance().enqueue([&] {
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
done = true;
|
||||
}
|
||||
completed.notify_one();
|
||||
});
|
||||
{
|
||||
std::unique_lock lock(mutex);
|
||||
completed.wait(lock, [&] { return done; });
|
||||
}
|
||||
const auto after = renderive::scheduling::scheduler_statistics();
|
||||
EXPECT_EQ(after.concurrency, before.concurrency);
|
||||
EXPECT_GE(after.worker_entry_count, before.worker_entry_count);
|
||||
EXPECT_GE(after.peak_workers, 1U);
|
||||
}
|
||||
Reference in New Issue
Block a user