jstatcodes.h 9.1 KB

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