aboutsummaryrefslogtreecommitdiffhomepage
path: root/benchmark
diff options
context:
space:
mode:
authorArseny Smirnov <arseny30@gmail.com>2019-05-04 19:05:17 +0200
committerArseny Smirnov <arseny30@gmail.com>2019-05-04 19:05:17 +0200
commit1aa86c15be46d091e6b42be5a535efd0276d6516 (patch)
tree02626756c40ad6fc14cce6bb08482c7c056dbb16 /benchmark
parent78319557792058a5d5f2a213e301dcab62af3c68 (diff)
CE fix
GitOrigin-RevId: 14f5e0e38a771f42213ab544ef065da86425dbc5
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/bench_misc.cpp17
-rw-r--r--benchmark/rmdir.cpp8
2 files changed, 15 insertions, 10 deletions
diff --git a/benchmark/bench_misc.cpp b/benchmark/bench_misc.cpp
index 7d87f30f0..227cb1097 100644
--- a/benchmark/bench_misc.cpp
+++ b/benchmark/bench_misc.cpp
@@ -223,10 +223,10 @@ class CreateFileBench : public Benchmark {
}
void tear_down() override {
td::walk_path("A/",
- [&](CSlice path, bool is_dir) {
- if (is_dir) {
+ [&](CSlice path, auto type) {
+ if (type == td::WalkPath::Type::ExitDir) {
rmdir(path).ignore();
- } else {
+ } else if (type == td::WalkPath::Type::NotDir) {
unlink(path).ignore();
}
})
@@ -247,7 +247,10 @@ class WalkPathBench : public Benchmark {
void run(int n) override {
int cnt = 0;
td::walk_path("A/",
- [&](CSlice path, bool is_dir) {
+ [&](CSlice path, auto type) {
+ if (type == td::WalkPath::Type::EnterDir) {
+ return;
+ }
stat(path).ok();
cnt++;
})
@@ -255,10 +258,10 @@ class WalkPathBench : public Benchmark {
}
void tear_down() override {
td::walk_path("A/",
- [&](CSlice path, bool is_dir) {
- if (is_dir) {
+ [&](CSlice path, auto type) {
+ if (type == td::WalkPath::Type::ExitDir) {
rmdir(path).ignore();
- } else {
+ } else if (type == td::WalkPath::Type::NotDir) {
unlink(path).ignore();
}
})
diff --git a/benchmark/rmdir.cpp b/benchmark/rmdir.cpp
index 60b8b6c3c..456b3ae6e 100644
--- a/benchmark/rmdir.cpp
+++ b/benchmark/rmdir.cpp
@@ -14,9 +14,11 @@ int main(int argc, char *argv[]) {
}
td::CSlice dir(argv[1]);
int cnt = 0;
- auto status = td::walk_path(dir, [&](td::CSlice path, bool is_dir) {
- cnt++;
- LOG(INFO) << path << " " << is_dir;
+ 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);
+ }
//if (is_dir) {
// td::rmdir(path);
//} else {