Bench logs with variable number of threads.
GitOrigin-RevId: 08e2af2e8fa53b9cec8ac70c3922c6912dd39ff1
This commit is contained in:
parent
dc96827a93
commit
462197e260
@ -68,17 +68,21 @@ class LogBenchmark : public td::Benchmark {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class F>
|
template <class F>
|
||||||
static void bench_log(std::string name, int threads_n, F &&f) {
|
static void bench_log(std::string name, F &&f) {
|
||||||
bench(LogBenchmark<typename decltype(f())::element_type>(std::move(name), threads_n, std::move(f)));
|
for (auto threads_n : {1, 4, 8}) {
|
||||||
|
bench(LogBenchmark<typename decltype(f())::element_type>(name, threads_n, f));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(Log, Bench) {
|
TEST(Log, Bench) {
|
||||||
bench_log("MemoryLog", 4, [] { return td::make_unique<td::MemoryLog<1 << 20>>(); });
|
bench_log("NullLog", [] { return td::make_unique<td::NullLog>(); });
|
||||||
|
|
||||||
bench_log("TsFileLog", 4,
|
bench_log("MemoryLog", [] { return td::make_unique<td::MemoryLog<1 << 20>>(); });
|
||||||
|
|
||||||
|
bench_log("TsFileLog",
|
||||||
[] { return td::TsFileLog::create("tmplog", std::numeric_limits<td::int64>::max(), false).move_as_ok(); });
|
[] { return td::TsFileLog::create("tmplog", std::numeric_limits<td::int64>::max(), false).move_as_ok(); });
|
||||||
|
|
||||||
bench_log("FileLog + TsLog", 8, [] {
|
bench_log("FileLog + TsLog", [] {
|
||||||
class FileLog : public td::LogInterface {
|
class FileLog : public td::LogInterface {
|
||||||
public:
|
public:
|
||||||
FileLog() {
|
FileLog() {
|
||||||
@ -101,16 +105,7 @@ TEST(Log, Bench) {
|
|||||||
return td::make_unique<FileLog>();
|
return td::make_unique<FileLog>();
|
||||||
});
|
});
|
||||||
|
|
||||||
bench_log("noop", 4, [] {
|
bench_log("FileLog", [] {
|
||||||
class NoopLog : public td::LogInterface {
|
|
||||||
public:
|
|
||||||
void append(td::CSlice slice, int log_level) override {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return td::make_unique<NoopLog>();
|
|
||||||
});
|
|
||||||
|
|
||||||
bench_log("FileLog", 4, [] {
|
|
||||||
class FileLog : public td::LogInterface {
|
class FileLog : public td::LogInterface {
|
||||||
public:
|
public:
|
||||||
FileLog() {
|
FileLog() {
|
||||||
|
Loading…
Reference in New Issue
Block a user