probes.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. #pragma once
  2. #include <library/cpp/lwtrace/all.h>
  3. #include <util/generic/vector.h>
  4. #define LWACTORID(x) (x).RawX1(), (x).RawX2(), (x).NodeId(), (x).PoolID()
  5. #define LWTYPE_ACTORID ui64, ui64, ui32, ui32
  6. #define LWNAME_ACTORID(n) n "Raw1", n "Raw2", n "NodeId", n "PoolId"
  7. #define ACTORLIB_PROVIDER(PROBE, EVENT, GROUPS, TYPES, NAMES) \
  8. PROBE(SlowEvent, GROUPS("ActorLibSlow"), \
  9. TYPES(ui32, double, TString, TString, TString), \
  10. NAMES("poolId", "eventMs", "eventType", "actorId", "actorType")) \
  11. PROBE(EventSlowDelivery, GROUPS("ActorLibSlow"), \
  12. TYPES(ui32, double, double, ui64, TString, TString, TString), \
  13. NAMES("poolId", "deliveryMs", "sinceActivationMs", "eventProcessedBefore", "eventType", "actorId", "actorType")) \
  14. PROBE(SlowActivation, GROUPS("ActorLibSlow"), \
  15. TYPES(ui32, double), \
  16. NAMES("poolId", "activationMs")) \
  17. PROBE(SlowRegisterNew, GROUPS("ActorLibSlow"), \
  18. TYPES(ui32, double), \
  19. NAMES("poolId", "registerNewMs")) \
  20. PROBE(SlowRegisterAdd, GROUPS("ActorLibSlow"), \
  21. TYPES(ui32, double), \
  22. NAMES("poolId", "registerAddMs")) \
  23. PROBE(MailboxPushedOutByTailSending, GROUPS("ActorLibMailbox", "ActorLibMailboxPushedOut"), \
  24. TYPES(ui32, TString, ui32, TDuration, ui64, TString, TString), \
  25. NAMES("poolId", "pool", "eventsProcessed", "procTimeMs", "workerId", "actorId", "actorType")) \
  26. PROBE(MailboxPushedOutBySoftPreemption, GROUPS("ActorLibMailbox", "ActorLibMailboxPushedOut"), \
  27. TYPES(ui32, TString, ui32, TDuration, ui64, TString, TString), \
  28. NAMES("poolId", "pool", "eventsProcessed", "procTimeMs", "workerId", "actorId", "actorType")) \
  29. PROBE(MailboxPushedOutByTime, GROUPS("ActorLibMailbox", "ActorLibMailboxPushedOut"), \
  30. TYPES(ui32, TString, ui32, TDuration, ui64, TString, TString), \
  31. NAMES("poolId", "pool", "eventsProcessed", "procTimeMs", "workerId", "actorId", "actorType")) \
  32. PROBE(MailboxPushedOutByEventCount, GROUPS("ActorLibMailbox", "ActorLibMailboxPushedOut"), \
  33. TYPES(ui32, TString, ui32, TDuration, ui64, TString, TString), \
  34. NAMES("poolId", "pool", "eventsProcessed", "procTimeMs", "workerId", "actorId", "actorType")) \
  35. PROBE(MailboxEmpty, GROUPS("ActorLibMailbox"), \
  36. TYPES(ui32, TString, ui32, TDuration, ui64, TString, TString), \
  37. NAMES("poolId", "pool", "eventsProcessed", "procTimeMs", "workerId", "actorId", "actorType")) \
  38. PROBE(ActivationBegin, GROUPS(), \
  39. TYPES(ui32, ui32, ui32, double), \
  40. NAMES("cpu", "poolId", "workerId", "expireMs")) \
  41. PROBE(ActivationEnd, GROUPS(), \
  42. TYPES(ui32, ui32, ui32), \
  43. NAMES("cpu", "poolId", "workerId")) \
  44. PROBE(ExecutorThreadStats, GROUPS("ActorLibStats"), \
  45. TYPES(ui32, TString, ui64, ui64, ui64, double, double), \
  46. NAMES("poolId", "pool", "workerId", "execCount", "readyActivationCount", "execMs", "nonExecMs")) \
  47. PROBE(SlowICReadLoopAdjustSize, GROUPS("ActorLibSlowIC"), \
  48. TYPES(double), \
  49. NAMES("icReadLoopAdjustSizeMs")) \
  50. PROBE(SlowICReadFromSocket, GROUPS("ActorLibSlowIC"), \
  51. TYPES(double), \
  52. NAMES("icReadFromSocketMs")) \
  53. PROBE(SlowICReadLoopSend, GROUPS("ActorLibSlowIC"), \
  54. TYPES(double), \
  55. NAMES("icReadLoopSendMs")) \
  56. PROBE(SlowICAllocPacketBuffer, GROUPS("ActorLibSlowIC"), \
  57. TYPES(ui32, double), \
  58. NAMES("peerId", "icAllocPacketBufferMs")) \
  59. PROBE(SlowICFillSendingBuffer, GROUPS("ActorLibSlowIC"), \
  60. TYPES(ui32, double), \
  61. NAMES("peerId", "icFillSendingBufferMs")) \
  62. PROBE(SlowICPushSentPackets, GROUPS("ActorLibSlowIC"), \
  63. TYPES(ui32, double), \
  64. NAMES("peerId", "icPushSentPacketsMs")) \
  65. PROBE(SlowICPushSendQueue, GROUPS("ActorLibSlowIC"), \
  66. TYPES(ui32, double), \
  67. NAMES("peerId", "icPushSendQueueMs")) \
  68. PROBE(SlowICWriteData, GROUPS("ActorLibSlowIC"), \
  69. TYPES(ui32, double), \
  70. NAMES("peerId", "icWriteDataMs")) \
  71. PROBE(SlowICDropConfirmed, GROUPS("ActorLibSlowIC"), \
  72. TYPES(ui32, double), \
  73. NAMES("peerId", "icDropConfirmedMs")) \
  74. PROBE(ActorsystemScheduler, GROUPS("Durations"), \
  75. TYPES(ui64, ui64, ui32, ui32, ui64, ui64), \
  76. NAMES("timeUs", "timerfd_expirations", "eventsGottenFromQueues", "eventsSent", \
  77. "eventsInSendQueue", "eventSchedulingErrorUs")) \
  78. PROBE(ForwardEvent, GROUPS("Orbit", "InterconnectSessionTCP"), \
  79. TYPES(ui32, ui32, ui32, LWTYPE_ACTORID, LWTYPE_ACTORID, ui64, ui32), \
  80. NAMES("peerId", "type", "flags", LWNAME_ACTORID("r"), LWNAME_ACTORID("s"), \
  81. "cookie", "eventSerializedSize")) \
  82. PROBE(EnqueueEvent, GROUPS("InterconnectSessionTCP"), \
  83. TYPES(ui32, ui64, TDuration, ui16, ui64, ui64), \
  84. NAMES("peerId", "numEventsInReadyChannels", "enqueueBlockedTotalMs", "channelId", "queueSizeInEvents", "queueSizeInBytes")) \
  85. PROBE(SerializeToPacketBegin, GROUPS("InterconnectSessionTCP"), \
  86. TYPES(ui32, ui16, ui64), \
  87. NAMES("peerId", "channelId", "outputQueueSize")) \
  88. PROBE(SerializeToPacketEnd, GROUPS("InterconnectSessionTCP"), \
  89. TYPES(ui32, ui16, ui64, ui64), \
  90. NAMES("peerId", "channelId", "outputQueueSize", "offsetInPacket")) \
  91. PROBE(FillSendingBuffer, GROUPS("InterconnectSessionTCP"), \
  92. TYPES(ui32, ui32, ui64, TDuration), \
  93. NAMES("peerId", "taskBytesGenerated", "numEventsInReadyChannelsBehind", "fillBlockedTotalMs")) \
  94. PROBE(PacketGenerated, GROUPS("InterconnectSessionTCP"), \
  95. TYPES(ui32, ui64, ui64, ui64, ui64), \
  96. NAMES("peerId", "bytesUnwritten", "inflightBytes", "packetsGenerated", "packetSize")) \
  97. PROBE(PacketWrittenToSocket, GROUPS("InterconnectSessionTCP"), \
  98. TYPES(ui32, ui64, bool, ui64, ui64, TDuration, int), \
  99. NAMES("peerId", "packetsWrittenToSocket", "triedWriting", "packetDataSize", "bytesUnwritten", "writeBlockedTotalMs", "fd")) \
  100. PROBE(GenerateTraffic, GROUPS("InterconnectSessionTCP"), \
  101. TYPES(ui32, double, ui64, ui32, ui64), \
  102. NAMES("peerId", "generateTrafficMs", "dataBytesSent", "generatedPackets", "generatedBytes")) \
  103. PROBE(WriteToSocket, GROUPS("InterconnectSessionTCP"), \
  104. TYPES(ui32, ui64, ui64, ui64, ui64, TDuration, int), \
  105. NAMES("peerId", "bytesWritten", "packetsWritten", "packetsWrittenToSocket", "bytesUnwritten", "writeBlockedTotalMs", "fd")) \
  106. PROBE(UpdateFromInputSession, GROUPS("InterconnectSessionTCP"), \
  107. TYPES(ui32, double), \
  108. NAMES("peerId", "pingMs")) \
  109. PROBE(UnblockByDropConfirmed, GROUPS("InterconnectSessionTCP"), \
  110. TYPES(ui32, double), \
  111. NAMES("peerId", "updateDeliveryMs")) \
  112. PROBE(DropConfirmed, GROUPS("InterconnectSessionTCP"), \
  113. TYPES(ui32, ui64, ui64), \
  114. NAMES("peerId", "droppedBytes", "inflightBytes")) \
  115. PROBE(StartRam, GROUPS("InterconnectSessionTCP"), \
  116. TYPES(ui32), \
  117. NAMES("peerId")) \
  118. PROBE(FinishRam, GROUPS("InterconnectSessionTCP"), \
  119. TYPES(ui32, double), \
  120. NAMES("peerId", "ramMs")) \
  121. PROBE(SkipGenerateTraffic, GROUPS("InterconnectSessionTCP"), \
  122. TYPES(ui32, double), \
  123. NAMES("peerId", "elapsedSinceRamMs")) \
  124. PROBE(StartBatching, GROUPS("InterconnectSessionTCP"), \
  125. TYPES(ui32, double), \
  126. NAMES("peerId", "batchPeriodMs")) \
  127. PROBE(FinishBatching, GROUPS("InterconnectSessionTCP"), \
  128. TYPES(ui32, double), \
  129. NAMES("peerId", "finishBatchDeliveryMs")) \
  130. PROBE(BlockedWrite, GROUPS("InterconnectSessionTCP"), \
  131. TYPES(ui32, double, ui64), \
  132. NAMES("peerId", "sendQueueSize", "writtenBytes")) \
  133. PROBE(ReadyWrite, GROUPS("InterconnectSessionTCP"), \
  134. TYPES(ui32, double, double), \
  135. NAMES("peerId", "readyWriteDeliveryMs", "blockMs")) \
  136. PROBE(EpollStartWaitIn, GROUPS("EpollThread"), \
  137. TYPES(), \
  138. NAMES()) \
  139. PROBE(EpollFinishWaitIn, GROUPS("EpollThread"), \
  140. TYPES(i32), \
  141. NAMES("eventsCount")) \
  142. PROBE(EpollWaitOut, GROUPS("EpollThread"), \
  143. TYPES(i32), \
  144. NAMES("eventsCount")) \
  145. PROBE(EpollSendReadyRead, GROUPS("EpollThread"), \
  146. TYPES(bool, bool, int), \
  147. NAMES("hangup", "event", "fd")) \
  148. PROBE(EpollSendReadyWrite, GROUPS("EpollThread"), \
  149. TYPES(bool, bool, int), \
  150. NAMES("hangup", "event", "fd")) \
  151. PROBE(HardPreemption, GROUPS("UnitedWorker"), \
  152. TYPES(ui32, ui32, ui32, ui32), \
  153. NAMES("cpu", "prevPoolId", "prevWorkerId", "nextWorkerId")) \
  154. PROBE(SetPreemptionTimer, GROUPS("UnitedWorker", "PreemptionTimer"), \
  155. TYPES(ui32, ui32, int, double, double), \
  156. NAMES("cpu", "workerId", "fd", "nowMs", "preemptMs")) \
  157. PROBE(ResetPreemptionTimer, GROUPS("UnitedWorker", "PreemptionTimer"), \
  158. TYPES(ui32, ui32, int, double, double), \
  159. NAMES("cpu", "workerId", "fd", "nowMs", "preemptMs")) \
  160. PROBE(SlowWorkerActionRace, GROUPS("UnitedWorker"), \
  161. TYPES(ui32, ui32, ui64), \
  162. NAMES("cpu", "poolId", "slowPoolsMask")) \
  163. PROBE(PoolStats, GROUPS("PoolCpuBalancer"), \
  164. TYPES(ui32, TString, ui64, ui8, ui8, double, double, double, ui64, ui64, ui64), \
  165. NAMES("poolId", "pool", "currentCpus", "loadClass", "priority", "scaleFactor", "cpuIdle", "cpuLoad", "importance", "addImportance", "subImportance")) \
  166. PROBE(MoveCpu, GROUPS("PoolCpuBalancer"), \
  167. TYPES(ui32, ui64, TString, TString, ui32), \
  168. NAMES("fromPoolId", "toPoolId", "fromPool", "toPool", "cpu")) \
  169. PROBE(ThreadCount, GROUPS("BasicThreadPool"), \
  170. TYPES(ui32, TString, ui32, ui32, ui32, ui32), \
  171. NAMES("poolId", "pool", "threacCount", "minThreadCount", "maxThreadCount", "defaultThreadCount")) \
  172. PROBE(HarmonizeCheckPool, GROUPS("Harmonizer"), \
  173. TYPES(ui32, TString, double, double, double, double, ui32, ui32, bool, bool, bool), \
  174. NAMES("poolId", "pool", "booked", "consumed", "lastSecondBooked", "lastSecondConsumed", "threadCount", "maxThreadCount", "isStarved", "isNeedy", "isHoggish")) \
  175. PROBE(HarmonizeOperation, GROUPS("Harmonizer"), \
  176. TYPES(ui32, TString, TString, ui32, ui32, ui32), \
  177. NAMES("poolId", "pool", "operation", "newCount", "minCount", "maxCount")) \
  178. PROBE(TryToHarmonize, GROUPS("Harmonizer"), \
  179. TYPES(ui32, TString), \
  180. NAMES("poolId", "pool")) \
  181. PROBE(SavedValues, GROUPS("Harmonizer"), \
  182. TYPES(ui32, TString, TString, double, double, double, double, double, double, double, double), \
  183. NAMES("poolId", "pool", "valueName", "[0]", "[1]", "[2]", "[3]", "[4]", "[5]", "[6]", "[7]")) \
  184. PROBE(RegisterValue, GROUPS("Harmonizer"), \
  185. TYPES(ui64, ui64, ui64, ui64, double, double, double), \
  186. NAMES("ts", "lastTs", "dTs", "8sTs", "us", "lastUs", "dUs")) \
  187. PROBE(TryToHarmonizeFailed, GROUPS("Harmonizer"), \
  188. TYPES(ui64, ui64, bool, bool), \
  189. NAMES("ts", "nextHarmonizeTs", "isDisabled", "withLock")) \
  190. PROBE(TryToHarmonizeSuccess, GROUPS("Harmonizer"), \
  191. TYPES(ui64, ui64, ui64), \
  192. NAMES("ts", "nextHarmonizeTs", "previousNextHarmonizeTs")) \
  193. /**/
  194. LWTRACE_DECLARE_PROVIDER(ACTORLIB_PROVIDER)
  195. namespace NActors {
  196. struct TActorSystemSetup;
  197. TVector<NLWTrace::TDashboard> LWTraceDashboards(TActorSystemSetup* setup);
  198. }