feat update benchmark
All checks were successful
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (push) Successful in 1m23s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (push) Successful in 2m0s
linux-arm-gcc / linux-gcc-arm (Debug) (push) Successful in 1m38s
linux-arm-gcc / linux-gcc-arm (Release) (push) Successful in 1m36s
linux-arm-gcc / linux-gcc-armhf (Debug) (push) Successful in 2m16s
linux-arm-gcc / linux-gcc-armhf (Release) (push) Successful in 2m19s
linux-mips-gcc / linux-gcc-mipsel (Debug) (push) Successful in 2m1s
linux-mips-gcc / linux-gcc-mipsel (Release) (push) Successful in 1m41s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Successful in 1m25s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Successful in 2m6s
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (push) Successful in 3m51s
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (push) Successful in 1m45s
linux-x64-gcc / linux-gcc (Debug) (push) Successful in 2m20s
linux-x64-gcc / linux-gcc (Release) (push) Successful in 2m9s
linux-x86-gcc / linux-gcc (Debug) (push) Successful in 2m36s
linux-x86-gcc / linux-gcc (Release) (push) Successful in 2m28s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (pull_request) Successful in 1m22s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (pull_request) Successful in 1m43s
linux-arm-gcc / linux-gcc-arm (Debug) (pull_request) Successful in 1m38s
linux-arm-gcc / linux-gcc-arm (Release) (pull_request) Successful in 1m41s
linux-arm-gcc / linux-gcc-armhf (Debug) (pull_request) Successful in 1m55s
linux-arm-gcc / linux-gcc-armhf (Release) (pull_request) Successful in 1m50s
linux-mips-gcc / linux-gcc-mipsel (Debug) (pull_request) Successful in 1m27s
linux-mips-gcc / linux-gcc-mipsel (Release) (pull_request) Successful in 1m34s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (pull_request) Successful in 1m28s
linux-mips64-gcc / linux-gcc-mips64el (Release) (pull_request) Successful in 1m35s
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (pull_request) Successful in 3m9s
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (pull_request) Successful in 1m43s
linux-x64-gcc / linux-gcc (Debug) (pull_request) Successful in 2m5s
linux-x64-gcc / linux-gcc (Release) (pull_request) Successful in 2m5s
linux-x86-gcc / linux-gcc (Debug) (pull_request) Successful in 2m25s
linux-x86-gcc / linux-gcc (Release) (pull_request) Successful in 2m25s
All checks were successful
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (push) Successful in 1m23s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (push) Successful in 2m0s
linux-arm-gcc / linux-gcc-arm (Debug) (push) Successful in 1m38s
linux-arm-gcc / linux-gcc-arm (Release) (push) Successful in 1m36s
linux-arm-gcc / linux-gcc-armhf (Debug) (push) Successful in 2m16s
linux-arm-gcc / linux-gcc-armhf (Release) (push) Successful in 2m19s
linux-mips-gcc / linux-gcc-mipsel (Debug) (push) Successful in 2m1s
linux-mips-gcc / linux-gcc-mipsel (Release) (push) Successful in 1m41s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Successful in 1m25s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Successful in 2m6s
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (push) Successful in 3m51s
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (push) Successful in 1m45s
linux-x64-gcc / linux-gcc (Debug) (push) Successful in 2m20s
linux-x64-gcc / linux-gcc (Release) (push) Successful in 2m9s
linux-x86-gcc / linux-gcc (Debug) (push) Successful in 2m36s
linux-x86-gcc / linux-gcc (Release) (push) Successful in 2m28s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (pull_request) Successful in 1m22s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (pull_request) Successful in 1m43s
linux-arm-gcc / linux-gcc-arm (Debug) (pull_request) Successful in 1m38s
linux-arm-gcc / linux-gcc-arm (Release) (pull_request) Successful in 1m41s
linux-arm-gcc / linux-gcc-armhf (Debug) (pull_request) Successful in 1m55s
linux-arm-gcc / linux-gcc-armhf (Release) (pull_request) Successful in 1m50s
linux-mips-gcc / linux-gcc-mipsel (Debug) (pull_request) Successful in 1m27s
linux-mips-gcc / linux-gcc-mipsel (Release) (pull_request) Successful in 1m34s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (pull_request) Successful in 1m28s
linux-mips64-gcc / linux-gcc-mips64el (Release) (pull_request) Successful in 1m35s
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (pull_request) Successful in 3m9s
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (pull_request) Successful in 1m43s
linux-x64-gcc / linux-gcc (Debug) (pull_request) Successful in 2m5s
linux-x64-gcc / linux-gcc (Release) (pull_request) Successful in 2m5s
linux-x86-gcc / linux-gcc (Debug) (pull_request) Successful in 2m25s
linux-x86-gcc / linux-gcc (Release) (pull_request) Successful in 2m25s
This commit is contained in:
parent
9140f7d425
commit
0c136e9e0c
@ -1,3 +1,4 @@
|
||||
#include "tile/base/chrono.h"
|
||||
#include "tile/base/random.h"
|
||||
#include "tile/fiber/detail/fiber.h"
|
||||
|
||||
@ -7,7 +8,7 @@ namespace fiber {
|
||||
namespace detail {
|
||||
|
||||
void Benchmark_FiberSwitch(benchmark::State &state) {
|
||||
constexpr int kFiberCount = 10000;
|
||||
constexpr int kFiberCount = 2 * 10000;
|
||||
std::unique_ptr<Fiber> master;
|
||||
std::unique_ptr<Fiber> worker[kFiberCount];
|
||||
|
||||
@ -16,7 +17,22 @@ void Benchmark_FiberSwitch(benchmark::State &state) {
|
||||
master = Fiber::Create([&]() {
|
||||
while (state.KeepRunning()) {
|
||||
++cnt;
|
||||
worker[Random(kFiberCount - 1)]->Resume();
|
||||
auto &w1 = worker[Random(kFiberCount - 1)];
|
||||
auto &w2 = worker[Random(kFiberCount - 1)];
|
||||
auto start = ReadSteadyClock();
|
||||
w1->Resume();
|
||||
w2->Resume();
|
||||
w1->Resume();
|
||||
w2->Resume();
|
||||
w1->Resume();
|
||||
w2->Resume();
|
||||
w1->Resume();
|
||||
w2->Resume();
|
||||
auto end = ReadSteadyClock();
|
||||
auto duration = std::chrono::duration_cast<std::chrono::duration<double>>(
|
||||
end - start) /
|
||||
8;
|
||||
state.SetIterationTime(duration.count());
|
||||
}
|
||||
|
||||
cnt = -1;
|
||||
@ -29,6 +45,9 @@ void Benchmark_FiberSwitch(benchmark::State &state) {
|
||||
worker[i] = Fiber::Create([&, i]() {
|
||||
while (cnt != -1) {
|
||||
master->Resume();
|
||||
master->Resume();
|
||||
master->Resume();
|
||||
master->Resume();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -39,7 +58,7 @@ void Benchmark_FiberSwitch(benchmark::State &state) {
|
||||
master->Resume();
|
||||
}
|
||||
|
||||
BENCHMARK(Benchmark_FiberSwitch);
|
||||
BENCHMARK(Benchmark_FiberSwitch)->UseManualTime();
|
||||
} // namespace detail
|
||||
} // namespace fiber
|
||||
} // namespace tile
|
||||
|
Loading…
Reference in New Issue
Block a user