diff options
Diffstat (limited to 'benchmark')
| -rw-r--r-- | benchmark/bench_misc.cpp | 24 | ||||
| -rw-r--r-- | benchmark/rmdir.cpp | 17 |
2 files changed, 19 insertions, 22 deletions
diff --git a/benchmark/bench_misc.cpp b/benchmark/bench_misc.cpp index 18b68417f..1cbbbe170 100644 --- a/benchmark/bench_misc.cpp +++ b/benchmark/bench_misc.cpp @@ -228,13 +228,7 @@ class CreateFileBench final : public td::Benchmark { } } void tear_down() final { - td::walk_path("A/", [&](td::CSlice path, auto type) { - if (type == td::WalkPath::Type::ExitDir) { - td::rmdir(path).ignore(); - } else if (type == td::WalkPath::Type::NotDir) { - td::unlink(path).ignore(); - } - }).ignore(); + td::rmrf("A/").ignore(); } }; @@ -250,22 +244,10 @@ class WalkPathBench final : public td::Benchmark { } void run(int n) final { int cnt = 0; - td::walk_path("A/", [&](td::CSlice path, auto type) { - if (type == td::WalkPath::Type::EnterDir) { - return; - } - td::stat(path).ok(); - cnt++; - }).ignore(); + td::rmrf("A/").ignore(); } void tear_down() final { - td::walk_path("A/", [&](td::CSlice path, auto type) { - if (type == td::WalkPath::Type::ExitDir) { - td::rmdir(path).ignore(); - } else if (type == td::WalkPath::Type::NotDir) { - td::unlink(path).ignore(); - } - }).ignore(); + td::rmrf("A/").ignore(); } }; diff --git a/benchmark/rmdir.cpp b/benchmark/rmdir.cpp index 163f2986b..1a1a7133b 100644 --- a/benchmark/rmdir.cpp +++ b/benchmark/rmdir.cpp @@ -17,8 +17,23 @@ int main(int argc, char *argv[]) { auto status = td::walk_path(dir, [&](td::CSlice path, auto type) { if (type != td::WalkPath::Type::EnterDir) { cnt++; - LOG(INFO) << path << " " << (type == td::WalkPath::Type::ExitDir); } + auto type_name = [&] { + switch (type) { + case td::WalkPath::Type::EnterDir: + return td::CSlice("Open"); + case td::WalkPath::Type::ExitDir: + return td::CSlice("Exit"); + case td::WalkPath::Type::RegularFile: + return td::CSlice("File"); + case td::WalkPath::Type::Symlink: + return td::CSlice("Link"); + default: + UNREACHABLE(); + return td::CSlice(); + } + }(); + LOG(INFO) << type_name << ' ' << path; //if (is_dir) { // td::rmdir(path); //} else { |
