jstatcodes.h 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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. 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. SMeasureMax,
  79. };
  80. //This macro can be used to generate multiple variations of a statistics kind, but probably not needed any more
  81. //e.g., DEFINE_SKEW_STAT(Time, Elapsed)
  82. #define DEFINE_SKEW_STAT(x, y) \
  83. St ## x ## Min ## y = (St ## x ## y | StMinX), \
  84. St ## x ## Max ## y = (St ## x ## y | StMaxX), \
  85. St ## x ## Ave ## y = (St ## x ## y | StAvgX), \
  86. St ## Skew ## y = (St ## x ## y | StSkew), \
  87. St ## SkewMin ## y = (St ## x ## y | StSkewMin), \
  88. St ## SkewMax ## y = (St ## x ## y | StSkewMax), \
  89. St ## NodeMin ## y = (St ## x ## y | StNodeMin), \
  90. St ## NodeMax ## y = (St ## x ## y | StNodeMax),
  91. //The values in this enumeration are stored persistently. The associated values must not be changed.
  92. //If you add an entry here you must also update statsMetaData
  93. //NOTE: All statistic names should be unique with the type prefix removed. Since the prefix is replaced with Skew/Min/etc.
  94. enum StatisticKind
  95. {
  96. StKindNone,
  97. StKindAll,
  98. StWhenGraphStarted, // Deprecated use StWhenStarted
  99. StWhenGraphFinished, // Deprecated use StWhenFinished
  100. StWhenFirstRow, // When the first row is processed by slave activity
  101. StWhenQueryStarted, // Deprecated use StWhenStarted
  102. StWhenQueryFinished, // Deprecated use StWhenFinished
  103. StWhenCreated,
  104. StWhenCompiled,
  105. StWhenWorkunitModified, // Not sure this is very useful
  106. StTimeElapsed, // An elapsed time - should always have a corresponding StWhenStarted...
  107. StTimeLocalExecute, // Time spend processing just this activity
  108. StTimeTotalExecute, // Time executing this activity and all inputs
  109. StTimeRemaining,
  110. StSizeGeneratedCpp,
  111. StSizePeakMemory,
  112. StSizeMaxRowSize,
  113. StNumRowsProcessed, // on edge
  114. StNumSlaves, // on edge
  115. StNumStarts, // on edge
  116. StNumStops, // on edge
  117. StNumIndexSeeks,
  118. StNumIndexScans,
  119. StNumIndexWildSeeks,
  120. StNumIndexSkips,
  121. StNumIndexNullSkips,
  122. StNumIndexMerges,
  123. StNumIndexMergeCompares,
  124. StNumPreFiltered,
  125. StNumPostFiltered,
  126. StNumBlobCacheHits,
  127. StNumLeafCacheHits,
  128. StNumNodeCacheHits,
  129. StNumBlobCacheAdds,
  130. StNumLeafCacheAdds,
  131. StNumNodeCacheAdds,
  132. StNumPreloadCacheHits,
  133. StNumPreloadCacheAdds,
  134. StNumServerCacheHits,
  135. StNumIndexAccepted,
  136. StNumIndexRejected,
  137. StNumAtmostTriggered,
  138. StNumDiskSeeks,
  139. StNumIterations,
  140. StLoadWhileSorting, // Average load while processing a sort?
  141. StNumLeftRows,
  142. StNumRightRows,
  143. StPerReplicated,
  144. StNumDiskRowsRead,
  145. StNumIndexRowsRead,
  146. StNumDiskAccepted,
  147. StNumDiskRejected,
  148. StTimeSoapcall, // Time spent waiting for soapcalls
  149. StTimeFirstExecute, // Time waiting for first record from this activity
  150. StTimeDiskReadIO,
  151. StTimeDiskWriteIO,
  152. StSizeDiskRead,
  153. StSizeDiskWrite,
  154. StCycleDiskReadIOCycles,
  155. StCycleDiskWriteIOCycles,
  156. StNumDiskReads,
  157. StNumDiskWrites,
  158. StNumSpills,
  159. StTimeSpillElapsed,
  160. StTimeSortElapsed,
  161. StNumGroups,
  162. StNumGroupMax,
  163. StSizeSpillFile,
  164. StCycleSpillElapsedCycles,
  165. StCycleSortElapsedCycles,
  166. StNumStrands, // Stranding stats - on edge
  167. StCycleTotalExecuteCycles,
  168. StNumExecutions,
  169. StTimeTotalNested,
  170. StCycleLocalExecuteCycles,
  171. StNumCompares,
  172. StNumScansPerRow,
  173. StNumAllocations,
  174. StNumAllocationScans,
  175. StNumDiskRetries,
  176. StCycleElapsedCycles,
  177. StCycleRemainingCycles,
  178. StCycleSoapcallCycles,
  179. StCycleFirstExecuteCycles,
  180. StCycleTotalNestedCycles,
  181. StTimeGenerate,
  182. StCycleGenerateCycles,
  183. StWhenStarted, // When a graph/query etc. starts
  184. StWhenFinished, // When a graph stopped
  185. StMax,
  186. //For any quantity there is potentially the following variants.
  187. //These modifiers ORd with the values above to form a compound type.
  188. StKindMask = 0x0ffff,
  189. StVariantScale = (StKindMask+1),
  190. StMinX = 0x10000, // the minimum value
  191. StMaxX = 0x20000, // the maximum value
  192. StAvgX = 0x30000, // the average value
  193. StSkew = 0x40000, // the skew on a particular node
  194. StSkewMin = 0x50000, // the minimum skew
  195. StSkewMax = 0x60000, // the maximum skew
  196. StNodeMin = 0x70000, // the node containing the minimum
  197. StNodeMax = 0x80000, // the node containing the maximum
  198. StDeltaX = 0x90000, // a difference in the value of X
  199. StStdDevX = 0xa0000, // standard deviation in the value of X
  200. StNextModifier = 0xb0000,
  201. };
  202. #endif