feat update

This commit is contained in:
tqcq 2024-03-29 19:14:22 +08:00
parent f3555ec520
commit fe27f131b1

View File

@ -3,12 +3,11 @@
#include <sled/system/fiber/wait_group.h> #include <sled/system/fiber/wait_group.h>
static void static void
SingleQueue(benchmark::State &state) FiberSingleQueue(benchmark::State &state)
{ {
for (auto _ : state) { for (auto _ : state) {
state.PauseTiming(); state.PauseTiming();
sled::Scheduler scheduler( sled::Scheduler scheduler(sled::Scheduler::Config().setWorkerThreadCount(0));
sled::Scheduler::Config().setWorkerThreadCount(0));
scheduler.bind(); scheduler.bind();
defer(scheduler.unbind()); defer(scheduler.unbind());
const int num_tasks = state.range(0); const int num_tasks = state.range(0);
@ -29,7 +28,7 @@ SingleQueue(benchmark::State &state)
} }
static void static void
MultiQueue(benchmark::State &state) FiberMultiQueue(benchmark::State &state)
{ {
for (auto _ : state) { for (auto _ : state) {
@ -55,5 +54,5 @@ MultiQueue(benchmark::State &state)
} }
} }
BENCHMARK(MultiQueue)->RangeMultiplier(10)->Range(10, 10000); BENCHMARK(FiberSingleQueue)->RangeMultiplier(10)->Range(10, 10000);
BENCHMARK(SingleQueue)->RangeMultiplier(10)->Range(10, 10000); BENCHMARK(FiberMultiQueue)->RangeMultiplier(10)->Range(10, 10000);