Remove background thread from callback bench
This commit is contained in:
@@ -176,29 +176,13 @@ int main() {
|
||||
return gauge_value.load(std::memory_order_relaxed);
|
||||
});
|
||||
|
||||
// Background thread updating callback values
|
||||
std::atomic<bool> stop_callback{false};
|
||||
std::latch start_latch{2}; // Background thread + benchmark thread
|
||||
|
||||
std::thread callback_updater([&]() {
|
||||
start_latch.arrive_and_wait(); // Wait for benchmark to start
|
||||
while (!stop_callback.load()) {
|
||||
counter_value.fetch_add(1);
|
||||
gauge_value.store(gauge_value.load() + 1);
|
||||
}
|
||||
});
|
||||
|
||||
ArenaAllocator arena;
|
||||
|
||||
start_latch.arrive_and_wait(); // Wait for background thread to be ready
|
||||
bench.run("render() - with callback metrics", [&]() {
|
||||
auto output = metric::render(arena);
|
||||
ankerl::nanobench::doNotOptimizeAway(output);
|
||||
arena.reset();
|
||||
});
|
||||
|
||||
stop_callback.store(true);
|
||||
callback_updater.join();
|
||||
}
|
||||
|
||||
// Render performance scaling
|
||||
|
||||
Reference in New Issue
Block a user