Просмотр исходного кода

Restoring authorship annotation for <yegorskii@yandex-team.ru>. Commit 1 of 2.

yegorskii 3 лет назад
Родитель
Сommit
7902ff9c26

+ 6 - 6
library/cpp/actors/core/log_settings.cpp

@@ -6,11 +6,11 @@ namespace NActors {
     namespace NLog {
         TSettings::TSettings(const TActorId& loggerActorId, const EComponent loggerComponent,
                              EComponent minVal, EComponent maxVal, EComponentToStringFunc func,
-                             EPriority defPriority, EPriority defSamplingPriority,
-                             ui32 defSamplingRate, ui64 timeThresholdMs)
+                             EPriority defPriority, EPriority defSamplingPriority, 
+                             ui32 defSamplingRate, ui64 timeThresholdMs) 
             : LoggerActorId(loggerActorId)
             , LoggerComponent(loggerComponent)
-            , TimeThresholdMs(timeThresholdMs)
+            , TimeThresholdMs(timeThresholdMs) 
             , AllowDrop(true)
             , ThrottleDelay(TDuration::MilliSeconds(100))
             , MinVal(0)
@@ -28,11 +28,11 @@ namespace NActors {
         }
 
         TSettings::TSettings(const TActorId& loggerActorId, const EComponent loggerComponent,
-                             EPriority defPriority, EPriority defSamplingPriority,
-                             ui32 defSamplingRate, ui64 timeThresholdMs)
+                             EPriority defPriority, EPriority defSamplingPriority, 
+                             ui32 defSamplingRate, ui64 timeThresholdMs) 
             : LoggerActorId(loggerActorId)
             , LoggerComponent(loggerComponent)
-            , TimeThresholdMs(timeThresholdMs)
+            , TimeThresholdMs(timeThresholdMs) 
             , AllowDrop(true)
             , ThrottleDelay(TDuration::MilliSeconds(100))
             , MinVal(0)

+ 4 - 4
library/cpp/actors/core/log_settings.h

@@ -100,12 +100,12 @@ namespace NActors {
             // YOURTYPE_Name for you.
             TSettings(const TActorId& loggerActorId, const EComponent loggerComponent,
                       EComponent minVal, EComponent maxVal, EComponentToStringFunc func,
-                      EPriority defPriority, EPriority defSamplingPriority = PRI_DEBUG,
-                      ui32 defSamplingRate = 0, ui64 timeThresholdMs = 1000);
+                      EPriority defPriority, EPriority defSamplingPriority = PRI_DEBUG, 
+                      ui32 defSamplingRate = 0, ui64 timeThresholdMs = 1000); 
 
             TSettings(const TActorId& loggerActorId, const EComponent loggerComponent,
-                      EPriority defPriority, EPriority defSamplingPriority = PRI_DEBUG,
-                      ui32 defSamplingRate = 0, ui64 timeThresholdMs = 1000);
+                      EPriority defPriority, EPriority defSamplingPriority = PRI_DEBUG, 
+                      ui32 defSamplingRate = 0, ui64 timeThresholdMs = 1000); 
 
             void Append(EComponent minVal, EComponent maxVal, EComponentToStringFunc func);
 

+ 56 - 56
library/cpp/actors/core/log_ut.cpp

@@ -22,19 +22,19 @@ namespace {
         return s;
     }
 
