jstatcodes.h 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef JSTATCODES_H
  14. #define JSTATCODES_H
  15. #define ActivityScopePrefix "a"
  16. #define EdgeScopePrefix "e"
  17. #define SubGraphScopePrefix "sg"
  18. #define GraphScopePrefix "graph"
  19. #define FunctionScopePrefix "f"
  20. #define WorkflowScopePrefix "w"
  21. #define ChildGraphScopePrefix "c"
  22. #define FileScopePrefix "p"
  23. #define MATCHES_CONST_PREFIX(search, prefix) (strncmp(search, prefix, strlen(prefix)) == 0)
  24. enum CombineStatsAction
  25. {
  26. MergeStats,
  27. ReplaceStats,
  28. AppendStats,
  29. };
  30. enum StatisticCreatorType
  31. {
  32. SCTnone,
  33. SCTall,
  34. SCTunknown,
  35. SCThthor,
  36. SCTroxie,
  37. SCTroxieSlave,
  38. SCTthor,
  39. SCTthorMaster,
  40. SCTthorSlave,
  41. SCTeclcc,
  42. SCTesp,
  43. SCTsummary, // used to maintain the summary time over all thors (mainly for sorting)
  44. SCTmax,
  45. };
  46. enum StatisticScopeType
  47. {
  48. SSTnone,
  49. SSTall,
  50. SSTglobal, // root scope
  51. SSTgraph, // identifies a graph
  52. SSTsubgraph,
  53. SSTactivity,
  54. SSTallocator, // identifies an allocator
  55. SSTsection, // A section within the query - not a great differentiator
  56. SSTcompilestage, // a stage within the compilation process
  57. SSTdfuworkunit, // a reference to an executing dfu workunit
  58. SSTedge,
  59. SSTfunction, // a function call
  60. SSTworkflow,
  61. SSTchildgraph,
  62. SSTfile,
  63. SSTunknown,
  64. SSTmax
  65. };
  66. enum StatisticMeasure
  67. {
  68. SMeasureNone,
  69. SMeasureAll,
  70. SMeasureTimeNs, // Elapsed time in nanoseconds
  71. SMeasureTimestampUs, // timestamp/when - a point in time (to the microsecond)
  72. SMeasureCount, // a count of the number of occurrences
  73. SMeasureSize, // a quantity of memory (or disk) measured in bytes
  74. SMeasureLoad, // measure of cpu activity (stored as 1/1000000 core)
  75. SMeasureSkew, // a measure of skew. 0 = perfectly balanced, range [-10000..infinity]
  76. SMeasureNode, // A node number within a cluster (0 = master)
  77. SMeasurePercent, // actually stored as parts per million, displayed as a percentage
  78. SMeasureIPV4,
  79. SMeasureCycle,
  80. SMeasureEnum, // A value from an enumeration
  81. SMeasureText, // A textual value (from a graph attribute rather than a statistic)
  82. SMeasureBool, // A boolean
  83. SMeasureId, // An Id for an element
  84. SMeasureFilename, // A filename
  85. SMeasureCost, // Used to measure cost
  86. SMeasureMax,
  87. };
  88. //This macro can be used to generate multiple variations of a statistics kind, but probably not needed any more
  89. //e.g., DEFINE_SKEW_STAT(Time, Elapsed)
  90. #define DEFINE_SKEW_STAT(x, y) \
  91. St ## x ## Min ## y = (St ## x ## y | StMinX), \
  92. St ## x ## Max ## y = (St ## x ## y | StMaxX), \
  93. St ## x ## Ave ## y = (St ## x ## y | StAvgX), \
  94. St ## Skew ## y = (St ## x ## y | StSkew), \
  95. St ## SkewMin ## y = (St ## x ## y | StSkewMin), \
  96. St ## SkewMax ## y = (St ## x ## y | StSkewMax), \
  97. St ## NodeMin ## y = (St ## x ## y | StNodeMin), \
  98. St ## NodeMax ## y = (St ## x ## y | StNodeMax),
  99. //The values in this enumeration are stored persistently. The associated values must not be changed.
  100. //If you add an entry here you must also update statsMetaData
  101. //NOTE: All statistic names should be unique with the type prefix removed. Since the prefix is replaced with Skew/Min/etc.
  102. enum StatisticKind
  103. {
  104. StKindNone,
  105. StKindAll,
  106. StWhenGraphStarted, // Deprecated use StWhenStarted
  107. StWhenGraphFinished, // Deprecated use StWhenFinished
  108. StWhenFirstRow, // When the first row is processed by slave activity
  109. StWhenQueryStarted, // Deprecated use StWhenStarted
  110. StWhenQueryFinished, // Deprecated use StWhenFinished
  111. StWhenCreated,
  112. StWhenCompiled,
  113. StWhenWorkunitModified, // Not sure this is very useful
  114. StTimeElapsed, // An elapsed time - should always have a corresponding StWhenStarted...
  115. StTimeLocalExecute, // Time spend processing just this activity
  116. StTimeTotalExecute, // Time executing this activity and all inputs
  117. StTimeRemaining,
  118. StSizeGeneratedCpp,
  119. StSizePeakMemory,
  120. StSizeMaxRowSize,
  121. StNumRowsProcessed, // on edge
  122. StNumSlaves, // on edge
  123. StNumStarts, // on edge
  124. StNumStops, // on edge
  125. StNumIndexSeeks,
  126. StNumIndexScans,
  127. StNumIndexWildSeeks,
  128. StNumIndexSkips,
  129. StNumIndexNullSkips,
  130. StNumIndexMerges,
  131. StNumIndexMergeCompares,
  132. StNumPreFiltered,
  133. StNumPostFiltered,
  134. StNumBlobCacheHits,
  135. StNumLeafCacheHits,
  136. StNumNodeCacheHits,
  137. StNumBlobCacheAdds,
  138. StNumLeafCacheAdds,
  139. StNumNodeCacheAdds,
  140. StNumPreloadCacheHits,
  141. StNumPreloadCacheAdds,
  142. StNumServerCacheHits,
  143. StNumIndexAccepted,
  144. StNumIndexRejected,
  145. StNumAtmostTriggered,
  146. StNumDiskSeeks,
  147. StNumIterations,
  148. StLoadWhileSorting, // Average load while processing a sort?
  149. StNumLeftRows,
  150. StNumRightRows,
  151. StPerReplicated,
  152. StNumDiskRowsRead,
  153. StNumIndexRowsRead,
  154. StNumDiskAccepted,
  155. StNumDiskRejected,
  156. StTimeSoapcall, // Time spent waiting for soapcalls
  157. StTimeFirstExecute, // Time waiting for first record from this activity
  158. StTimeDiskReadIO,
  159. StTimeDiskWriteIO,
  160. StSizeDiskRead,
  161. StSizeDiskWrite,
  162. StCycleDiskReadIOCycles,
  163. StCycleDiskWriteIOCycles,
  164. StNumDiskReads,
  165. StNumDiskWrites,
  166. StNumSpills,
  167. StTimeSpillElapsed,
  168. StTimeSortElapsed,
  169. StNumGroups,
  170. StNumGroupMax,
  171. StSizeSpillFile,
  172. StCycleSpillElapsedCycles,
  173. StCycleSortElapsedCycles,
  174. StNumStrands, // Stranding stats - on edge
  175. StCycleTotalExecuteCycles,
  176. StNumExecutions,
  177. StTimeTotalNested,
  178. StCycleLocalExecuteCycles,
  179. StNumCompares,
  180. StNumScansPerRow,
  181. StNumAllocations,
  182. StNumAllocationScans,
  183. StNumDiskRetries,
  184. StCycleElapsedCycles,
  185. StCycleRemainingCycles,
  186. StCycleSoapcallCycles,
  187. StCycleFirstExecuteCycles,
  188. StCycleTotalNestedCycles,
  189. StTimeGenerate,
  190. StCycleGenerateCycles,
  191. StWhenStarted, // When a graph/query etc. starts
  192. StWhenFinished, // When a graph stopped
  193. StNumAnalyseExprs,
  194. StNumTransformExprs,
  195. StNumUniqueAnalyseExprs,
  196. StNumUniqueTransformExprs,
  197. StNumDuplicateKeys, // When generating index, number of duplicate keys found
  198. StNumAttribsProcessed,
  199. StNumAttribsSimplified,
  200. StNumAttribsFromCache,
  201. StNumSmartJoinDegradedToLocal, // number of times global smart join degraded to local smart join (<=1 unless in loop)
  202. StNumSmartJoinSlavesDegradedToStd, // number of times a slave in smart join degraded from local smart join to standard hash join
  203. StNumAttribsSimplifiedTooComplex,
  204. StNumSysContextSwitches, // System wide context switches
  205. StTimeOsUser, // System wide user time
  206. StTimeOsSystem,
  207. StTimeOsTotal,
  208. StCycleOsUserCycles,
  209. StCycleOsSystemCycles,
  210. StCycleOsTotalCycles,
  211. StNumContextSwitches, // Context switches for this process
  212. StTimeUser, // Time for in user mode for this process
  213. StTimeSystem,
  214. StTimeTotal,
  215. StCycleUserCycles, // Time for in user mode for this process
  216. StCycleSystemCycles,
  217. StCycleTotalCycles,
  218. StSizeOsDiskRead,
  219. StSizeOsDiskWrite,
  220. StTimeBlocked,
  221. StCycleBlockedCycles,
  222. StCostExecute,
  223. StSizeAgentReply,
  224. StTimeAgentWait,
  225. StCycleAgentWaitCycles,
  226. StMax,
  227. //For any quantity there is potentially the following variants.
  228. //These modifiers ORd with the values above to form a compound type.
  229. StKindMask = 0x0ffff,
  230. StVariantScale = (StKindMask+1),
  231. StMinX = 0x10000, // the minimum value
  232. StMaxX = 0x20000, // the maximum value
  233. StAvgX = 0x30000, // the average value
  234. StSkew = 0x40000, // the skew on a particular node
  235. StSkewMin = 0x50000, // the minimum skew
  236. StSkewMax = 0x60000, // the maximum skew
  237. StNodeMin = 0x70000, // the node containing the minimum
  238. StNodeMax = 0x80000, // the node containing the maximum
  239. StDeltaX = 0x90000, // a difference in the value of X
  240. StStdDevX = 0xa0000, // standard deviation in the value of X
  241. StNextModifier = 0xb0000,
  242. //NOTE: Do not use 0x80000000 since wu attributes use those values, and they should not overlap
  243. };
  244. constexpr StatisticKind operator |(StatisticKind l, StatisticKind r) { return (StatisticKind)((unsigned)l | (unsigned)r); }
  245. #endif