From 669a9d794b608a2f374676a1708b71813aaee875 Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Thu, 20 Jun 2024 21:27:54 +0800 Subject: [PATCH 1/2] feat update workflows --- .gitea/workflows/linux-aarch64-gcc.yml | 4 ++-- .gitea/workflows/linux-arm-gcc.yml | 8 ++++---- .gitea/workflows/linux-mips-gcc.yml | 4 ++-- .gitea/workflows/linux-mips64-gcc.yml | 4 ++-- .gitea/workflows/linux-riscv64-gcc.yml | 4 ++-- tile/init.cc | 4 +++- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.gitea/workflows/linux-aarch64-gcc.yml b/.gitea/workflows/linux-aarch64-gcc.yml index 3676172..cb9514b 100644 --- a/.gitea/workflows/linux-aarch64-gcc.yml +++ b/.gitea/workflows/linux-aarch64-gcc.yml @@ -53,6 +53,6 @@ jobs: - name: test run: |- cd build - sudo ln -sf /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 /lib/ld-linux-aarch64.so.1 - export LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib + # sudo ln -sf /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 /lib/ld-linux-aarch64.so.1 + # export LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib ctest --output-on-failure -j $(nproc) diff --git a/.gitea/workflows/linux-arm-gcc.yml b/.gitea/workflows/linux-arm-gcc.yml index 28ace26..24506b0 100644 --- a/.gitea/workflows/linux-arm-gcc.yml +++ b/.gitea/workflows/linux-arm-gcc.yml @@ -51,8 +51,8 @@ jobs: - name: test run: | cd build - sudo ln -sf /usr/arm-linux-gnueabi/lib/ld-linux.so.3 /lib/ld-linux.so.3 - export LD_LIBRARY_PATH=/usr/arm-linux-gnueabi/lib + #sudo ln -sf /usr/arm-linux-gnueabi/lib/ld-linux.so.3 /lib/ld-linux.so.3 + #export LD_LIBRARY_PATH=/usr/arm-linux-gnueabi/lib ctest --output-on-failure -j $(nproc) linux-gcc-armhf: @@ -79,6 +79,6 @@ jobs: - name: test run: |- cd build - sudo ln -sf /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 /lib/ld-linux-armhf.so.3 - export LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib/ + # sudo ln -sf /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 /lib/ld-linux-armhf.so.3 + #export LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib/ ctest --output-on-failure -j $(nproc) diff --git a/.gitea/workflows/linux-mips-gcc.yml b/.gitea/workflows/linux-mips-gcc.yml index e1ee3a0..3b191b3 100644 --- a/.gitea/workflows/linux-mips-gcc.yml +++ b/.gitea/workflows/linux-mips-gcc.yml @@ -48,6 +48,6 @@ jobs: - name: test run: |- cd build - sudo ln -sf /usr/mipsel-linux-gnu/lib/ld.so.1 /lib/ld.so.1 - export LD_LIBRARY_PATH=/usr/mipsel-linux-gnu/lib/ + # sudo ln -sf /usr/mipsel-linux-gnu/lib/ld.so.1 /lib/ld.so.1 + # export LD_LIBRARY_PATH=/usr/mipsel-linux-gnu/lib/ ctest --output-on-failure -j $(nproc) diff --git a/.gitea/workflows/linux-mips64-gcc.yml b/.gitea/workflows/linux-mips64-gcc.yml index 23a500f..96d82c5 100644 --- a/.gitea/workflows/linux-mips64-gcc.yml +++ b/.gitea/workflows/linux-mips64-gcc.yml @@ -49,6 +49,6 @@ jobs: - name: test run: |- cd build - sudo ln -sf /usr/mips64el-linux-gnuabi64/lib64/ld.so.1 /lib64/ld.so.1 - export LD_LIBRARY_PATH=/usr/mips64el-linux-gnuabi64/lib + # sudo ln -sf /usr/mips64el-linux-gnuabi64/lib64/ld.so.1 /lib64/ld.so.1 + # export LD_LIBRARY_PATH=/usr/mips64el-linux-gnuabi64/lib ctest --output-on-failure -j $(nproc) diff --git a/.gitea/workflows/linux-riscv64-gcc.yml b/.gitea/workflows/linux-riscv64-gcc.yml index 1c6566a..61a829b 100644 --- a/.gitea/workflows/linux-riscv64-gcc.yml +++ b/.gitea/workflows/linux-riscv64-gcc.yml @@ -50,6 +50,6 @@ jobs: - name: test run: |- cd build - sudo ln -sf /usr/riscv64-linux-gnu/lib/ld-linux-riscv64-lp64d.so.1 /lib/ld-linux-riscv64-lp64d.so.1 - export LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib + # sudo ln -sf /usr/riscv64-linux-gnu/lib/ld-linux-riscv64-lp64d.so.1 /lib/ld-linux-riscv64-lp64d.so.1 + # export LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib ctest --output-on-failure -j $(nproc) diff --git a/tile/init.cc b/tile/init.cc index e09ebb7..4afaccf 100644 --- a/tile/init.cc +++ b/tile/init.cc @@ -53,6 +53,7 @@ int Start(int argc, char **argv, std::function cb, google::InstallFailureSignalHandler(); } + gflags::SetVersionString("0.1.0"); gflags::ParseCommandLineFlags(&argc, &argv, true); detail::ApplyFlagOverrider(); @@ -88,8 +89,9 @@ int Start(int argc, char **argv, std::function cb, detail::RunAllFinalizers(); TerminateBasicRuntime(); - + gflags::ShutDownCommandLineFlags(); TILE_LOG_INFO("Exited"); + return rc; } From ff8468b5d1a4ab6d91529fa4ab6b85719fa89c65 Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Fri, 21 Jun 2024 00:23:31 +0800 Subject: [PATCH 2/2] feat update benchmark --- tile/fiber/detail/fiber_benchmark.cc | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/tile/fiber/detail/fiber_benchmark.cc b/tile/fiber/detail/fiber_benchmark.cc index 1b053a2..659b22e 100644 --- a/tile/fiber/detail/fiber_benchmark.cc +++ b/tile/fiber/detail/fiber_benchmark.cc @@ -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 master; std::unique_ptr 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>( + 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