mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 16:31:02 +03:00
d0fb86a240
Summary: To help investigate a Linux kernel performance dropoff where the kernel falsely thinks the EdenFS FUSE mount can't handle dirty page writes at a high rate, add a 4k random writes benchmark. Reviewed By: simpkins Differential Revision: D21328771 fbshipit-source-id: c9977bd2e291d01e92631094aba3d8d807ec62da
35 lines
771 B
C++
35 lines
771 B
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This software may be used and distributed according to the terms of the
|
|
* GNU General Public License version 2.
|
|
*/
|
|
|
|
#include <folly/Exception.h>
|
|
#include <folly/File.h>
|
|
#include <gflags/gflags.h>
|
|
#include "eden/fs/benchharness/Bench.h"
|
|
|
|
namespace {
|
|
|
|
DEFINE_string(
|
|
filename,
|
|
"stat.tmp",
|
|
"Path which should be opened and repeatedly stat'd");
|
|
|
|
void call_fstat(benchmark::State& state) {
|
|
folly::File file{FLAGS_filename, O_CREAT | O_RDONLY | O_CLOEXEC};
|
|
struct stat buf;
|
|
|
|
for (auto _ : state) {
|
|
folly::checkUnixError(::fstat(file.fd(), &buf), "fstat failed");
|
|
}
|
|
|
|
folly::checkUnixError(::unlink(FLAGS_filename.c_str()));
|
|
}
|
|
BENCHMARK(call_fstat);
|
|
|
|
} // namespace
|
|
|
|
EDEN_BENCHMARK_MAIN();
|