jstatcodes.h 8.9 KB

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