aboutsummaryrefslogtreecommitdiffhomepage
path: root/benchmark
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2022-09-14 15:06:52 +0300
committerlevlam <levlam@telegram.org>2022-09-14 15:06:52 +0300
commit1ac2dfef30d53183ade197fdac26e05720214a39 (patch)
tree00a09c5fe485b08dd6fdba6470c9dd4fea3be32b /benchmark
parent70e3586626f8fe3edb878eb94b36abb1dafdf0cb (diff)
Replace ConcurrentScheduler::init with constructor.
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/bench_actor.cpp9
-rw-r--r--benchmark/bench_db.cpp6
-rw-r--r--benchmark/bench_http.cpp3
-rw-r--r--benchmark/bench_http_server.cpp3
-rw-r--r--benchmark/bench_http_server_cheat.cpp3
-rw-r--r--benchmark/bench_http_server_fast.cpp3
-rw-r--r--benchmark/bench_tddb.cpp3
-rw-r--r--benchmark/wget.cpp3
8 files changed, 11 insertions, 22 deletions
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<TestActor> {
} // 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<td::ActorId<PassActor>>(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<ServerActor>(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 KeyValueT>
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<Main>(1, "Main", n).release();
}
@@ -179,8 +178,7 @@ class SqliteKeyValueAsyncBench final : public td::Benchmark {
td::unique_ptr<td::SqliteKeyValueAsyncInterface> sqlite_kv_async_;
td::Status do_start_up() {
- scheduler_ = td::make_unique<td::ConcurrentScheduler>();
- scheduler_->init(1);
+ scheduler_ = td::make_unique<td::ConcurrentScheduler>(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<td::ConcurrentScheduler>();
- scheduler->init(0);
+ auto scheduler = td::make_unique<td::ConcurrentScheduler>(0, 0);
scheduler->create_actor_unsafe<HttpClient>(0, "Client1").release();
scheduler->create_actor_unsafe<HttpClient>(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<td::ConcurrentScheduler>();
- scheduler->init(N, 0);
+ auto scheduler = td::make_unique<td::ConcurrentScheduler>(N, 0);
scheduler->create_actor_unsafe<Server>(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<td::ConcurrentScheduler>();
- scheduler->init(N, 0);
+ auto scheduler = td::make_unique<td::ConcurrentScheduler>(N, 0);
scheduler->create_actor_unsafe<Server>(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<td::ConcurrentScheduler>();
- scheduler->init(N, 0);
+ auto scheduler = td::make_unique<td::ConcurrentScheduler>(N, 0);
scheduler->create_actor_unsafe<Server>(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<td::MessagesDbAsyncInterface> messages_db_async_;
td::Status do_start_up() {
- scheduler_ = td::make_unique<td::ConcurrentScheduler>();
- scheduler_->init(1);
+ scheduler_ = td::make_unique<td::ConcurrentScheduler>(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<td::ConcurrentScheduler>();
- scheduler->init(0);
+ auto scheduler = td::make_unique<td::ConcurrentScheduler>(0, 0);
scheduler
->create_actor_unsafe<td::Wget>(0, "Client",
td::PromiseCreator::lambda([](td::Result<td::unique_ptr<td::HttpQuery>> res) {