aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/lwtrace/control.cpp
diff options
context:
space:
mode:
authoryegorskii <yegorskii@yandex-team.ru>2022-02-10 16:49:10 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:10 +0300
commit6c7ed19fb4e807d81f39d5b370b1dba604558a17 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/lwtrace/control.cpp
parent7902ff9c26a2eacba73e7137a81aed2df9b3e9c1 (diff)
downloadydb-6c7ed19fb4e807d81f39d5b370b1dba604558a17.tar.gz
Restoring authorship annotation for <yegorskii@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/lwtrace/control.cpp')
-rw-r--r--library/cpp/lwtrace/control.cpp194
1 files changed, 97 insertions, 97 deletions
diff --git a/library/cpp/lwtrace/control.cpp b/library/cpp/lwtrace/control.cpp
index ffed939922..d9404ff269 100644
--- a/library/cpp/lwtrace/control.cpp
+++ b/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());
+}
+
+}
+