diff options
author | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-02-09 12:02:03 +0300 |
---|---|---|
committer | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-02-09 12:02:03 +0300 |
commit | 416b62668249e5744697c7b87783c83b991996a6 (patch) | |
tree | dedf11bd3bfc59b5c2cdbf6ef1b80a0be98e519c /library/cpp | |
parent | 87b0a5af3f32f90698677ebce58ad575e4d9838a (diff) | |
download | ydb-416b62668249e5744697c7b87783c83b991996a6.tar.gz |
tasks calculation improve
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/actors/core/actorsystem.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/library/cpp/actors/core/actorsystem.h b/library/cpp/actors/core/actorsystem.h index 8051f5ee573..591eaf96b7b 100644 --- a/library/cpp/actors/core/actorsystem.h +++ b/library/cpp/actors/core/actorsystem.h @@ -124,6 +124,15 @@ namespace NActors { ui32 GetThreads(ui32 poolId) const { return Executors ? Executors[poolId]->GetThreads() : CpuManager.GetThreads(poolId); } + + std::optional<ui32> GetThreads(const TString& poolName) const { + for (ui32 i = 0; i < GetExecutorsCount(); ++i) { + if (GetPoolName(i) == poolName) { + return GetThreads(i); + } + } + return {}; + } }; class TActorSystem : TNonCopyable { @@ -284,6 +293,12 @@ namespace NActors { } void GetPoolStats(ui32 poolId, TExecutorPoolStats& poolStats, TVector<TExecutorThreadStats>& statsCopy) const; + std::optional<ui32> GetPoolThreadsCount(const TString& poolName) const { + if (!SystemSetup) { + return {}; + } + return SystemSetup->GetThreads(poolName); + } void DeferPreStop(std::function<void()> fn) { DeferredPreStop.push_back(std::move(fn)); |