jstatcodes.h 7.6 KB

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