diff options
| author | levlam <levlam@telegram.org> | 2021-07-03 23:51:36 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2021-07-03 23:51:36 +0300 |
| commit | edfa5d1d982a8d499877eb9fafc5192a0baa2974 (patch) | |
| tree | 0badfea5d1ec8da265586cb737aaf3f1549d8b5c /benchmark/bench_log.cpp | |
| parent | 3ead565d675c0317abcfdb70b28eac3bb5659425 (diff) | |
Use final instead of override.
Diffstat (limited to 'benchmark/bench_log.cpp')
| -rw-r--r-- | benchmark/bench_log.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/benchmark/bench_log.cpp b/benchmark/bench_log.cpp index 5d8cf8c7d..723d8931b 100644 --- a/benchmark/bench_log.cpp +++ b/benchmark/bench_log.cpp @@ -44,24 +44,24 @@ class IostreamWriteBench : public td::Benchmark { char buffer[BUFFER_SIZE]; public: - std::string get_description() const override { + std::string get_description() const final { return "ostream (to file, no buf, no flush)"; } - void start_up() override { + void start_up() final { file_name_ = create_tmp_file(); stream.open(file_name_.c_str()); CHECK(stream.is_open()); // stream.rdbuf()->pubsetbuf(buffer, BUFFER_SIZE); } - void run(int n) override { + void run(int n) final { for (int i = 0; i < n; i++) { stream << "This is just for test" << 987654321 << '\n'; } } - void tear_down() override { + void tear_down() final { stream.close(); unlink(file_name_.c_str()); } @@ -75,24 +75,24 @@ class FILEWriteBench : public td::Benchmark { char buffer[BUFFER_SIZE]; public: - std::string get_description() const override { + std::string get_description() const final { return "std::fprintf (to file, no buf, no flush)"; } - void start_up() override { + void start_up() final { file_name_ = create_tmp_file(); file = fopen(file_name_.c_str(), "w"); // setvbuf(file, buffer, _IOFBF, BUFFER_SIZE); } - void run(int n) override { + void run(int n) final { for (int i = 0; i < n; i++) { std::fprintf(file, "This is just for test%d\n", 987654321); // std::fflush(file); } } - void tear_down() override { + void tear_down() final { std::fclose(file); unlink(file_name_.c_str()); } @@ -103,17 +103,17 @@ class FILEWriteBench : public td::Benchmark { #define ALOG(...) __android_log_print(ANDROID_LOG_VERBOSE, "XXX", __VA_ARGS__) class ALogWriteBench : public td::Benchmark { public: - std::string get_description() const override { + std::string get_description() const final { return "android_log"; } - void start_up() override { + void start_up() final { } - void run(int n) override { + void run(int n) final { for (int i = 0; i < n; i++) { ALOG("This is just for test%d\n", 987654321); } } - void tear_down() override { + void tear_down() final { } }; #endif @@ -127,24 +127,24 @@ class LogWriteBench : public td::Benchmark { char buffer[BUFFER_SIZE]; public: - std::string get_description() const override { + std::string get_description() const final { return "td_log (slow in debug mode)"; } - void start_up() override { + void start_up() final { file_name_ = create_tmp_file(); stream.open(file_name_.c_str()); CHECK(stream.is_open()); old_buf = std::cerr.rdbuf(stream.rdbuf()); } - void run(int n) override { + void run(int n) final { for (int i = 0; i < n; i++) { LOG(DEBUG) << "This is just for test" << 987654321; } } - void tear_down() override { + void tear_down() final { stream.close(); unlink(file_name_.c_str()); std::cerr.rdbuf(old_buf); |
