From edfde13751035fc8a91a82fa7824966b49b8cfc1 Mon Sep 17 00:00:00 2001 From: Maksim Kita Date: Thu, 21 Dec 2023 17:33:02 +0300 Subject: [PATCH] ActorSystem fix typo --- ydb/library/actors/core/executor_pool_basic.cpp | 14 +++++++------- ydb/library/actors/core/executor_pool_basic.h | 2 +- ydb/library/actors/core/executor_pool_basic_ut.cpp | 12 ++++++------ ydb/library/actors/core/ut_fat/actor_benchmark.cpp | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ydb/library/actors/core/executor_pool_basic.cpp b/ydb/library/actors/core/executor_pool_basic.cpp index f7562782402b..f316201ef769 100644 --- a/ydb/library/actors/core/executor_pool_basic.cpp +++ b/ydb/library/actors/core/executor_pool_basic.cpp @@ -90,7 +90,7 @@ namespace NActors { ThreadCount = MaxThreadCount; auto semaphore = TSemaphore(); semaphore.CurrentThreadCount = ThreadCount; - Semaphore = semaphore.ConverToI64(); + Semaphore = semaphore.ConvertToI64(); } TBasicExecutorPool::TBasicExecutorPool(const TBasicExecutorPoolConfig& cfg, IHarmonizer *harmonizer) @@ -126,7 +126,7 @@ namespace NActors { TSemaphore semaphore = TSemaphore::GetSemaphore(x);; if (semaphore.CurrentSleepThreadCount < 0) { semaphore.CurrentSleepThreadCount++; - x = AtomicGetAndCas(&Semaphore, semaphore.ConverToI64(), x); + x = AtomicGetAndCas(&Semaphore, semaphore.ConvertToI64(), x); if (x == oldX) { *needToWait = true; *needToBlock = true; @@ -140,7 +140,7 @@ namespace NActors { if (semaphore.CurrentSleepThreadCount == AtomicLoad(&ThreadCount)) { AllThreadsSleep.store(true); } - x = AtomicGetAndCas(&Semaphore, semaphore.ConverToI64(), x); + x = AtomicGetAndCas(&Semaphore, semaphore.ConvertToI64(), x); if (x == oldX) { *needToWait = true; *needToBlock = false; @@ -285,12 +285,12 @@ namespace NActors { do { needToWakeUp = semaphore.CurrentSleepThreadCount > SharedExecutorsCount; - i64 oldX = semaphore.ConverToI64(); + i64 oldX = semaphore.ConvertToI64(); semaphore.OldSemaphore++; if (needToWakeUp) { semaphore.CurrentSleepThreadCount--; } - x = AtomicGetAndCas(&Semaphore, semaphore.ConverToI64(), oldX); + x = AtomicGetAndCas(&Semaphore, semaphore.ConvertToI64(), oldX); if (x == oldX) { break; } @@ -495,14 +495,14 @@ namespace NActors { i16 prevCount = GetThreadCount(); AtomicSet(ThreadCount, threads); TSemaphore semaphore = TSemaphore::GetSemaphore(AtomicGet(Semaphore)); - i64 oldX = semaphore.ConverToI64(); + i64 oldX = semaphore.ConvertToI64(); semaphore.CurrentThreadCount = threads; if (threads > prevCount) { semaphore.CurrentSleepThreadCount += (i64)threads - prevCount; } else { semaphore.CurrentSleepThreadCount -= (i64)prevCount - threads; } - AtomicAdd(Semaphore, semaphore.ConverToI64() - oldX); + AtomicAdd(Semaphore, semaphore.ConvertToI64() - oldX); LWPROBE(ThreadCount, PoolId, PoolName, threads, MinThreadCount, MaxThreadCount, DefaultThreadCount); } } diff --git a/ydb/library/actors/core/executor_pool_basic.h b/ydb/library/actors/core/executor_pool_basic.h index acacbcf2802c..576c3b0b2922 100644 --- a/ydb/library/actors/core/executor_pool_basic.h +++ b/ydb/library/actors/core/executor_pool_basic.h @@ -173,7 +173,7 @@ namespace NActors { // Sign bit i16 CurrentThreadCount = 0; // 14 bits - inline i64 ConverToI64() { + inline i64 ConvertToI64() { i64 value = (1ll << 34) + OldSemaphore; return value | (((i64)CurrentSleepThreadCount + (1 << 14)) << 35) diff --git a/ydb/library/actors/core/executor_pool_basic_ut.cpp b/ydb/library/actors/core/executor_pool_basic_ut.cpp index b61f1e144b6f..754625c42ba8 100644 --- a/ydb/library/actors/core/executor_pool_basic_ut.cpp +++ b/ydb/library/actors/core/executor_pool_basic_ut.cpp @@ -225,21 +225,21 @@ Y_UNIT_TEST_SUITE(BasicExecutorPool) { TBasicExecutorPool::TSemaphore semaphore; semaphore = TBasicExecutorPool::TSemaphore::GetSemaphore(0); - VALUES_EQUAL(0, semaphore.ConverToI64()); + VALUES_EQUAL(0, semaphore.ConvertToI64()); semaphore = TBasicExecutorPool::TSemaphore::GetSemaphore(-1); - VALUES_EQUAL(-1, semaphore.ConverToI64()); + VALUES_EQUAL(-1, semaphore.ConvertToI64()); semaphore = TBasicExecutorPool::TSemaphore::GetSemaphore(1); - VALUES_EQUAL(1, semaphore.ConverToI64()); + VALUES_EQUAL(1, semaphore.ConvertToI64()); for (i64 value = -1'000'000; value <= 1'000'000; ++value) { - VALUES_EQUAL(TBasicExecutorPool::TSemaphore::GetSemaphore(value).ConverToI64(), value); + VALUES_EQUAL(TBasicExecutorPool::TSemaphore::GetSemaphore(value).ConvertToI64(), value); } for (i8 sleepThreads = -10; sleepThreads <= 10; ++sleepThreads) { semaphore = TBasicExecutorPool::TSemaphore(); semaphore.CurrentSleepThreadCount = sleepThreads; - i64 initialValue = semaphore.ConverToI64(); + i64 initialValue = semaphore.ConvertToI64(); semaphore = TBasicExecutorPool::TSemaphore::GetSemaphore(initialValue - 1); VALUES_EQUAL(-1, semaphore.OldSemaphore); @@ -257,7 +257,7 @@ Y_UNIT_TEST_SUITE(BasicExecutorPool) { semaphore = TBasicExecutorPool::TSemaphore(); semaphore.OldSemaphore = expected; semaphore.CurrentSleepThreadCount = sleepThreads; - UNIT_ASSERT_VALUES_EQUAL(semaphore.ConverToI64(), value); + UNIT_ASSERT_VALUES_EQUAL(semaphore.ConvertToI64(), value); value++; } diff --git a/ydb/library/actors/core/ut_fat/actor_benchmark.cpp b/ydb/library/actors/core/ut_fat/actor_benchmark.cpp index ed092603edbe..ae125fded834 100644 --- a/ydb/library/actors/core/ut_fat/actor_benchmark.cpp +++ b/ydb/library/actors/core/ut_fat/actor_benchmark.cpp @@ -30,7 +30,7 @@ Y_UNIT_TEST_SUITE(HeavyActorBenchmark) { threadsList.push_back(threads); } std::vector actorPairsList = {512}; - TActorBenchmark::RunSendActivateReceiveCSV(threadsList, actorPairsList, {1,100, 200}, TDuration::Seconds(1)); + TActorBenchmark::RunSendActivateReceiveCSV(threadsList, actorPairsList, {1,100, 200}, TDuration::Seconds(1)); } Y_UNIT_TEST(StarSendActivateReceiveCSV) { @@ -40,7 +40,7 @@ Y_UNIT_TEST_SUITE(HeavyActorBenchmark) { } std::vector actorPairsList = {512}; std::vector starsList = {10}; - TActorBenchmark::RunStarSendActivateReceiveCSV(threadsList, actorPairsList, starsList); + TActorBenchmark::RunStarSendActivateReceiveCSV(threadsList, actorPairsList, starsList); } }