jstatcodes.h 7.1 KB

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