jstatcodes.h 10 KB

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