From 1ac2dfef30d53183ade197fdac26e05720214a39 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 14 Sep 2022 15:06:52 +0300 Subject: Replace ConcurrentScheduler::init with constructor. --- benchmark/bench_actor.cpp | 9 +++------ benchmark/bench_db.cpp | 6 ++---- benchmark/bench_http.cpp | 3 +-- benchmark/bench_http_server.cpp | 3 +-- benchmark/bench_http_server_cheat.cpp | 3 +-- benchmark/bench_http_server_fast.cpp | 3 +-- benchmark/bench_tddb.cpp | 3 +-- benchmark/wget.cpp | 3 +-- 8 files changed, 11 insertions(+), 22 deletions(-) (limited to 'benchmark') diff --git a/benchmark/bench_actor.cpp b/benchmark/bench_actor.cpp index b3a04f592..afe94ca3c 100644 --- a/benchmark/bench_actor.cpp +++ b/benchmark/bench_actor.cpp @@ -46,10 +46,9 @@ class ActorTraits { } // namespace td class CreateActorBench final : public td::Benchmark { - td::ConcurrentScheduler scheduler_; + td::ConcurrentScheduler scheduler_{0, 0}; void start_up() final { - scheduler_.init(0); scheduler_.start(); } @@ -140,8 +139,7 @@ class RingBench final : public td::Benchmark { } void start_up() final { - scheduler_ = new td::ConcurrentScheduler(); - scheduler_->init(thread_n_); + scheduler_ = new td::ConcurrentScheduler(thread_n_, 0); actor_array_ = td::vector>(actor_n_); for (int i = 0; i < actor_n_; i++) { @@ -293,8 +291,7 @@ class QueryBench final : public td::Benchmark { }; void start_up() final { - scheduler_ = new td::ConcurrentScheduler(); - scheduler_->init(0); + scheduler_ = new td::ConcurrentScheduler(0, 0); server_ = scheduler_->create_actor_unsafe(0, "Server"); scheduler_->start(); diff --git a/benchmark/bench_db.cpp b/benchmark/bench_db.cpp index b257951c5..822a91593 100644 --- a/benchmark/bench_db.cpp +++ b/benchmark/bench_db.cpp @@ -29,7 +29,7 @@ template class TdKvBench final : public td::Benchmark { - td::ConcurrentScheduler sched; + td::ConcurrentScheduler sched{1, 0}; td::string name_; public: @@ -72,7 +72,6 @@ class TdKvBench final : public td::Benchmark { }; void start_up_n(int n) final { - sched.init(1); sched.create_actor_unsafe
(1, "Main", n).release(); } @@ -179,8 +178,7 @@ class SqliteKeyValueAsyncBench final : public td::Benchmark { td::unique_ptr sqlite_kv_async_; td::Status do_start_up() { - scheduler_ = td::make_unique(); - scheduler_->init(1); + scheduler_ = td::make_unique(1, 0); auto guard = scheduler_->get_main_guard(); diff --git a/benchmark/bench_http.cpp b/benchmark/bench_http.cpp index fe90d32a2..70fdb909c 100644 --- a/benchmark/bench_http.cpp +++ b/benchmark/bench_http.cpp @@ -66,8 +66,7 @@ class HttpClient final : public td::HttpOutboundConnection::Callback { int main() { SET_VERBOSITY_LEVEL(VERBOSITY_NAME(ERROR)); - auto scheduler = td::make_unique(); - scheduler->init(0); + auto scheduler = td::make_unique(0, 0); scheduler->create_actor_unsafe(0, "Client1").release(); scheduler->create_actor_unsafe(0, "Client2").release(); scheduler->start(); diff --git a/benchmark/bench_http_server.cpp b/benchmark/bench_http_server.cpp index 7ce892a48..33cde9ef8 100644 --- a/benchmark/bench_http_server.cpp +++ b/benchmark/bench_http_server.cpp @@ -74,8 +74,7 @@ class Server final : public td::TcpListener::Callback { int main() { SET_VERBOSITY_LEVEL(VERBOSITY_NAME(ERROR)); - auto scheduler = td::make_unique(); - scheduler->init(N, 0); + auto scheduler = td::make_unique(N, 0); scheduler->create_actor_unsafe(0, "Server").release(); scheduler->start(); while (scheduler->run_main(10)) { diff --git a/benchmark/bench_http_server_cheat.cpp b/benchmark/bench_http_server_cheat.cpp index 8661ba4c1..8bbd768b4 100644 --- a/benchmark/bench_http_server_cheat.cpp +++ b/benchmark/bench_http_server_cheat.cpp @@ -121,8 +121,7 @@ class Server final : public td::TcpListener::Callback { int main() { SET_VERBOSITY_LEVEL(VERBOSITY_NAME(ERROR)); - auto scheduler = td::make_unique(); - scheduler->init(N, 0); + auto scheduler = td::make_unique(N, 0); scheduler->create_actor_unsafe(0, "Server").release(); scheduler->start(); while (scheduler->run_main(10)) { diff --git a/benchmark/bench_http_server_fast.cpp b/benchmark/bench_http_server_fast.cpp index 1c272d96b..4b140422f 100644 --- a/benchmark/bench_http_server_fast.cpp +++ b/benchmark/bench_http_server_fast.cpp @@ -106,8 +106,7 @@ class Server final : public td::TcpListener::Callback { int main() { SET_VERBOSITY_LEVEL(VERBOSITY_NAME(ERROR)); - auto scheduler = td::make_unique(); - scheduler->init(N, 0); + auto scheduler = td::make_unique(N, 0); scheduler->create_actor_unsafe(0, "Server").release(); scheduler->start(); while (scheduler->run_main(10)) { diff --git a/benchmark/bench_tddb.cpp b/benchmark/bench_tddb.cpp index eb6880359..b41033c6e 100644 --- a/benchmark/bench_tddb.cpp +++ b/benchmark/bench_tddb.cpp @@ -87,8 +87,7 @@ class MessagesDbBench final : public td::Benchmark { std::shared_ptr messages_db_async_; td::Status do_start_up() { - scheduler_ = td::make_unique(); - scheduler_->init(1); + scheduler_ = td::make_unique(1, 0); auto guard = scheduler_->get_main_guard(); diff --git a/benchmark/wget.cpp b/benchmark/wget.cpp index 1fdfc2af1..5145f317f 100644 --- a/benchmark/wget.cpp +++ b/benchmark/wget.cpp @@ -23,8 +23,7 @@ int main(int argc, char *argv[]) { auto timeout = 10; auto ttl = 3; auto prefer_ipv6 = (argc > 2 && td::string(argv[2]) == "-6"); - auto scheduler = td::make_unique(); - scheduler->init(0); + auto scheduler = td::make_unique(0, 0); scheduler ->create_actor_unsafe(0, "Client", td::PromiseCreator::lambda([](td::Result> res) { -- cgit v1.2.3