aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2023-03-28 21:29:00 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2023-03-28 21:29:00 +0300
commitfe95bd00f0285446bcc12cef35a29f86c3e049e2 (patch)
treeeb6b422d5d1d70b72f36cb4de0a9e2b6f18b5915
parent27b064e59b1f6c46c6dae20922bdee1110a562c6 (diff)
downloadydb-fe95bd00f0285446bcc12cef35a29f86c3e049e2.tar.gz
Intermediate changes
-rw-r--r--library/cpp/actors/core/actor_ut.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/library/cpp/actors/core/actor_ut.cpp b/library/cpp/actors/core/actor_ut.cpp
index f985108e75..abf1b96478 100644
--- a/library/cpp/actors/core/actor_ut.cpp
+++ b/library/cpp/actors/core/actor_ut.cpp
@@ -71,7 +71,7 @@ Y_UNIT_TEST_SUITE(ActorBenchmark) {
{}
void Bootstrap(const TActorContext &ctx) {
- if (!Receiver) {
+ if (!Receiver && Role == ERole::Leader) {
this->Receiver = SelfId();
} else {
EventsCounter /= 2; // We want to measure CPU requirement for one-way send
@@ -88,6 +88,7 @@ Y_UNIT_TEST_SUITE(ActorBenchmark) {
}
void SpecialSend(TAutoPtr<IEventHandle> ev, const TActorContext &ctx) {
+ --EventsCounter;
if (SendingType == ESendingType::Lazy) {
ctx.Send<ESendingType::Lazy>(ev);
} else if (SendingType == ESendingType::Tail) {
@@ -97,14 +98,21 @@ Y_UNIT_TEST_SUITE(ActorBenchmark) {
}
}
- STFUNC(StateFunc) {
- if (--EventsCounter == 0) {
+ bool CheckWorkIsDone() {
+ if (EventsCounter == 0) {
if (ElapsedTime != nullptr) {
*ElapsedTime = Timer.Passed() / TotalEventsAmount;
}
PassAway();
- return;
+ Cerr << "-";
+ return true;
}
+ return false;
+ }
+
+ STFUNC(StateFunc) {
+ if (CheckWorkIsDone())
+ return;
if (AllocatesMemory) {
SpecialSend(new IEventHandle(ev->Sender, SelfId(), new TEvents::TEvPing()), ctx);
@@ -113,6 +121,8 @@ Y_UNIT_TEST_SUITE(ActorBenchmark) {
ev->DropRewrite();
SpecialSend(ev, ctx);
}
+
+ CheckWorkIsDone();
}
private:
@@ -502,7 +512,7 @@ Y_UNIT_TEST_SUITE(ActorBenchmark) {
auto stats = CountStats([threads, actorPairs] {
return BenchContentedThreads(threads, actorPairs, EPoolType::Basic, ESendingType::Common);
});
- Cerr << threads << "," << actorPairs << "," << actorPairs * TotalEventsAmount / stats.Mean * 1e9 << Endl;
+ Cerr << threads << "," << actorPairs << "," << actorPairs * 1e9 / stats.Mean << Endl;
}
}
}