Skip to content

Commit 1f973a1

Browse files
committed
Revert "As/add more actor system activity (ydb-platform#5052)"
This reverts commit a4e2878.
1 parent 1fcc777 commit 1f973a1

File tree

7 files changed

+12
-113
lines changed

7 files changed

+12
-113
lines changed

ydb/library/actors/actor_type/common.h

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,6 @@ enum class EInternalActorType {
2929
NAMESERVICE,
3030
DNS_RESOLVER,
3131
INTERCONNECT_PROXY_WRAPPER,
32-
ACTOR_COROUTINE,
32+
ACTOR_COROUTINE
3333
};
34-
35-
enum class EInternalActorSystemActivity {
36-
ACTOR_SYSTEM_SPIN,
37-
ACTOR_SYSTEM_HARMONIZER,
38-
ACTOR_SYSTEM_SEND,
39-
ACTOR_SYSTEM_REGISTER,
40-
ACTOR_SYSTEM_GET_ACTIVATION,
41-
ACTOR_SYSTEM_GET_ACTIVATION_FROM_QUEUE,
42-
ACTOR_SYSTEM_WAKE_UP,
43-
};
44-
4534
}

ydb/library/actors/core/activity_guard.h

Lines changed: 0 additions & 73 deletions
This file was deleted.

