@@ -111,6 +111,9 @@ class TLocalNodeRegistrar : public TActorBootstrapped<TLocalNodeRegistrar> {
111
111
ui64 MemLimit = 0 ;
112
112
double NodeUsage = 0 ;
113
113
114
+ TInstant LastUpdate;
115
+ std::vector<TExecutorPoolState> PreviousStates;
116
+
114
117
bool SentDrainNode = false ;
115
118
bool DrainResultReceived = false ;
116
119
i32 PrevEstimate = 0 ;
@@ -278,15 +281,35 @@ class TLocalNodeRegistrar : public TActorBootstrapped<TLocalNodeRegistrar> {
278
281
auto & record = eventStatus->Record ;
279
282
record.SetStartTime (StartTime.GetValue ());
280
283
record.MutableResourceMaximum ()->CopyFrom (ResourceLimit);
284
+ std::vector<NActors::TExecutorPoolState> poolStates;
285
+ ctx.ExecutorThread .ActorSystem ->GetExecutorPoolStates (poolStates);
286
+
287
+ TDuration passedTime = ctx.Now () - LastUpdate;
288
+ LastUpdate = ctx.Now ();
289
+
290
+ auto *actorSystemInfo = record.MutableActorSystemInfo ();
291
+ double cores = 0 ;
292
+ for (ui8 poolId = 0 ; poolId < poolStates.size (); ++poolId) {
293
+ auto &poolState = poolStates[poolId];
294
+ if (poolId != AppData ()->IOPoolId ) {
295
+ cores += poolState.MinLimit ;
296
+ }
297
+ auto *poolInfo = actorSystemInfo->AddPools ();
298
+ double passedElapsedUs = poolState.ElapsedUs ;
299
+ if (PreviousStates.size ()) {
300
+ passedElapsedUs -= PreviousStates[poolId].ElapsedUs ;
301
+ }
302
+ poolInfo->SetUsedCores (passedElapsedUs / passedTime.MicroSeconds ());
303
+ poolInfo->SetCurrentLimit (poolState.CurrentLimit );
304
+ poolInfo->SetPossibleMaxLimit (poolState.PossibleMaxLimit );
305
+ }
306
+ actorSystemInfo->SetCores (cores);
281
307
if (!record.GetResourceMaximum ().HasCPU ()) {
282
- TExecutorPoolStats poolStats;
283
- TVector<TExecutorThreadStats> statsCopy;
284
- TVector<TExecutorThreadStats> sharedStatsCopy;
285
- ctx.ExecutorThread .ActorSystem ->GetPoolStats (AppData ()->UserPoolId , poolStats, statsCopy, sharedStatsCopy);
286
- if (!statsCopy.empty ()) {
287
- record.MutableResourceMaximum ()->SetCPU (poolStats.CurrentThreadCount * 1000000 );
308
+ if (!poolStates.empty ()) {
309
+ record.MutableResourceMaximum ()->SetCPU (poolStates[AppData ()->UserPoolId ].PossibleMaxLimit * 1000000 );
288
310
}
289
311
}
312
+ PreviousStates.swap (poolStates);
290
313
if (!record.GetResourceMaximum ().HasMemory ()) {
291
314
if (MemLimit != 0 ) {
292
315
record.MutableResourceMaximum ()->SetMemory (MemLimit);
@@ -649,7 +672,7 @@ class TLocalNodeRegistrar : public TActorBootstrapped<TLocalNodeRegistrar> {
649
672
const NKikimrWhiteboard::TSystemStateInfo& info = record.GetSystemStateInfo (0 );
650
673
if (static_cast <ui32>(info.PoolStatsSize ()) > AppData ()->UserPoolId ) {
651
674
const auto & poolStats (info.GetPoolStats (AppData ()->UserPoolId ));
652
- UserPoolUsage = poolStats.usage () * poolStats.threads () * 1000000 ; // uS
675
+ UserPoolUsage = poolStats.usage () * poolStats.limit () * 1000000 ; // uS
653
676
}
654
677
655
678
// Note: we use allocated memory because MemoryUsed(AnonRSS) has lag
0 commit comments