histogram_macros.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef BASE_METRICS_HISTOGRAM_MACROS_H_
  5. #define BASE_METRICS_HISTOGRAM_MACROS_H_
  6. #include "base/macros.h"
  7. #include "base/metrics/histogram.h"
  8. #include "base/metrics/histogram_macros_internal.h"
  9. #include "base/metrics/histogram_macros_local.h"
  10. #include "base/time/time.h"
  11. // Macros for efficient use of histograms.
  12. //
  13. // For best practices on deciding when to emit to a histogram and what form
  14. // the histogram should take, see
  15. // https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md
  16. // All of these macros must be called with |name| as a runtime constant - it
  17. // doesn't have to literally be a constant, but it must be the same string on
  18. // all calls from a particular call site. If this rule is violated, it is
  19. // possible the data will be written to the wrong histogram.
  20. //------------------------------------------------------------------------------
  21. // Enumeration histograms.
  22. // These macros create histograms for enumerated data. Ideally, the data should
  23. // be of the form of "event occurs, log the result". We recommended not putting
  24. // related but not directly connected data as enums within the same histogram.
  25. // You should be defining an associated Enum, and the input sample should be
  26. // an element of the Enum.
  27. // All of these macros must be called with |name| as a runtime constant.
  28. // The first variant of UMA_HISTOGRAM_ENUMERATION accepts two arguments: the
  29. // histogram name and the enum sample. It deduces the correct boundary value to
  30. // use by looking for an enumerator with the name kMaxValue. kMaxValue should
  31. // share the value of the highest enumerator: this avoids switch statements
  32. // having to handle a sentinel no-op value.
  33. //
  34. // Sample usage:
  35. // // These values are logged to UMA. Entries should not be renumbered and
  36. // // numeric values should never be reused. Please keep in sync with "MyEnum"
  37. // // in src/tools/metrics/histograms/enums.xml.
  38. // enum class MyEnum {
  39. // kFirstValue = 0,
  40. // kSecondValue = 1,
  41. // ...
  42. // kFinalValue = N,
  43. // kMaxValue = kFinalValue,
  44. // };
  45. // UMA_HISTOGRAM_ENUMERATION("My.Enumeration", MyEnum::kSomeValue);
  46. //
  47. // The second variant requires three arguments: the first two are the same as
  48. // before, and the third argument is the enum boundary: this must be strictly
  49. // greater than any other enumerator that will be sampled.
  50. //
  51. // Sample usage:
  52. // // These values are logged to UMA. Entries should not be renumbered and
  53. // // numeric values should never be reused. Please keep in sync with "MyEnum"
  54. // // in src/tools/metrics/histograms/enums.xml.
  55. // enum class MyEnum {
  56. // FIRST_VALUE = 0,
  57. // SECOND_VALUE = 1,
  58. // ...
  59. // FINAL_VALUE = N,
  60. // COUNT
  61. // };
  62. // UMA_HISTOGRAM_ENUMERATION("My.Enumeration",
  63. // MyEnum::SOME_VALUE, MyEnum::COUNT);
  64. //
  65. // Note: If the enum is used in a switch, it is often desirable to avoid writing
  66. // a case statement to handle an unused sentinel value (i.e. COUNT in the above
  67. // example). For scoped enums, this is awkward since it requires casting the
  68. // enum to an arithmetic type and adding one. Instead, prefer the two argument
  69. // version of the macro which automatically deduces the boundary from kMaxValue.
  70. #define UMA_HISTOGRAM_ENUMERATION(name, ...) \
  71. INTERNAL_UMA_HISTOGRAM_ENUMERATION_GET_MACRO( \
  72. __VA_ARGS__, INTERNAL_UMA_HISTOGRAM_ENUMERATION_SPECIFY_BOUNDARY, \
  73. INTERNAL_UMA_HISTOGRAM_ENUMERATION_DEDUCE_BOUNDARY) \
  74. (name, __VA_ARGS__, base::HistogramBase::kUmaTargetedHistogramFlag)
  75. // As above but "scaled" count to avoid overflows caused by increments of
  76. // large amounts. See UMA_HISTOGRAM_SCALED_EXACT_LINEAR for more information.
  77. // Only the new format utilizing an internal kMaxValue is supported.
  78. // It'll be necessary to #include "base/lazy_instance.h" to use this macro.
  79. // name: Full constant name of the histogram (must not change between calls).
  80. // sample: Bucket to be incremented.
  81. // count: Amount by which to increment.
  82. // scale: Amount by which |count| is divided.
  83. // Sample usage:
  84. // UMA_HISTOGRAM_SCALED_ENUMERATION("FooKiB", kEnumValue, byte_count, 1024)
  85. #define UMA_HISTOGRAM_SCALED_ENUMERATION(name, sample, count, scale) \
  86. INTERNAL_HISTOGRAM_SCALED_ENUMERATION_WITH_FLAG( \
  87. name, sample, count, scale, \
  88. base::HistogramBase::kUmaTargetedHistogramFlag)
  89. // Histogram for boolean values.
  90. // Sample usage:
  91. // UMA_HISTOGRAM_BOOLEAN("Histogram.Boolean", bool);
  92. #define UMA_HISTOGRAM_BOOLEAN(name, sample) \
  93. STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \
  94. base::BooleanHistogram::FactoryGet(name, \
  95. base::HistogramBase::kUmaTargetedHistogramFlag))
  96. //------------------------------------------------------------------------------
  97. // Linear histograms.
  98. // All of these macros must be called with |name| as a runtime constant.
  99. // Used for capturing integer data with a linear bucketing scheme. This can be
  100. // used when you want the exact value of some small numeric count, with a max of
  101. // 100 or less. If you need to capture a range of greater than 100, we recommend
  102. // the use of the COUNT histograms below.
  103. // Sample usage:
  104. // UMA_HISTOGRAM_EXACT_LINEAR("Histogram.Linear", count, 10);
  105. #define UMA_HISTOGRAM_EXACT_LINEAR(name, sample, value_max) \
  106. INTERNAL_HISTOGRAM_EXACT_LINEAR_WITH_FLAG( \
  107. name, sample, value_max, base::HistogramBase::kUmaTargetedHistogramFlag)
  108. // Used for capturing basic percentages. This will be 100 buckets of size 1.
  109. // Sample usage:
  110. // UMA_HISTOGRAM_PERCENTAGE("Histogram.Percent", percent_as_int);
  111. #define UMA_HISTOGRAM_PERCENTAGE(name, percent_as_int) \
  112. UMA_HISTOGRAM_EXACT_LINEAR(name, percent_as_int, 101)
  113. //------------------------------------------------------------------------------
  114. // Scaled linear histograms.
  115. // These take |count| and |scale| parameters to allow cumulative reporting of
  116. // large numbers. For example, code might pass a count of 1825 bytes and a scale
  117. // of 1024 bytes to report values in kilobytes. Only the scaled count is
  118. // reported, but the remainder is tracked between calls, so that multiple calls
  119. // will accumulate correctly. Only "exact linear" is supported.
  120. // It'll be necessary to #include "base/lazy_instance.h" to use this macro.
  121. // name: Full constant name of the histogram (must not change between calls).
  122. // sample: Bucket to be incremented.
  123. // count: Amount by which to increment.
  124. // sample_max: Maximum (exclusive) allowed sample value.
  125. // scale: Amount by which |count| is divided.
  126. // Sample usage:
  127. // UMA_HISTOGRAM_SCALED_EXACT_LINER("FooKiB", bucket_no, byte_count,
  128. // kBucketsMax+1, 1024)
  129. #define UMA_HISTOGRAM_SCALED_EXACT_LINEAR(name, sample, count, sample_max, \
  130. scale) \
  131. INTERNAL_HISTOGRAM_SCALED_EXACT_LINEAR_WITH_FLAG( \
  132. name, sample, count, sample_max, scale, \
  133. base::HistogramBase::kUmaTargetedHistogramFlag)
  134. //------------------------------------------------------------------------------
  135. // Count histograms. These are used for collecting numeric data. Note that we
  136. // have macros for more specialized use cases below (memory, time, percentages).
  137. // The number suffixes here refer to the max size of the sample, i.e. COUNT_1000
  138. // will be able to collect samples of counts up to 1000. The default number of
  139. // buckets in all default macros is 50. We recommend erring on the side of too
  140. // large a range versus too short a range.
  141. // These macros default to exponential histograms - i.e. the lengths of the
  142. // bucket ranges exponentially increase as the sample range increases.
  143. // These should *not* be used if you are interested in exact counts, i.e. a
  144. // bucket range of 1. In these cases, you should use the ENUMERATION macros
  145. // defined later. These should also not be used to capture the number of some
  146. // event, i.e. "button X was clicked N times". In this cases, an enum should be
  147. // used, ideally with an appropriate baseline enum entry included.
  148. // All of these macros must be called with |name| as a runtime constant.
  149. // Sample usage:
  150. // UMA_HISTOGRAM_COUNTS_1M("My.Histogram", sample);
  151. #define UMA_HISTOGRAM_COUNTS_100(name, sample) UMA_HISTOGRAM_CUSTOM_COUNTS( \
  152. name, sample, 1, 100, 50)
  153. #define UMA_HISTOGRAM_COUNTS_1000(name, sample) UMA_HISTOGRAM_CUSTOM_COUNTS( \
  154. name, sample, 1, 1000, 50)
  155. #define UMA_HISTOGRAM_COUNTS_10000(name, sample) UMA_HISTOGRAM_CUSTOM_COUNTS( \
  156. name, sample, 1, 10000, 50)
  157. #define UMA_HISTOGRAM_COUNTS_100000(name, sample) UMA_HISTOGRAM_CUSTOM_COUNTS( \
  158. name, sample, 1, 100000, 50)
  159. #define UMA_HISTOGRAM_COUNTS_1M(name, sample) UMA_HISTOGRAM_CUSTOM_COUNTS( \
  160. name, sample, 1, 1000000, 50)
  161. #define UMA_HISTOGRAM_COUNTS_10M(name, sample) UMA_HISTOGRAM_CUSTOM_COUNTS( \
  162. name, sample, 1, 10000000, 50)
  163. // This can be used when the default ranges are not sufficient. This macro lets
  164. // the metric developer customize the min and max of the sampled range, as well
  165. // as the number of buckets recorded.
  166. // Any data outside the range here will be put in underflow and overflow
  167. // buckets. Min values should be >=1 as emitted 0s will still go into the
  168. // underflow bucket.
  169. // Sample usage:
  170. // UMA_HISTOGRAM_CUSTOM_COUNTS("My.Histogram", sample, 1, 100000000, 50);
  171. #define UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \
  172. INTERNAL_HISTOGRAM_CUSTOM_COUNTS_WITH_FLAG( \
  173. name, sample, min, max, bucket_count, \
  174. base::HistogramBase::kUmaTargetedHistogramFlag)
  175. //------------------------------------------------------------------------------
  176. // Timing histograms. These are used for collecting timing data (generally
  177. // latencies).
  178. // These macros create exponentially sized histograms (lengths of the bucket
  179. // ranges exponentially increase as the sample range increases). The input
  180. // sample is a base::TimeDelta. The output data is measured in ms granularity.
  181. // All of these macros must be called with |name| as a runtime constant.
  182. // Sample usage:
  183. // UMA_HISTOGRAM_TIMES("My.Timing.Histogram", time_delta);
  184. // Short timings - up to 10 seconds. For high-resolution (microseconds) timings,
  185. // see UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES.
  186. #define UMA_HISTOGRAM_TIMES(name, sample) UMA_HISTOGRAM_CUSTOM_TIMES( \
  187. name, sample, base::TimeDelta::FromMilliseconds(1), \
  188. base::TimeDelta::FromSeconds(10), 50)
  189. // Medium timings - up to 3 minutes. Note this starts at 10ms (no good reason,
  190. // but not worth changing).
  191. #define UMA_HISTOGRAM_MEDIUM_TIMES(name, sample) UMA_HISTOGRAM_CUSTOM_TIMES( \
  192. name, sample, base::TimeDelta::FromMilliseconds(10), \
  193. base::TimeDelta::FromMinutes(3), 50)
  194. // Long timings - up to an hour.
  195. #define UMA_HISTOGRAM_LONG_TIMES(name, sample) UMA_HISTOGRAM_CUSTOM_TIMES( \
  196. name, sample, base::TimeDelta::FromMilliseconds(1), \
  197. base::TimeDelta::FromHours(1), 50)
  198. // Long timings with higher granularity - up to an hour with 100 buckets.
  199. #define UMA_HISTOGRAM_LONG_TIMES_100(name, sample) UMA_HISTOGRAM_CUSTOM_TIMES( \
  200. name, sample, base::TimeDelta::FromMilliseconds(1), \
  201. base::TimeDelta::FromHours(1), 100)
  202. // This can be used when the default ranges are not sufficient. This macro lets
  203. // the metric developer customize the min and max of the sampled range, as well
  204. // as the number of buckets recorded.
  205. // Sample usage:
  206. // UMA_HISTOGRAM_CUSTOM_TIMES("Very.Long.Timing.Histogram", time_delta,
  207. // base::TimeDelta::FromSeconds(1), base::TimeDelta::FromDays(1), 100);
  208. #define UMA_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \
  209. STATIC_HISTOGRAM_POINTER_BLOCK( \
  210. name, AddTimeMillisecondsGranularity(sample), \
  211. base::Histogram::FactoryTimeGet( \
  212. name, min, max, bucket_count, \
  213. base::HistogramBase::kUmaTargetedHistogramFlag))
  214. // Same as UMA_HISTOGRAM_CUSTOM_TIMES but reports |sample| in microseconds,
  215. // dropping the report if this client doesn't have a high-resolution clock.
  216. //
  217. // Note: dropping reports on clients with low-resolution clocks means these
  218. // reports will be biased to a portion of the population on Windows. See
  219. // Windows.HasHighResolutionTimeTicks for the affected sample.
  220. //
  221. // Sample usage:
  222. // UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
  223. // "High.Resolution.TimingMicroseconds.Histogram", time_delta,
  224. // base::TimeDelta::FromMicroseconds(1),
  225. // base::TimeDelta::FromMilliseconds(10), 100);
  226. #define UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(name, sample, min, max, \
  227. bucket_count) \
  228. STATIC_HISTOGRAM_POINTER_BLOCK( \
  229. name, AddTimeMicrosecondsGranularity(sample), \
  230. base::Histogram::FactoryMicrosecondsTimeGet( \
  231. name, min, max, bucket_count, \
  232. base::HistogramBase::kUmaTargetedHistogramFlag))
  233. // Scoped class which logs its time on this earth in milliseconds as a UMA
  234. // statistic. This is recommended for when you want a histogram which measures
  235. // the time it takes for a method to execute. This measures up to 10 seconds. It
  236. // uses UMA_HISTOGRAM_TIMES under the hood.
  237. // Sample usage:
  238. // void Function() {
  239. // SCOPED_UMA_HISTOGRAM_TIMER("Component.FunctionTime");
  240. // ...
  241. // }
  242. enum class ScopedHistogramTiming {
  243. kMicrosecondTimes,
  244. kMediumTimes,
  245. kLongTimes
  246. };
  247. #define SCOPED_UMA_HISTOGRAM_TIMER(name) \
  248. INTERNAL_SCOPED_UMA_HISTOGRAM_TIMER_EXPANDER( \
  249. name, ScopedHistogramTiming::kMediumTimes, __COUNTER__)
  250. // Similar scoped histogram timer, but this uses UMA_HISTOGRAM_LONG_TIMES_100,
  251. // which measures up to an hour, and uses 100 buckets. This is more expensive
  252. // to store, so only use if this often takes >10 seconds.
  253. #define SCOPED_UMA_HISTOGRAM_LONG_TIMER(name) \
  254. INTERNAL_SCOPED_UMA_HISTOGRAM_TIMER_EXPANDER( \
  255. name, ScopedHistogramTiming::kLongTimes, __COUNTER__)
  256. // Similar scoped histogram timer, but this uses
  257. // UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES, measuring from 1 microseconds to 1
  258. // second, with 50 buckets.
  259. #define SCOPED_UMA_HISTOGRAM_SHORT_TIMER(name) \
  260. INTERNAL_SCOPED_UMA_HISTOGRAM_TIMER_EXPANDER( \
  261. name, ScopedHistogramTiming::kMicrosecondTimes, __COUNTER__)
  262. //------------------------------------------------------------------------------
  263. // Memory histograms.
  264. // These macros create exponentially sized histograms (lengths of the bucket
  265. // ranges exponentially increase as the sample range increases). The input
  266. // sample must be a number measured in kilobytes.
  267. // All of these macros must be called with |name| as a runtime constant.
  268. // Sample usage:
  269. // UMA_HISTOGRAM_MEMORY_KB("My.Memory.Histogram", memory_in_kb);
  270. // Used to measure common KB-granularity memory stats. Range is up to 500000KB -
  271. // approximately 500M.
  272. #define UMA_HISTOGRAM_MEMORY_KB(name, sample) \
  273. UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1000, 500000, 50)
  274. // Used to measure common MB-granularity memory stats. Range is up to ~64G.
  275. #define UMA_HISTOGRAM_MEMORY_LARGE_MB(name, sample) \
  276. UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 64000, 100)
  277. //------------------------------------------------------------------------------
  278. // Stability-specific histograms.
  279. // Histograms logged in as stability histograms will be included in the initial
  280. // stability log. See comments by declaration of
  281. // MetricsService::PrepareInitialStabilityLog().
  282. // All of these macros must be called with |name| as a runtime constant.
  283. // For details on usage, see the documentation on the non-stability equivalents.
  284. #define UMA_STABILITY_HISTOGRAM_BOOLEAN(name, sample) \
  285. STATIC_HISTOGRAM_POINTER_BLOCK( \
  286. name, AddBoolean(sample), \
  287. base::BooleanHistogram::FactoryGet( \
  288. name, base::HistogramBase::kUmaStabilityHistogramFlag))
  289. #define UMA_STABILITY_HISTOGRAM_COUNTS_100(name, sample) \
  290. UMA_STABILITY_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 100, 50)
  291. #define UMA_STABILITY_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, \
  292. bucket_count) \
  293. INTERNAL_HISTOGRAM_CUSTOM_COUNTS_WITH_FLAG( \
  294. name, sample, min, max, bucket_count, \
  295. base::HistogramBase::kUmaStabilityHistogramFlag)
  296. #define UMA_STABILITY_HISTOGRAM_ENUMERATION(name, ...) \
  297. INTERNAL_UMA_HISTOGRAM_ENUMERATION_GET_MACRO( \
  298. __VA_ARGS__, INTERNAL_UMA_HISTOGRAM_ENUMERATION_SPECIFY_BOUNDARY, \
  299. INTERNAL_UMA_HISTOGRAM_ENUMERATION_DEDUCE_BOUNDARY) \
  300. (name, __VA_ARGS__, base::HistogramBase::kUmaStabilityHistogramFlag)
  301. #define UMA_STABILITY_HISTOGRAM_LONG_TIMES(name, sample) \
  302. STATIC_HISTOGRAM_POINTER_BLOCK( \
  303. name, AddTimeMillisecondsGranularity(sample), \
  304. base::Histogram::FactoryTimeGet( \
  305. name, base::TimeDelta::FromMilliseconds(1), \
  306. base::TimeDelta::FromHours(1), 50, \
  307. base::HistogramBase::kUmaStabilityHistogramFlag))
  308. #define UMA_STABILITY_HISTOGRAM_PERCENTAGE(name, percent_as_int) \
  309. INTERNAL_HISTOGRAM_EXACT_LINEAR_WITH_FLAG( \
  310. name, percent_as_int, 101, \
  311. base::HistogramBase::kUmaStabilityHistogramFlag)
  312. //------------------------------------------------------------------------------
  313. // Histogram instantiation helpers.
  314. // Support a collection of histograms, perhaps one for each entry in an
  315. // enumeration. This macro manages a block of pointers, adding to a specific
  316. // one by its index.
  317. //
  318. // A typical instantiation looks something like this:
  319. // STATIC_HISTOGRAM_POINTER_GROUP(
  320. // GetHistogramNameForIndex(histogram_index),
  321. // histogram_index, MAXIMUM_HISTOGRAM_INDEX, Add(some_delta),
  322. // base::Histogram::FactoryGet(
  323. // GetHistogramNameForIndex(histogram_index),
  324. // MINIMUM_SAMPLE, MAXIMUM_SAMPLE, BUCKET_COUNT,
  325. // base::HistogramBase::kUmaTargetedHistogramFlag));
  326. //
  327. // Though it seems inefficient to generate the name twice, the first
  328. // instance will be used only for DCHECK builds and the second will
  329. // execute only during the first access to the given index, after which
  330. // the pointer is cached and the name never needed again.
  331. #define STATIC_HISTOGRAM_POINTER_GROUP( \
  332. constant_histogram_name, index, constant_maximum, \
  333. histogram_add_method_invocation, histogram_factory_get_invocation) \
  334. do { \
  335. static std::atomic_uintptr_t atomic_histograms[constant_maximum]; \
  336. DCHECK_LE(0, index); \
  337. DCHECK_LT(index, constant_maximum); \
  338. HISTOGRAM_POINTER_USE( \
  339. std::addressof(atomic_histograms[index]), constant_histogram_name, \
  340. histogram_add_method_invocation, histogram_factory_get_invocation); \
  341. } while (0)
  342. //------------------------------------------------------------------------------
  343. // Deprecated histogram macros. Not recommended for current use.
  344. // Legacy name for UMA_HISTOGRAM_COUNTS_1M. Suggest using explicit naming
  345. // and not using this macro going forward.
  346. #define UMA_HISTOGRAM_COUNTS(name, sample) UMA_HISTOGRAM_CUSTOM_COUNTS( \
  347. name, sample, 1, 1000000, 50)
  348. // MB-granularity memory metric. This has a short max (1G).
  349. #define UMA_HISTOGRAM_MEMORY_MB(name, sample) \
  350. UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 1000, 50)
  351. // For an enum with customized range. In general, sparse histograms should be
  352. // used instead.
  353. // Samples should be one of the std::vector<int> list provided via
  354. // |custom_ranges|. See comments above CustomRanges::FactoryGet about the
  355. // requirement of |custom_ranges|. You can use the helper function
  356. // CustomHistogram::ArrayToCustomEnumRanges to transform a C-style array of
  357. // valid sample values to a std::vector<int>.
  358. #define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \
  359. STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \
  360. base::CustomHistogram::FactoryGet(name, custom_ranges, \
  361. base::HistogramBase::kUmaTargetedHistogramFlag))
  362. #endif // BASE_METRICS_HISTOGRAM_MACROS_H_