-    TIntrusivePtr<TSettings> DroppingSettings(ui64 timeThresholdMs) {
-        auto loggerId = TActorId{0, "Logger"};
-        auto s = MakeIntrusive<TSettings>(
-            loggerId,
-            0,
-            EPriority::PRI_TRACE,
-            EPriority::PRI_DEBUG,
-            (ui32)0,
-            timeThresholdMs);
-        s->Append(0, 1, ServiceToString);
-        return s;
-    }
-
+    TIntrusivePtr<TSettings> DroppingSettings(ui64 timeThresholdMs) { 
+        auto loggerId = TActorId{0, "Logger"}; 
+        auto s = MakeIntrusive<TSettings>( 
+            loggerId, 
+            0, 
+            EPriority::PRI_TRACE, 
+            EPriority::PRI_DEBUG, 
+            (ui32)0, 
+            timeThresholdMs); 
+        s->Append(0, 1, ServiceToString); 
+        return s; 
+    } 
+ 
     class TMockBackend: public TLogBackend {
     public:
         using TWriteImpl = std::function<void(const TLogRecord&)>;
@@ -68,30 +68,30 @@ namespace {
     };
 
     struct TFixture {
-        TFixture(
-            TIntrusivePtr<TSettings> settings,
-            TMockBackend::TWriteImpl writeImpl = ThrowAlways)
-        {
+        TFixture( 
+            TIntrusivePtr<TSettings> settings, 
+            TMockBackend::TWriteImpl writeImpl = ThrowAlways) 
+        { 
             Runtime.Initialize();
             LogBackend.reset(new TMockBackend{writeImpl});
-            LoggerActor = Runtime.Register(new TLoggerActor{settings, LogBackend, Counters});
+            LoggerActor = Runtime.Register(new TLoggerActor{settings, LogBackend, Counters}); 
             Runtime.SetScheduledEventFilter([] (auto&&, auto&&, auto&&, auto) {
                 return false;
             });
         }
 
-        TFixture(TMockBackend::TWriteImpl writeImpl = ThrowAlways)
-            : TFixture(DefaultSettings(), writeImpl)
-        {}
-
+        TFixture(TMockBackend::TWriteImpl writeImpl = ThrowAlways) 
+            : TFixture(DefaultSettings(), writeImpl) 
+        {} 
+ 
         void WriteLog() {
             Runtime.Send(new IEventHandle{LoggerActor, {}, new TEvLog(TInstant::Zero(), TLevel{EPrio::Emerg}, 0, "foo")});
         }
 
-        void WriteLog(TInstant ts) {
-            Runtime.Send(new IEventHandle{LoggerActor, {}, new TEvLog(ts, TLevel{EPrio::Emerg}, 0, "foo")});
-        }
-
+        void WriteLog(TInstant ts) { 
+            Runtime.Send(new IEventHandle{LoggerActor, {}, new TEvLog(ts, TLevel{EPrio::Emerg}, 0, "foo")}); 
+        } 
+ 
         void Wakeup() {
             Runtime.Send(new IEventHandle{LoggerActor, {}, new TEvents::TEvWakeup});
         }
@@ -152,34 +152,34 @@ Y_UNIT_TEST_SUITE(TLoggerActorTest) {
 
         UNIT_ASSERT_VALUES_EQUAL(messages.size(), COUNT);
     }
-
-    Y_UNIT_TEST(ShouldObeyTimeThresholdMsWhenOverloaded) {
-        TFixture test{DroppingSettings(5000)};
-
-        TVector<TString> messages;
-        auto acceptWrites = [&] (const TLogRecord& r) {
-            messages.emplace_back(r.Data, r.Len);
-        };
-
-        test.LogBackend->SetWriteImpl(acceptWrites);
-        test.Wakeup();
-
-        const auto COUNT = 11;
-        for (auto i = 0; i < COUNT; ++i) {
-            test.WriteLog();
-        }
-
-        UNIT_ASSERT_VALUES_EQUAL(messages.size(), COUNT);
-
-        test.Runtime.AdvanceCurrentTime(TDuration::Seconds(20));
-        auto now = test.Runtime.GetCurrentTime();
-
-        test.WriteLog(now - TDuration::Seconds(5));
-
-        UNIT_ASSERT_VALUES_EQUAL(messages.size(), COUNT + 1);
-
-        test.WriteLog(now - TDuration::Seconds(6));
-
-        UNIT_ASSERT_VALUES_EQUAL(messages.size(), COUNT + 1);
-    }
+ 
+    Y_UNIT_TEST(ShouldObeyTimeThresholdMsWhenOverloaded) { 
+        TFixture test{DroppingSettings(5000)}; 
+ 
+        TVector<TString> messages; 
+        auto acceptWrites = [&] (const TLogRecord& r) { 
+            messages.emplace_back(r.Data, r.Len); 
+        }; 
+ 
+        test.LogBackend->SetWriteImpl(acceptWrites); 
+        test.Wakeup(); 
+ 
+        const auto COUNT = 11; 
+        for (auto i = 0; i < COUNT; ++i) { 
+            test.WriteLog(); 
+        } 
+ 
+        UNIT_ASSERT_VALUES_EQUAL(messages.size(), COUNT); 
+ 
+        test.Runtime.AdvanceCurrentTime(TDuration::Seconds(20)); 
+        auto now = test.Runtime.GetCurrentTime(); 
+ 
+        test.WriteLog(now - TDuration::Seconds(5)); 
+ 
+        UNIT_ASSERT_VALUES_EQUAL(messages.size(), COUNT + 1); 
+ 
+        test.WriteLog(now - TDuration::Seconds(6)); 
+ 
+        UNIT_ASSERT_VALUES_EQUAL(messages.size(), COUNT + 1); 
+    } 
 }

+ 12 - 12
library/cpp/actors/core/mon.h

@@ -88,14 +88,14 @@ namespace NActors {
             {
             }
 
-            TEvRemoteHttpInfo(const TString& query, HTTP_METHOD method)
-                : Query(query)
-                , Method(method)
-            {
-            }
-
+            TEvRemoteHttpInfo(const TString& query, HTTP_METHOD method) 
+                : Query(query) 
+                , Method(method) 
+            { 
+            } 
+ 
             TString Query;
-            HTTP_METHOD Method;
+            HTTP_METHOD Method; 
 
             TString PathInfo() const {
                 const size_t pos = Query.find('?');
@@ -126,11 +126,11 @@ namespace NActors {
             static IEventBase* Load(TEventSerializedData* bufs) {
                 return new TEvRemoteHttpInfo(bufs->GetString());
             }
-
-            HTTP_METHOD GetMethod() const
-            {
-                return Method;
-            }
+ 
+            HTTP_METHOD GetMethod() const 
+            { 
+                return Method; 
+            } 
         };
 
         struct TEvRemoteHttpInfoRes: public NActors::TEventBase<TEvRemoteHttpInfoRes, RemoteHttpInfoRes> {

+ 5 - 5
library/cpp/logger/system.cpp

@@ -4,7 +4,7 @@
 #include <util/system/yassert.h>
 #include <util/system/defaults.h>
 #include <util/generic/singleton.h>
-#include <util/generic/utility.h>
+#include <util/generic/utility.h> 
 
 #if defined(_unix_)
 #include <syslog.h>
@@ -64,12 +64,12 @@ void TSysLogBackend::ReopenLog() {
 }
 
 int TSysLogBackend::ELogPriority2SyslogPriority(ELogPriority priority) {
-#if defined(_unix_)
-     return Min(int(priority), (int)LOG_PRIMASK);
-#else
+#if defined(_unix_) 
+     return Min(int(priority), (int)LOG_PRIMASK); 
+#else 
     // trivial conversion
     return int(priority);
-#endif
+#endif 
 }
 
 namespace {

+ 97 - 97
library/cpp/lwtrace/control.cpp

@@ -1,97 +1,97 @@
-#include "probes.h"
-
-#include <library/cpp/lwtrace/protos/lwtrace.pb.h>
-
-#include <util/generic/string.h>
-
-namespace NLWTrace {
-
-LWTRACE_USING(LWTRACE_INTERNAL_PROVIDER);
-
-TProbeMap TManager::GetProbesMap() {
-    class TProbeReader
-    {
-    private:
-        TProbeMap& Result;
-
-    public:
-        TProbeReader(TProbeMap& result)
-            : Result(result)
-        {}
-
-        void Push(NLWTrace::TProbe* probe)
-        {
-            Result[std::make_pair(probe->Event.Name, probe->Event.GetProvider())] = probe;
-        }
-    };
-
-    TProbeMap result;
-
-    auto reader = TProbeReader(result);
-    ReadProbes(reader);
-    return result;
-}
-
-void TManager::CreateTraceRequest(TTraceRequest& msg, TOrbit& orbit)
-{
-    msg.SetIsTraced(orbit.HasShuttles());
-}
-
-bool TManager::HandleTraceRequest(
-    const TTraceRequest& msg,
-    TOrbit& orbit)
-{
-    if (!msg.GetIsTraced()) {
-        return false;
-    }
-    TParams params;
-    SerializingExecutor->Execute(orbit, params);
-    return true;
-}
-
-TTraceDeserializeStatus TManager::HandleTraceResponse(
-    const TTraceResponse& msg,
-    const TProbeMap& probesMap,
-    TOrbit& orbit,
-    i64 timeOffset,
-    double timeScale)
-{
-    TTraceDeserializeStatus result;
-    if (!msg.GetTrace().GetEvents().size()) {
-        return result;
-    }
-
-    ui64 prev = EpochNanosecondsToCycles(
-        msg.GetTrace().GetEvents()[0].GetTimestampNanosec());
-
-    for (auto& v : msg.GetTrace().GetEvents()) {
-        auto it = probesMap.find(std::make_pair(v.GetName(), v.GetProvider()));
-        if (it != probesMap.end()) {
-            TProbe* probe = it->second;
-            TParams params;
-            if(!probe->Event.Signature.DeserializeFromPb(params, v.GetParams())) {
-                LWTRACK(DeserializationError, orbit, probe->Event.Name, probe->Event.GetProvider());
-                result.AddFailedEventName(v.GetName());
-            } else {
-                ui64 timestamp = EpochNanosecondsToCycles(v.GetTimestampNanosec());
-                orbit.AddProbe(
-                    probe,
-                    params,
-                    prev + (timestamp-prev)*timeScale + timeOffset);
-                probe->Event.Signature.DestroyParams(params);
-                prev = timestamp;
-            }
-        } else {
-            result.AddFailedEventName(v.GetName());
-        }
-    }
-    return result;
-}
-
-void TManager::CreateTraceResponse(TTraceResponse& msg, TOrbit& orbit)
-{
-    orbit.Serialize(0, *msg.MutableTrace());
-}
-
-}
-
+#include "probes.h" 
+ 
+#include <library/cpp/lwtrace/protos/lwtrace.pb.h> 
+ 
+#include <util/generic/string.h> 
+ 
+namespace NLWTrace { 
+ 
+LWTRACE_USING(LWTRACE_INTERNAL_PROVIDER); 
+ 
+TProbeMap TManager::GetProbesMap() { 
+    class TProbeReader 
+    { 
+    private: 
+        TProbeMap& Result; 
+ 
+    public: 
+        TProbeReader(TProbeMap& result) 
+            : Result(result) 
+        {} 
+ 
+        void Push(NLWTrace::TProbe* probe) 
+        { 
+            Result[std::make_pair(probe->Event.Name, probe->Event.GetProvider())] = probe; 
+        } 
+    }; 
+ 
+    TProbeMap result; 
+ 
+    auto reader = TProbeReader(result); 
+    ReadProbes(reader); 
+    return result; 
+} 
+ 
+void TManager::CreateTraceRequest(TTraceRequest& msg, TOrbit& orbit) 
+{ 
+    msg.SetIsTraced(orbit.HasShuttles()); 
+} 
+ 
+bool TManager::HandleTraceRequest( 
+    const TTraceRequest& msg, 
+    TOrbit& orbit) 
+{ 
+    if (!msg.GetIsTraced()) { 
+        return false; 
+    } 
+    TParams params; 
+    SerializingExecutor->Execute(orbit, params); 
+    return true; 
+} 
+ 
+TTraceDeserializeStatus TManager::HandleTraceResponse( 
+    const TTraceResponse& msg, 
+    const TProbeMap& probesMap, 
+    TOrbit& orbit, 
+    i64 timeOffset, 
+    double timeScale) 
+{ 
+    TTraceDeserializeStatus result; 
+    if (!msg.GetTrace().GetEvents().size()) { 
+        return result; 
+    } 
+ 
+    ui64 prev = EpochNanosecondsToCycles( 
+        msg.GetTrace().GetEvents()[0].GetTimestampNanosec()); 
+ 
+    for (auto& v : msg.GetTrace().GetEvents()) { 
+        auto it = probesMap.find(std::make_pair(v.GetName(), v.GetProvider())); 
+        if (it != probesMap.end()) { 
+            TProbe* probe = it->second; 
+            TParams params; 
+            if(!probe->Event.Signature.DeserializeFromPb(params, v.GetParams())) { 
+                LWTRACK(DeserializationError, orbit, probe->Event.Name, probe->Event.GetProvider()); 
+                result.AddFailedEventName(v.GetName()); 
+            } else { 
+                ui64 timestamp = EpochNanosecondsToCycles(v.GetTimestampNanosec()); 
+                orbit.AddProbe( 
+                    probe, 
+                    params, 
+                    prev + (timestamp-prev)*timeScale + timeOffset); 
+                probe->Event.Signature.DestroyParams(params); 
+                prev = timestamp; 
+            } 
+        } else { 
+            result.AddFailedEventName(v.GetName()); 
+        } 
+    } 
+    return result; 
+} 
+ 
+void TManager::CreateTraceResponse(TTraceResponse& msg, TOrbit& orbit) 
+{ 
+    orbit.Serialize(0, *msg.MutableTrace()); 
+} 
+ 
+} 
+ 

+ 47 - 47
library/cpp/lwtrace/control.h

@@ -3,7 +3,7 @@
 #include "custom_action.h"
 #include "event.h"
 #include "log.h"
-#include "log_shuttle.h"
+#include "log_shuttle.h" 
 #include "probe.h"
 
 #include <library/cpp/lwtrace/protos/lwtrace.pb.h>
@@ -18,9 +18,9 @@
 #include <util/generic/vector.h>
 
 namespace NLWTrace {
-
-    using TProbeMap = THashMap<std::pair<TString, TString>, TProbe*>;
-
+ 
+    using TProbeMap = THashMap<std::pair<TString, TString>, TProbe*>; 
+ 
     // Interface for probe ownership management
     class IBox: public virtual TThrRefBase {
     private:
@@ -203,38 +203,38 @@ namespace NLWTrace {
         void ToProtobuf(TLogPb& pb) const;
     };
 
-    // Deserialization result.
-    // Either IsSuccess is true or FailedEventNames contains event names
-    // we were not able to deserialize.
-    struct TTraceDeserializeStatus
-    {
-        bool IsSuccess = true;
-        TVector<TString> FailedEventNames;
-
-        void AddFailedEventName(const TString& name)
-        {
-            IsSuccess = false;
-            FailedEventNames.emplace_back(name);
-        }
-    };
-
+    // Deserialization result. 
+    // Either IsSuccess is true or FailedEventNames contains event names 
+    // we were not able to deserialize. 
+    struct TTraceDeserializeStatus 
+    { 
+        bool IsSuccess = true; 
+        TVector<TString> FailedEventNames; 
+ 
+        void AddFailedEventName(const TString& name) 
+        { 
+            IsSuccess = false; 
+            FailedEventNames.emplace_back(name); 
+        } 
+    }; 
+ 
     // Just a registry of all active trace queries
     // Facade for all interactions with probes/traces
     class TManager: public TNonCopyable {
     private:
         TProbeRegistry& Registry;
         TMutex Mtx;
-        ui64 LastTraceIdx = 1;
+        ui64 LastTraceIdx = 1; 
         typedef THashMap<TString, TSession*> TTraces; // traceId -> TSession
         TTraces Traces;
         bool DestructiveActionsAllowed;
         TCustomActionFactory CustomActionFactory;
-        THolder<TRunLogShuttleActionExecutor<TCyclicDepot>> SerializingExecutor;
-
-    public:
-        static constexpr ui64 RemoteTraceIdx = 0;
+        THolder<TRunLogShuttleActionExecutor<TCyclicDepot>> SerializingExecutor; 
 
     public:
+        static constexpr ui64 RemoteTraceIdx = 0; 
+ 
+    public: 
         TManager(TProbeRegistry& registry, bool allowDestructiveActions);
         ~TManager();
         bool HasTrace(const TString& id) const;
@@ -324,28 +324,28 @@ namespace NLWTrace {
                 return new T(probe, action, trace);
             });
         }
-
-        TProbeMap GetProbesMap();
-
-        void CreateTraceRequest(TTraceRequest& msg, TOrbit& orbit);
-
-        bool HandleTraceRequest(
-            const TTraceRequest& msg,
-            TOrbit& orbit);
-
-        TTraceDeserializeStatus HandleTraceResponse(
-            const TTraceResponse& msg,
-            const TProbeMap& probesMap,
-            TOrbit& orbit,
-            i64 timeOffset = 0,
-            double timeScale = 1);
-
-        void CreateTraceResponse(
-            TTraceResponse& msg,
-            TOrbit& orbit);
-
-        bool IsTraced(TOrbit& orbit) {
-            return orbit.HasShuttle(TManager::RemoteTraceIdx);
-        }
+ 
+        TProbeMap GetProbesMap(); 
+ 
+        void CreateTraceRequest(TTraceRequest& msg, TOrbit& orbit); 
+ 
+        bool HandleTraceRequest( 
+            const TTraceRequest& msg, 
+            TOrbit& orbit); 
+ 
+        TTraceDeserializeStatus HandleTraceResponse( 
+            const TTraceResponse& msg, 
+            const TProbeMap& probesMap, 
+            TOrbit& orbit, 
+            i64 timeOffset = 0, 
+            double timeScale = 1); 
+ 
+        void CreateTraceResponse( 
+            TTraceResponse& msg, 
+            TOrbit& orbit); 
+ 
+        bool IsTraced(TOrbit& orbit) { 
+            return orbit.HasShuttle(TManager::RemoteTraceIdx); 
+        } 
     };
 }

+ 53 - 53
library/cpp/lwtrace/log_shuttle.h

@@ -3,8 +3,8 @@
 #include "log.h"
 #include "probe.h"
 
-#include <library/cpp/lwtrace/protos/lwtrace.pb.h>
-
+#include <library/cpp/lwtrace/protos/lwtrace.pb.h> 
+ 
 #include <util/system/spinlock.h>
 
 namespace NLWTrace {
@@ -14,35 +14,35 @@ namespace NLWTrace {
     ////////////////////////////////////////////////////////////////////////////////
 
     struct THostTimeCalculator {
-        double K = 0;
-        ui64 B = 0;
-
+        double K = 0; 
+        ui64 B = 0; 
+ 
         THostTimeCalculator() {
-            TInstant now = TInstant::Now();
-            ui64 tsNow = GetCycleCount();
-            K = 1000000000 / NHPTimer::GetClockRate();
-            B = now.NanoSeconds() - K * tsNow;
-        }
-
+            TInstant now = TInstant::Now(); 
+            ui64 tsNow = GetCycleCount(); 
+            K = 1000000000 / NHPTimer::GetClockRate(); 
+            B = now.NanoSeconds() - K * tsNow; 
+        } 
+ 
         ui64 CyclesToEpochNanoseconds(ui64 cycles) const {
-            return K*cycles + B;
-        }
-
+            return K*cycles + B; 
+        } 
+ 
         ui64 EpochNanosecondsToCycles(ui64 ns) const {
-            return (ns - B) / K;
-        }
-    };
-
+            return (ns - B) / K; 
+        } 
+    }; 
+ 
     inline ui64 CyclesToEpochNanoseconds(ui64 cycles) {
-        return Singleton<THostTimeCalculator>()->CyclesToEpochNanoseconds(cycles);
-    }
-
+        return Singleton<THostTimeCalculator>()->CyclesToEpochNanoseconds(cycles); 
+    } 
+ 
     inline ui64 EpochNanosecondsToCycles(ui64 ns) {
-        return Singleton<THostTimeCalculator>()->EpochNanosecondsToCycles(ns);
-    }
-
-    ////////////////////////////////////////////////////////////////////////////////
-
+        return Singleton<THostTimeCalculator>()->EpochNanosecondsToCycles(ns); 
+    } 
+ 
+    //////////////////////////////////////////////////////////////////////////////// 
+ 
     template <class TDepot>
     class TLogShuttle: public IShuttle {
     private:
@@ -62,10 +62,10 @@ namespace NLWTrace {
         {
         }
 
-        bool DoAddProbe(TProbe* probe, const TParams& params, ui64 timestamp) override;
+        bool DoAddProbe(TProbe* probe, const TParams& params, ui64 timestamp) override; 
         void DoEndOfTrack() override;
         void DoDrop() override;
-        void DoSerialize(TShuttleTrace& msg) override;
+        void DoSerialize(TShuttleTrace& msg) override; 
         bool DoFork(TShuttlePtr& child) override;
         bool DoJoin(const TShuttlePtr& child) override;
 
@@ -155,7 +155,7 @@ namespace NLWTrace {
     ////////////////////////////////////////////////////////////////////////////////
 
     template <class TDepot>
-    bool TLogShuttle<TDepot>::DoAddProbe(TProbe* probe, const TParams& params, ui64 timestamp) {
+    bool TLogShuttle<TDepot>::DoAddProbe(TProbe* probe, const TParams& params, ui64 timestamp) { 
         with_lock (Lock) {
             if (TrackLog.Items.size() >= MaxTrackLength) {
                 TrackLog.Truncated = true;
@@ -168,7 +168,7 @@ namespace NLWTrace {
             if ((item->SavedParamsCount = probe->Event.Signature.ParamCount) > 0) {
                 probe->Event.Signature.CloneParams(item->Params, params);
             }
-            item->TimestampCycles = timestamp ? timestamp : GetCycleCount();
+            item->TimestampCycles = timestamp ? timestamp : GetCycleCount(); 
         }
 
         return true;
@@ -204,25 +204,25 @@ namespace NLWTrace {
     }
 
     template <class TDepot>
-    void TLogShuttle<TDepot>::DoSerialize(TShuttleTrace& msg)
-    {
-        with_lock (Lock)
-        {
-            if (!GetTrackLog().Items.size()) {
-                return ;
-            }
-            for (auto& record : GetTrackLog().Items) {
-                auto *rec = msg.AddEvents();
-                rec->SetName(record.Probe->Event.Name);
-                rec->SetProvider(record.Probe->Event.GetProvider());
-                rec->SetTimestampNanosec(
-                    CyclesToEpochNanoseconds(record.TimestampCycles));
-                record.Probe->Event.Signature.SerializeToPb(record.Params, *rec->MutableParams());
-            }
-        }
-    }
-
-    template <class TDepot>
+    void TLogShuttle<TDepot>::DoSerialize(TShuttleTrace& msg) 
+    { 
+        with_lock (Lock) 
+        { 
+            if (!GetTrackLog().Items.size()) { 
+                return ; 
+            } 
+            for (auto& record : GetTrackLog().Items) { 
+                auto *rec = msg.AddEvents(); 
+                rec->SetName(record.Probe->Event.Name); 
+                rec->SetProvider(record.Probe->Event.GetProvider()); 
+                rec->SetTimestampNanosec( 
+                    CyclesToEpochNanoseconds(record.TimestampCycles)); 
+                record.Probe->Event.Signature.SerializeToPb(record.Params, *rec->MutableParams()); 
+            } 
+        } 
+    } 
+ 
+    template <class TDepot> 
     TLogShuttle<TDepot>* TLogShuttleActionBase<TDepot>::Cast(const TShuttlePtr& shuttle) {
         return static_cast<TLogShuttle<TDepot>*>(shuttle.Get());
     }
@@ -247,7 +247,7 @@ namespace NLWTrace {
         , LastTrackId(lastTrackId)
         , LastSpanId(lastSpanId)
     {
-        ui64 size = Min<ui64>(Action.GetShuttlesCount() ? Action.GetShuttlesCount() : 1000, MaxShuttles); // Do not allow to allocate too much memory
+        ui64 size = Min<ui64>(Action.GetShuttlesCount() ? Action.GetShuttlesCount() : 1000, MaxShuttles); // Do not allow to allocate too much memory 
         AllShuttles.reserve(size);
         Parking.reserve(size);
         for (ui64 i = 0; i < size; i++) {
@@ -283,9 +283,9 @@ namespace NLWTrace {
 
     template <class TDepot>
     void TRunLogShuttleActionExecutor<TDepot>::RecordShuttle(TLogShuttle<TDepot>* shuttle) {
-        if (Depot == nullptr) {
-            return;
-        }
+        if (Depot == nullptr) { 
+            return; 
+        } 
         typename TDepot::TAccessor a(*Depot);
         if (TTrackLog* trackLog = a.Add()) {
             *trackLog = shuttle->GetTrackLog();

+ 2 - 2
library/cpp/lwtrace/lwprobe.h

@@ -61,8 +61,8 @@ namespace NLWTrace {
             signature.SerializeParamsFunc = &TUsrSign::SerializeParams;
             signature.CloneParamsFunc = &TUsrSign::CloneParams;
             signature.DestroyParamsFunc = &TUsrSign::DestroyParams;
-            signature.SerializeToPbFunc = &TUsrSign::SerializeToPb;
-            signature.DeserializeFromPbFunc = &TUsrSign::DeserializeFromPb;
+            signature.SerializeToPbFunc = &TUsrSign::SerializeToPb; 
+            signature.DeserializeFromPbFunc = &TUsrSign::DeserializeFromPb; 
 
             // register probe in global registry
             Register(*Singleton<NLWTrace::TProbeRegistry>());

+ 6 - 6
library/cpp/lwtrace/mon/mon_lwtrace.cpp

@@ -511,9 +511,9 @@ struct TAdHocTraceConfig {
             }
             auto block = Cfg.GetBlocks(blockIdx);
             auto pdesc = block.GetProbeDesc();
-            if (pdesc.GetProvider()) {
+            if (pdesc.GetProvider()) { 
                 ss << "." << pdesc.GetProvider() << "." << pdesc.GetName();
-            } else if (pdesc.GetGroup()) {
+            } else if (pdesc.GetGroup()) { 
                 ss << ".Group." << pdesc.GetGroup();
             }
             // TODO[serxa]: handle predicate
@@ -525,10 +525,10 @@ struct TAdHocTraceConfig {
                     if (ls.GetIgnore()) {
                         ss << "-i";
                     }
-                    if (ls.GetShuttlesCount()) {
+                    if (ls.GetShuttlesCount()) { 
                         ss << "-s" << ls.GetShuttlesCount();
                     }
-                    if (ls.GetMaxTrackLength()) {
+                    if (ls.GetMaxTrackLength()) { 
                         ss << "-t" << ls.GetMaxTrackLength();
                     }
                 } else if (action.HasEditLogShuttleAction()) {
@@ -542,10 +542,10 @@ struct TAdHocTraceConfig {
                 }
             }
         }
-        if (Cfg.GetPerThreadLogSize()) {
+        if (Cfg.GetPerThreadLogSize()) { 
             ss << ".l" << Cfg.GetPerThreadLogSize();
         }
-        if (Cfg.GetLogDurationUs()) {
+        if (Cfg.GetLogDurationUs()) { 
             ui64 logDurationUs = Cfg.GetLogDurationUs();
             if (logDurationUs % (60 * 1000 * 1000) == 0)
                 ss << ".d" << logDurationUs / (60 * 1000 * 1000) << "m";

Некоторые файлы не были показаны из-за большого количества измененных файлов