jstatcodes.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. typedef unsigned __int64 timestamp_type;
  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. 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. 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. StMax,
  195. //For any quantity there is potentially the following variants.
  196. //These modifiers ORd with the values above to form a compound type.
  197. StKindMask = 0x0ffff,
  198. StVariantScale = (StKindMask+1),
  199. StMinX = 0x10000, // the minimum value
  200. StMaxX = 0x20000, // the maximum value
  201. StAvgX = 0x30000, // the average value
  202. StSkew = 0x40000, // the skew on a particular node
  203. StSkewMin = 0x50000, // the minimum skew
  204. StSkewMax = 0x60000, // the maximum skew
  205. StNodeMin = 0x70000, // the node containing the minimum
  206. StNodeMax = 0x80000, // the node containing the maximum
  207. StDeltaX = 0x90000, // a difference in the value of X
  208. StStdDevX = 0xa0000, // standard deviation in the value of X
  209. StNextModifier = 0xb0000,
  210. //NOTE: Do not use 0x80000000 since wu attributes use those values, and they should not overlap
  211. };
  212. constexpr StatisticKind operator |(StatisticKind l, StatisticKind r) { return (StatisticKind)((unsigned)l | (unsigned)r); }
  213. #endif