@@ -33,7 +33,9 @@ class TS3DecompressorCoroImpl : public TActorCoroImpl {
33
33
private:
34
34
bool nextImpl () final {
35
35
while (!Coro->InputFinished || !Coro->Requests .empty ()) {
36
+ Coro->CpuTime += Coro->GetCpuTimeDelta ();
36
37
Coro->ProcessOneEvent ();
38
+ Coro->StartCycleCount = GetCycleCountFast ();
37
39
if (Coro->InputBuffer ) {
38
40
RawDataBuffer.swap (Coro->InputBuffer );
39
41
Coro->InputBuffer .clear ();
@@ -65,6 +67,8 @@ class TS3DecompressorCoroImpl : public TActorCoroImpl {
65
67
}
66
68
67
69
void Run () final {
70
+ StartCycleCount = GetCycleCountFast ();
71
+
68
72
try {
69
73
std::unique_ptr<NDB::ReadBuffer> coroBuffer = std::make_unique<TCoroReadBuffer>(this );
70
74
NDB::ReadBuffer* buffer = coroBuffer.get ();
@@ -74,15 +78,15 @@ class TS3DecompressorCoroImpl : public TActorCoroImpl {
74
78
decompressorBuffer->nextIfAtEnd ();
75
79
TString data{decompressorBuffer->available (), ' ' };
76
80
decompressorBuffer->read (&data.front (), decompressorBuffer->available ());
77
- Send (Parent, new TEvS3Provider::TEvDecompressDataResult (std::move (data)));
81
+ Send (Parent, new TEvS3Provider::TEvDecompressDataResult (std::move (data), TakeCpuTimeDelta () ));
78
82
}
79
83
} catch (const TDtorException&) {
80
84
// Stop any activity instantly
81
85
return ;
82
86
} catch (...) {
83
- Send (Parent, new TEvS3Provider::TEvDecompressDataResult (std::current_exception ()));
87
+ Send (Parent, new TEvS3Provider::TEvDecompressDataResult (std::current_exception (), TakeCpuTimeDelta () ));
84
88
}
85
- Send (Parent, new TEvS3Provider::TEvDecompressDataFinish ());
89
+ Send (Parent, new TEvS3Provider::TEvDecompressDataFinish (TakeCpuTimeDelta () ));
86
90
}
87
91
88
92
void ProcessOneEvent () {
@@ -99,7 +103,19 @@ class TS3DecompressorCoroImpl : public TActorCoroImpl {
99
103
InputBuffer = std::move (event.Data );
100
104
}
101
105
106
+ TDuration GetCpuTimeDelta () {
107
+ return TDuration::Seconds (NHPTimer::GetSeconds (GetCycleCountFast () - StartCycleCount));
108
+ }
109
+
110
+ TDuration TakeCpuTimeDelta () {
111
+ auto currentCpuTime = CpuTime;
112
+ CpuTime = TDuration::Zero ();
113
+ return currentCpuTime;
114
+ }
115
+
102
116
private:
117
+ TDuration CpuTime;
118
+ ui64 StartCycleCount = 0 ;
103
119
TString InputBuffer;
104
120
TString Compression;
105
121
TActorId Parent;
0 commit comments