ydb/library/actors/core/actorsystem.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "defs.h"
2-
#include "activity_guard.h"
32
#include "actorsystem.h"
43
#include "callstack.h"
54
#include "cpu_manager.h"
@@ -97,7 +96,6 @@ namespace NActors {
9796
if (Y_UNLIKELY(!ev))
9897
return false;
9998

100-
TInternalActorTypeGuard<EInternalActorSystemActivity::ACTOR_SYSTEM_SEND> activityGuard;
10199
#ifdef USE_ACTOR_CALLSTACK
102100
ev->Callstack.TraceIfEmpty();
103101
#endif

ydb/library/actors/core/executor_pool_base.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ namespace NActors {
149149

150150
TActorId TExecutorPoolBaseMailboxed::Register(IActor* actor, TMailboxType::EType mailboxType, ui64 revolvingWriteCounter, const TActorId& parentId) {
151151
NHPTimer::STime hpstart = GetCycleCountFast();
152-
TInternalActorTypeGuard<EInternalActorSystemActivity::ACTOR_SYSTEM_REGISTER> activityGuard(hpstart);
153152
#ifdef ACTORSLIB_COLLECT_EXEC_STATS
154153
ui32 at = actor->GetActivityType();
155154
Y_DEBUG_ABORT_UNLESS(at < Stats.ActorsAliveByActivity.size());
@@ -237,7 +236,6 @@ namespace NActors {
237236

238237
TActorId TExecutorPoolBaseMailboxed::Register(IActor* actor, TMailboxHeader* mailbox, ui32 hint, const TActorId& parentId) {
239238
NHPTimer::STime hpstart = GetCycleCountFast();
240-
TInternalActorTypeGuard<EInternalActorSystemActivity::ACTOR_SYSTEM_REGISTER> activityGuard(hpstart);
241239
#ifdef ACTORSLIB_COLLECT_EXEC_STATS
242240
ui32 at = actor->GetActivityType();
243241
if (at >= Stats.MaxActivityType())

ydb/library/actors/core/executor_pool_basic.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,6 @@ namespace NActors {
200200
}
201201

202202
ui32 TBasicExecutorPool::GetReadyActivationCommon(TWorkerContext& wctx, ui64 revolvingCounter) {
203-
NHPTimer::STime hpnow = GetCycleCountFast();
204-
TInternalActorTypeGuard<EInternalActorSystemActivity::ACTOR_SYSTEM_GET_ACTIVATION> activityGuard(hpnow);
205-
206203
TWorkerId workerId = wctx.WorkerId;
207204
Y_DEBUG_ABORT_UNLESS(workerId < MaxFullThreadCount);
208205

@@ -212,9 +209,10 @@ namespace NActors {
212209
Y_ABORT_UNLESS(wctx.SharedThread);
213210
wctx.SharedThread->UnsetWork();
214211
}
212+
215213
if (Harmonizer) {
216214
LWPROBE(TryToHarmonize, PoolId, PoolName);
217-
Harmonizer->Harmonize(hpnow);
215+
Harmonizer->Harmonize(TlsThreadContext->StartOfProcessingEventTS.load(std::memory_order_relaxed));
218216
}
219217

220218
TAtomic x = AtomicGet(Semaphore);
@@ -234,7 +232,6 @@ namespace NActors {
234232
}
235233
}
236234
} else {
237-
TInternalActorTypeGuard<EInternalActorSystemActivity::ACTOR_SYSTEM_GET_ACTIVATION_FROM_QUEUE> activityGuard;
238235
if (const ui32 activation = Activations.Pop(++revolvingCounter)) {
239236
if (workerId >= 0) {
240237
Threads[workerId].SetWork();
@@ -714,7 +711,6 @@ namespace NActors {
714711
}
715712

716713
bool TExecutorThreadCtx::WakeUp() {
717-
TInternalActorTypeGuard<EInternalActorSystemActivity::ACTOR_SYSTEM_WAKE_UP> activityGuard;
718714
for (ui32 i = 0; i < 2; ++i) {
719715
EThreadState state = GetState<EThreadState>();
720716
switch (state) {
@@ -743,7 +739,6 @@ namespace NActors {
743739
}
744740

745741
bool TSharedExecutorThreadCtx::WakeUp() {
746-
TInternalActorTypeGuard<EInternalActorSystemActivity::ACTOR_SYSTEM_GET_ACTIVATION_FROM_QUEUE> activityGuard;
747742
i64 requestsForWakeUp = RequestsForWakeUp.fetch_add(1, std::memory_order_acq_rel);
748743
if (requestsForWakeUp >= 0) {
749744
return false;

ydb/library/actors/core/executor_thread_ctx.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#pragma once
22

33
#include "defs.h"
4-
#include "activity_guard.h"
54
#include "executor_thread.h"
65
#include "thread_context.h"
76

@@ -61,13 +60,11 @@ namespace NActors {
6160

6261
template <typename TDerived, typename TWaitState>
6362
void Spin(ui64 spinThresholdCycles, std::atomic<bool> *stopFlag) {
63+
ui64 start = GetCycleCountFast();
6464
bool doSpin = true;
65-
NHPTimer::STime start = GetCycleCountFast();
66-
TInternalActorTypeGuard<EInternalActorSystemActivity::ACTOR_SYSTEM_SPIN> activityGuard(start);
6765
while (true) {
6866
for (ui32 j = 0; doSpin && j < 12; ++j) {
69-
NHPTimer::STime hpnow = GetCycleCountFast();
70-
if (hpnow >= i64(start + spinThresholdCycles)) {
67+
if (GetCycleCountFast() >= (start + spinThresholdCycles)) {
7168
doSpin = false;
7269
break;
7370
}
@@ -103,8 +100,8 @@ namespace NActors {
103100

104101
NHPTimer::STime hpnow = GetCycleCountFast();
105102
NHPTimer::STime hpprev = TlsThreadContext->UpdateStartOfProcessingEventTS(hpnow);
106-
ui32 prevActivity = TlsThreadContext->ElapsingActorActivity.exchange(Max<ui64>(), std::memory_order_acq_rel);
107-
TlsThreadContext->WorkerCtx->AddElapsedCycles(prevActivity, hpnow - hpprev);
103+
TlsThreadContext->ElapsingActorActivity.store(Max<ui64>(), std::memory_order_release);
104+
TlsThreadContext->WorkerCtx->AddElapsedCycles(TlsThreadContext->ActorSystemIndex, hpnow - hpprev);
108105
do {
109106
if (WaitingPad.Park()) // interrupted
110107
return true;

ydb/library/actors/core/harmonizer.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include "executor_thread.h"
55
#include "probes.h"
66

7-
#include "activity_guard.h"
87
#include "actorsystem.h"
98
#include "executor_pool_basic.h"
109
#include "executor_pool_basic_feature_flags.h"
@@ -759,17 +758,13 @@ void THarmonizer::Harmonize(ui64 ts) {
759758
ui64 previousNextHarmonizeTs = NextHarmonizeTs.exchange(ts + Us2Ts(1'000'000ull));
760759
LWPROBE(TryToHarmonizeSuccess, ts, NextHarmonizeTs, previousNextHarmonizeTs);
761760

762-
{
763-
TInternalActorTypeGuard<EInternalActorSystemActivity::ACTOR_SYSTEM_HARMONIZER> activityGuard;
764-
765-
if (PriorityOrder.empty()) {
766-
CalculatePriorityOrder();
767-
}
768-
769-
PullStats(ts);
770-
HarmonizeImpl(ts);
761+
if (PriorityOrder.empty()) {
762+
CalculatePriorityOrder();
771763
}
772764

765+
PullStats(ts);
766+
HarmonizeImpl(ts);
767+
773768
Lock.Release();
774769
}
775770

0 commit comments

Comments
 (0)