@kungfu-tech/libnode-win32-x64 22.22.3-kf.0 → 22.22.3-kf.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (340) hide show
  1. package/dist/node/include/acorn_version.h +6 -0
  2. package/dist/node/include/aliased_buffer-inl.h +244 -0
  3. package/dist/node/include/aliased_buffer.h +206 -0
  4. package/dist/node/include/aliased_struct-inl.h +54 -0
  5. package/dist/node/include/aliased_struct.h +63 -0
  6. package/dist/node/include/amaro_version.h +6 -0
  7. package/dist/node/include/async_context_frame.h +33 -0
  8. package/dist/node/include/async_wrap-inl.h +96 -0
  9. package/dist/node/include/async_wrap.h +243 -0
  10. package/dist/node/include/base_object-inl.h +335 -0
  11. package/dist/node/include/base_object.h +342 -0
  12. package/dist/node/include/base_object_types.h +74 -0
  13. package/dist/node/include/blob_serializer_deserializer-inl.h +385 -0
  14. package/dist/node/include/blob_serializer_deserializer.h +132 -0
  15. package/dist/node/include/callback_queue-inl.h +97 -0
  16. package/dist/node/include/callback_queue.h +79 -0
  17. package/dist/node/include/cares_wrap.h +447 -0
  18. package/dist/node/include/cjs_module_lexer_version.h +6 -0
  19. package/dist/node/include/cleanup_queue-inl.h +36 -0
  20. package/dist/node/include/cleanup_queue.h +79 -0
  21. package/dist/node/include/compile_cache.h +104 -0
  22. package/dist/node/include/connect_wrap.h +26 -0
  23. package/dist/node/include/connection_wrap.h +30 -0
  24. package/dist/node/include/cppgc/allocation.h +310 -0
  25. package/dist/node/include/cppgc/common.h +28 -0
  26. package/dist/node/include/cppgc/cross-thread-persistent.h +466 -0
  27. package/dist/node/include/cppgc/custom-space.h +97 -0
  28. package/dist/node/include/cppgc/default-platform.h +67 -0
  29. package/dist/node/include/cppgc/ephemeron-pair.h +30 -0
  30. package/dist/node/include/cppgc/explicit-management.h +100 -0
  31. package/dist/node/include/cppgc/garbage-collected.h +106 -0
  32. package/dist/node/include/cppgc/heap-consistency.h +309 -0
  33. package/dist/node/include/cppgc/heap-handle.h +48 -0
  34. package/dist/node/include/cppgc/heap-state.h +82 -0
  35. package/dist/node/include/cppgc/heap-statistics.h +120 -0
  36. package/dist/node/include/cppgc/heap.h +202 -0
  37. package/dist/node/include/cppgc/internal/api-constants.h +87 -0
  38. package/dist/node/include/cppgc/internal/atomic-entry-flag.h +48 -0
  39. package/dist/node/include/cppgc/internal/base-page-handle.h +45 -0
  40. package/dist/node/include/cppgc/internal/caged-heap-local-data.h +121 -0
  41. package/dist/node/include/cppgc/internal/caged-heap.h +68 -0
  42. package/dist/node/include/cppgc/internal/compiler-specific.h +38 -0
  43. package/dist/node/include/cppgc/internal/finalizer-trait.h +93 -0
  44. package/dist/node/include/cppgc/internal/gc-info.h +148 -0
  45. package/dist/node/include/cppgc/internal/logging.h +50 -0
  46. package/dist/node/include/cppgc/internal/member-storage.h +256 -0
  47. package/dist/node/include/cppgc/internal/name-trait.h +137 -0
  48. package/dist/node/include/cppgc/internal/persistent-node.h +214 -0
  49. package/dist/node/include/cppgc/internal/pointer-policies.h +243 -0
  50. package/dist/node/include/cppgc/internal/write-barrier.h +487 -0
  51. package/dist/node/include/cppgc/liveness-broker.h +78 -0
  52. package/dist/node/include/cppgc/macros.h +35 -0
  53. package/dist/node/include/cppgc/member.h +629 -0
  54. package/dist/node/include/cppgc/name-provider.h +65 -0
  55. package/dist/node/include/cppgc/object-size-trait.h +58 -0
  56. package/dist/node/include/cppgc/persistent.h +377 -0
  57. package/dist/node/include/cppgc/platform.h +163 -0
  58. package/dist/node/include/cppgc/prefinalizer.h +75 -0
  59. package/dist/node/include/cppgc/process-heap-statistics.h +36 -0
  60. package/dist/node/include/cppgc/sentinel-pointer.h +39 -0
  61. package/dist/node/include/cppgc/source-location.h +16 -0
  62. package/dist/node/include/cppgc/testing.h +106 -0
  63. package/dist/node/include/cppgc/trace-trait.h +128 -0
  64. package/dist/node/include/cppgc/type-traits.h +271 -0
  65. package/dist/node/include/cppgc/visitor.h +504 -0
  66. package/dist/node/include/crypto/crypto_aes.h +88 -0
  67. package/dist/node/include/crypto/crypto_bio.h +193 -0
  68. package/dist/node/include/crypto/crypto_cipher.h +293 -0
  69. package/dist/node/include/crypto/crypto_clienthello-inl.h +90 -0
  70. package/dist/node/include/crypto/crypto_clienthello.h +131 -0
  71. package/dist/node/include/crypto/crypto_common.h +64 -0
  72. package/dist/node/include/crypto/crypto_context.h +171 -0
  73. package/dist/node/include/crypto/crypto_dh.h +126 -0
  74. package/dist/node/include/crypto/crypto_dsa.h +52 -0
  75. package/dist/node/include/crypto/crypto_ec.h +164 -0
  76. package/dist/node/include/crypto/crypto_hash.h +91 -0
  77. package/dist/node/include/crypto/crypto_hkdf.h +61 -0
  78. package/dist/node/include/crypto/crypto_hmac.h +92 -0
  79. package/dist/node/include/crypto/crypto_keygen.h +299 -0
  80. package/dist/node/include/crypto/crypto_keys.h +392 -0
  81. package/dist/node/include/crypto/crypto_pbkdf2.h +74 -0
  82. package/dist/node/include/crypto/crypto_random.h +124 -0
  83. package/dist/node/include/crypto/crypto_rsa.h +136 -0
  84. package/dist/node/include/crypto/crypto_scrypt.h +85 -0
  85. package/dist/node/include/crypto/crypto_sig.h +165 -0
  86. package/dist/node/include/crypto/crypto_spkac.h +21 -0
  87. package/dist/node/include/crypto/crypto_timing.h +20 -0
  88. package/dist/node/include/crypto/crypto_tls.h +305 -0
  89. package/dist/node/include/crypto/crypto_util.h +725 -0
  90. package/dist/node/include/crypto/crypto_x509.h +140 -0
  91. package/dist/node/include/dataqueue/queue.h +306 -0
  92. package/dist/node/include/debug_utils-inl.h +278 -0
  93. package/dist/node/include/debug_utils.h +196 -0
  94. package/dist/node/include/diagnosticfilename-inl.h +33 -0
  95. package/dist/node/include/embedded_data.h +17 -0
  96. package/dist/node/include/encoding_binding.h +61 -0
  97. package/dist/node/include/env-inl.h +984 -0
  98. package/dist/node/include/env.h +1287 -0
  99. package/dist/node/include/env_properties.h +540 -0
  100. package/dist/node/include/handle_wrap.h +123 -0
  101. package/dist/node/include/histogram-inl.h +107 -0
  102. package/dist/node/include/histogram.h +279 -0
  103. package/dist/node/include/inspector/io_agent.h +30 -0
  104. package/dist/node/include/inspector/main_thread_interface.h +116 -0
  105. package/dist/node/include/inspector/network_agent.h +94 -0
  106. package/dist/node/include/inspector/network_inspector.h +45 -0
  107. package/dist/node/include/inspector/network_requests_buffer.h +195 -0
  108. package/dist/node/include/inspector/network_resource_manager.h +29 -0
  109. package/dist/node/include/inspector/node_json.h +24 -0
  110. package/dist/node/include/inspector/node_string.h +101 -0
  111. package/dist/node/include/inspector/protocol_helper.h +27 -0
  112. package/dist/node/include/inspector/runtime_agent.h +41 -0
  113. package/dist/node/include/inspector/target_agent.h +75 -0
  114. package/dist/node/include/inspector/tracing_agent.h +43 -0
  115. package/dist/node/include/inspector/worker_agent.h +40 -0
  116. package/dist/node/include/inspector/worker_inspector.h +124 -0
  117. package/dist/node/include/inspector_agent.h +165 -0
  118. package/dist/node/include/inspector_io.h +78 -0
  119. package/dist/node/include/inspector_profiler.h +149 -0
  120. package/dist/node/include/inspector_socket.h +60 -0
  121. package/dist/node/include/inspector_socket_server.h +110 -0
  122. package/dist/node/include/js_native_api.h +607 -0
  123. package/dist/node/include/js_native_api_types.h +226 -0
  124. package/dist/node/include/js_native_api_v8.h +485 -0
  125. package/dist/node/include/js_native_api_v8_internals.h +45 -0
  126. package/dist/node/include/js_stream.h +52 -0
  127. package/dist/node/include/json_utils.h +172 -0
  128. package/dist/node/include/large_pages/node_large_page.h +34 -0
  129. package/dist/node/include/libplatform/libplatform-export.h +29 -0
  130. package/dist/node/include/libplatform/libplatform.h +112 -0
  131. package/dist/node/include/libplatform/v8-tracing.h +333 -0
  132. package/dist/node/include/memory_tracker-inl.h +359 -0
  133. package/dist/node/include/memory_tracker.h +289 -0
  134. package/dist/node/include/module_wrap.h +216 -0
  135. package/dist/node/include/node.h +1593 -0
  136. package/dist/node/include/node_api.h +265 -0
  137. package/dist/node/include/node_api_internals.h +48 -0
  138. package/dist/node/include/node_api_types.h +56 -0
  139. package/dist/node/include/node_binding.h +161 -0
  140. package/dist/node/include/node_blob.h +159 -0
  141. package/dist/node/include/node_bob-inl.h +36 -0
  142. package/dist/node/include/node_bob.h +107 -0
  143. package/dist/node/include/node_buffer.h +92 -0
  144. package/dist/node/include/node_builtins.h +220 -0
  145. package/dist/node/include/node_config_file.h +46 -0
  146. package/dist/node/include/node_constants.h +82 -0
  147. package/dist/node/include/node_context_data.h +168 -0
  148. package/dist/node/include/node_contextify.h +204 -0
  149. package/dist/node/include/node_crypto.h +56 -0
  150. package/dist/node/include/node_debug.h +30 -0
  151. package/dist/node/include/node_dir.h +52 -0
  152. package/dist/node/include/node_dotenv.h +45 -0
  153. package/dist/node/include/node_errors.h +380 -0
  154. package/dist/node/include/node_exit_code.h +54 -0
  155. package/dist/node/include/node_external_reference.h +165 -0
  156. package/dist/node/include/node_file-inl.h +406 -0
  157. package/dist/node/include/node_file.h +537 -0
  158. package/dist/node/include/node_http2.h +1177 -0
  159. package/dist/node/include/node_http2_state.h +159 -0
  160. package/dist/node/include/node_http_common-inl.h +202 -0
  161. package/dist/node/include/node_http_common.h +535 -0
  162. package/dist/node/include/node_i18n.h +132 -0
  163. package/dist/node/include/node_internals.h +483 -0
  164. package/dist/node/include/node_main_instance.h +67 -0
  165. package/dist/node/include/node_mem-inl.h +113 -0
  166. package/dist/node/include/node_mem.h +45 -0
  167. package/dist/node/include/node_messaging.h +389 -0
  168. package/dist/node/include/node_metadata.h +164 -0
  169. package/dist/node/include/node_modules.h +91 -0
  170. package/dist/node/include/node_mutex.h +323 -0
  171. package/dist/node/include/node_object_wrap.h +132 -0
  172. package/dist/node/include/node_options-inl.h +490 -0
  173. package/dist/node/include/node_options.h +615 -0
  174. package/dist/node/include/node_perf.h +166 -0
  175. package/dist/node/include/node_perf_common.h +102 -0
  176. package/dist/node/include/node_platform.h +238 -0
  177. package/dist/node/include/node_process-inl.h +26 -0
  178. package/dist/node/include/node_process.h +112 -0
  179. package/dist/node/include/node_realm-inl.h +151 -0
  180. package/dist/node/include/node_realm.h +183 -0
  181. package/dist/node/include/node_report.h +43 -0
  182. package/dist/node/include/node_revert.h +82 -0
  183. package/dist/node/include/node_root_certs.h +3520 -0
  184. package/dist/node/include/node_sea.h +74 -0
  185. package/dist/node/include/node_shadow_realm.h +46 -0
  186. package/dist/node/include/node_snapshot_builder.h +57 -0
  187. package/dist/node/include/node_snapshotable.h +174 -0
  188. package/dist/node/include/node_sockaddr-inl.h +257 -0
  189. package/dist/node/include/node_sockaddr.h +394 -0
  190. package/dist/node/include/node_sqlite.h +270 -0
  191. package/dist/node/include/node_stat_watcher.h +73 -0
  192. package/dist/node/include/node_task_runner.h +92 -0
  193. package/dist/node/include/node_threadsafe_cow-inl.h +54 -0
  194. package/dist/node/include/node_threadsafe_cow.h +105 -0
  195. package/dist/node/include/node_union_bytes.h +81 -0
  196. package/dist/node/include/node_url.h +96 -0
  197. package/dist/node/include/node_v8.h +77 -0
  198. package/dist/node/include/node_v8_platform-inl.h +185 -0
  199. package/dist/node/include/node_version.h +110 -0
  200. package/dist/node/include/node_wasi.h +184 -0
  201. package/dist/node/include/node_wasm_web_api.h +55 -0
  202. package/dist/node/include/node_watchdog.h +154 -0
  203. package/dist/node/include/node_webstorage.h +60 -0
  204. package/dist/node/include/node_worker.h +158 -0
  205. package/dist/node/include/path.h +33 -0
  206. package/dist/node/include/permission/addon_permission.h +31 -0
  207. package/dist/node/include/permission/child_process_permission.h +31 -0
  208. package/dist/node/include/permission/fs_permission.h +167 -0
  209. package/dist/node/include/permission/inspector_permission.h +31 -0
  210. package/dist/node/include/permission/permission.h +138 -0
  211. package/dist/node/include/permission/permission_base.h +65 -0
  212. package/dist/node/include/permission/wasi_permission.h +31 -0
  213. package/dist/node/include/permission/worker_permission.h +31 -0
  214. package/dist/node/include/pipe_wrap.h +80 -0
  215. package/dist/node/include/quic/application.h +159 -0
  216. package/dist/node/include/quic/bindingdata.h +272 -0
  217. package/dist/node/include/quic/cid.h +127 -0
  218. package/dist/node/include/quic/data.h +148 -0
  219. package/dist/node/include/quic/defs.h +245 -0
  220. package/dist/node/include/quic/endpoint.h +458 -0
  221. package/dist/node/include/quic/http3.h +15 -0
  222. package/dist/node/include/quic/logstream.h +81 -0
  223. package/dist/node/include/quic/packet.h +152 -0
  224. package/dist/node/include/quic/preferredaddress.h +72 -0
  225. package/dist/node/include/quic/session.h +443 -0
  226. package/dist/node/include/quic/sessionticket.h +108 -0
  227. package/dist/node/include/quic/streams.h +232 -0
  228. package/dist/node/include/quic/tlscontext.h +227 -0
  229. package/dist/node/include/quic/tokens.h +256 -0
  230. package/dist/node/include/quic/transportparams.h +165 -0
  231. package/dist/node/include/req_wrap-inl.h +171 -0
  232. package/dist/node/include/req_wrap.h +77 -0
  233. package/dist/node/include/spawn_sync.h +243 -0
  234. package/dist/node/include/stream_base-inl.h +173 -0
  235. package/dist/node/include/stream_base.h +478 -0
  236. package/dist/node/include/stream_pipe.h +76 -0
  237. package/dist/node/include/stream_wrap.h +132 -0
  238. package/dist/node/include/string_bytes.h +113 -0
  239. package/dist/node/include/string_decoder-inl.h +31 -0
  240. package/dist/node/include/string_decoder.h +49 -0
  241. package/dist/node/include/tcp_wrap.h +105 -0
  242. package/dist/node/include/threadpoolwork-inl.h +70 -0
  243. package/dist/node/include/timer_wrap-inl.h +32 -0
  244. package/dist/node/include/timer_wrap.h +85 -0
  245. package/dist/node/include/timers.h +70 -0
  246. package/dist/node/include/tracing/agent.h +195 -0
  247. package/dist/node/include/tracing/node_trace_buffer.h +83 -0
  248. package/dist/node/include/tracing/node_trace_writer.h +75 -0
  249. package/dist/node/include/tracing/trace_event.h +722 -0
  250. package/dist/node/include/tracing/trace_event_common.h +1109 -0
  251. package/dist/node/include/tracing/traced_value.h +129 -0
  252. package/dist/node/include/tty_wrap.h +65 -0
  253. package/dist/node/include/udp_wrap.h +230 -0
  254. package/dist/node/include/undici_version.h +6 -0
  255. package/dist/node/include/util-inl.h +700 -0
  256. package/dist/node/include/util.h +1021 -0
  257. package/dist/node/include/uv/aix.h +32 -0
  258. package/dist/node/include/uv/bsd.h +34 -0
  259. package/dist/node/include/uv/darwin.h +61 -0
  260. package/dist/node/include/uv/errno.h +483 -0
  261. package/dist/node/include/uv/linux.h +34 -0
  262. package/dist/node/include/uv/os390.h +33 -0
  263. package/dist/node/include/uv/posix.h +31 -0
  264. package/dist/node/include/uv/sunos.h +44 -0
  265. package/dist/node/include/uv/threadpool.h +37 -0
  266. package/dist/node/include/uv/tree.h +521 -0
  267. package/dist/node/include/uv/unix.h +512 -0
  268. package/dist/node/include/uv/version.h +43 -0
  269. package/dist/node/include/uv/win.h +698 -0
  270. package/dist/node/include/uv.h +1990 -0
  271. package/dist/node/include/v8-array-buffer.h +525 -0
  272. package/dist/node/include/v8-callbacks.h +462 -0
  273. package/dist/node/include/v8-container.h +183 -0
  274. package/dist/node/include/v8-context.h +485 -0
  275. package/dist/node/include/v8-cppgc.h +245 -0
  276. package/dist/node/include/v8-data.h +80 -0
  277. package/dist/node/include/v8-date.h +48 -0
  278. package/dist/node/include/v8-debug.h +168 -0
  279. package/dist/node/include/v8-embedder-heap.h +82 -0
  280. package/dist/node/include/v8-embedder-state-scope.h +52 -0
  281. package/dist/node/include/v8-exception.h +223 -0
  282. package/dist/node/include/v8-extension.h +62 -0
  283. package/dist/node/include/v8-external.h +37 -0
  284. package/dist/node/include/v8-fast-api-calls.h +984 -0
  285. package/dist/node/include/v8-forward.h +82 -0
  286. package/dist/node/include/v8-function-callback.h +607 -0
  287. package/dist/node/include/v8-function.h +140 -0
  288. package/dist/node/include/v8-handle-base.h +137 -0
  289. package/dist/node/include/v8-initialization.h +289 -0
  290. package/dist/node/include/v8-inspector-protocol.h +13 -0
  291. package/dist/node/include/v8-inspector.h +419 -0
  292. package/dist/node/include/v8-internal.h +1397 -0
  293. package/dist/node/include/v8-isolate.h +1767 -0
  294. package/dist/node/include/v8-json.h +47 -0
  295. package/dist/node/include/v8-local-handle.h +758 -0
  296. package/dist/node/include/v8-locker.h +138 -0
  297. package/dist/node/include/v8-maybe.h +160 -0
  298. package/dist/node/include/v8-memory-span.h +198 -0
  299. package/dist/node/include/v8-message.h +233 -0
  300. package/dist/node/include/v8-metrics.h +264 -0
  301. package/dist/node/include/v8-microtask-queue.h +157 -0
  302. package/dist/node/include/v8-microtask.h +28 -0
  303. package/dist/node/include/v8-object.h +824 -0
  304. package/dist/node/include/v8-persistent-handle.h +582 -0
  305. package/dist/node/include/v8-platform.h +1358 -0
  306. package/dist/node/include/v8-primitive-object.h +118 -0
  307. package/dist/node/include/v8-primitive.h +877 -0
  308. package/dist/node/include/v8-profiler.h +1302 -0
  309. package/dist/node/include/v8-promise.h +174 -0
  310. package/dist/node/include/v8-proxy.h +50 -0
  311. package/dist/node/include/v8-regexp.h +106 -0
  312. package/dist/node/include/v8-script.h +904 -0
  313. package/dist/node/include/v8-snapshot.h +266 -0
  314. package/dist/node/include/v8-source-location.h +92 -0
  315. package/dist/node/include/v8-statistics.h +238 -0
  316. package/dist/node/include/v8-template.h +1297 -0
  317. package/dist/node/include/v8-traced-handle.h +432 -0
  318. package/dist/node/include/v8-typed-array.h +390 -0
  319. package/dist/node/include/v8-unwinder-state.h +31 -0
  320. package/dist/node/include/v8-unwinder.h +132 -0
  321. package/dist/node/include/v8-util.h +665 -0
  322. package/dist/node/include/v8-value-serializer-version.h +24 -0
  323. package/dist/node/include/v8-value-serializer.h +316 -0
  324. package/dist/node/include/v8-value.h +655 -0
  325. package/dist/node/include/v8-version-string.h +38 -0
  326. package/dist/node/include/v8-version.h +20 -0
  327. package/dist/node/include/v8-wasm-trap-handler-posix.h +31 -0
  328. package/dist/node/include/v8-wasm-trap-handler-win.h +28 -0
  329. package/dist/node/include/v8-wasm.h +201 -0
  330. package/dist/node/include/v8-weak-callback-info.h +80 -0
  331. package/dist/node/include/v8.h +88 -0
  332. package/dist/node/include/v8config.h +981 -0
  333. package/dist/node/include/zlib_version.h +6 -0
  334. package/dist/node/libnode.dll +0 -0
  335. package/dist/node/libnode.lib +0 -0
  336. package/dist/node/libnodebuildinfo.json +10 -0
  337. package/dist/node/link_node.lib +0 -0
  338. package/dist/node/link_node.node +0 -0
  339. package/libnode.release.json +2 -2
  340. package/package.json +1 -1
@@ -0,0 +1,1109 @@
1
+ // Copyright 2015 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
+
5
+ #ifndef SRC_TRACE_EVENT_COMMON_H
6
+ #define SRC_TRACE_EVENT_COMMON_H
7
+
8
+ // This header file defines the set of trace_event macros without specifying
9
+ // how the events actually get collected and stored. If you need to expose trace
10
+ // events to some other universe, you can copy-and-paste this file as well as
11
+ // trace_event.h, modifying the macros contained there as necessary for the
12
+ // target platform. The end result is that multiple libraries can funnel events
13
+ // through to a shared trace event collector.
14
+
15
+ // IMPORTANT: To avoid conflicts, if you need to modify this file for a library,
16
+ // land your change in base/ first, and then copy-and-paste it.
17
+
18
+ // Trace events are for tracking application performance and resource usage.
19
+ // Macros are provided to track:
20
+ // Begin and end of function calls
21
+ // Counters
22
+ //
23
+ // Events are issued against categories. Whereas LOG's
24
+ // categories are statically defined, TRACE categories are created
25
+ // implicitly with a string. For example:
26
+ // TRACE_EVENT_INSTANT0("MY_SUBSYSTEM", "SomeImportantEvent",
27
+ // TRACE_EVENT_SCOPE_THREAD)
28
+ //
29
+ // It is often the case that one trace may belong in multiple categories at the
30
+ // same time. The first argument to the trace can be a comma-separated list of
31
+ // categories, forming a category group, like:
32
+ //
33
+ // TRACE_EVENT_INSTANT0("input,views", "OnMouseOver", TRACE_EVENT_SCOPE_THREAD)
34
+ //
35
+ // We can enable/disable tracing of OnMouseOver by enabling/disabling either
36
+ // category.
37
+ //
38
+ // Events can be INSTANT, or can be pairs of BEGIN and END in the same scope:
39
+ // TRACE_EVENT_BEGIN0("MY_SUBSYSTEM", "SomethingCostly")
40
+ // doSomethingCostly()
41
+ // TRACE_EVENT_END0("MY_SUBSYSTEM", "SomethingCostly")
42
+ // Note: our tools can't always determine the correct BEGIN/END pairs unless
43
+ // these are used in the same scope. Use ASYNC_BEGIN/ASYNC_END macros if you
44
+ // need them to be in separate scopes.
45
+ //
46
+ // A common use case is to trace entire function scopes. This
47
+ // issues a trace BEGIN and END automatically:
48
+ // void doSomethingCostly() {
49
+ // TRACE_EVENT0("MY_SUBSYSTEM", "doSomethingCostly");
50
+ // ...
51
+ // }
52
+ //
53
+ // Additional parameters can be associated with an event:
54
+ // void doSomethingCostly2(int howMuch) {
55
+ // TRACE_EVENT1("MY_SUBSYSTEM", "doSomethingCostly",
56
+ // "howMuch", howMuch);
57
+ // ...
58
+ // }
59
+ //
60
+ // The trace system will automatically add to this information the
61
+ // current process id, thread id, and a timestamp in microseconds.
62
+ //
63
+ // To trace an asynchronous procedure such as an IPC send/receive, use
64
+ // ASYNC_BEGIN and ASYNC_END:
65
+ // [single threaded sender code]
66
+ // static int send_count = 0;
67
+ // ++send_count;
68
+ // TRACE_EVENT_ASYNC_BEGIN0("ipc", "message", send_count);
69
+ // Send(new MyMessage(send_count));
70
+ // [receive code]
71
+ // void OnMyMessage(send_count) {
72
+ // TRACE_EVENT_ASYNC_END0("ipc", "message", send_count);
73
+ // }
74
+ // The third parameter is a unique ID to match ASYNC_BEGIN/ASYNC_END pairs.
75
+ // ASYNC_BEGIN and ASYNC_END can occur on any thread of any traced process.
76
+ // Pointers can be used for the ID parameter, and they will be mangled
77
+ // internally so that the same pointer on two different processes will not
78
+ // match. For example:
79
+ // class MyTracedClass {
80
+ // public:
81
+ // MyTracedClass() {
82
+ // TRACE_EVENT_ASYNC_BEGIN0("category", "MyTracedClass", this);
83
+ // }
84
+ // ~MyTracedClass() {
85
+ // TRACE_EVENT_ASYNC_END0("category", "MyTracedClass", this);
86
+ // }
87
+ // }
88
+ //
89
+ // Trace event also supports counters, which is a way to track a quantity
90
+ // as it varies over time. Counters are created with the following macro:
91
+ // TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter", g_myCounterValue);
92
+ //
93
+ // Counters are process-specific. The macro itself can be issued from any
94
+ // thread, however.
95
+ //
96
+ // Sometimes, you want to track two counters at once. You can do this with two
97
+ // counter macros:
98
+ // TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter0", g_myCounterValue[0]);
99
+ // TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter1", g_myCounterValue[1]);
100
+ // Or you can do it with a combined macro:
101
+ // TRACE_COUNTER2("MY_SUBSYSTEM", "myCounter",
102
+ // "bytesPinned", g_myCounterValue[0],
103
+ // "bytesAllocated", g_myCounterValue[1]);
104
+ // This indicates to the tracing UI that these counters should be displayed
105
+ // in a single graph, as a summed area chart.
106
+ //
107
+ // Since counters are in a global namespace, you may want to disambiguate with a
108
+ // unique ID, by using the TRACE_COUNTER_ID* variations.
109
+ //
110
+ // By default, trace collection is compiled in, but turned off at runtime.
111
+ // Collecting trace data is the responsibility of the embedding
112
+ // application. In Chrome's case, navigating to about:tracing will turn on
113
+ // tracing and display data collected across all active processes.
114
+ //
115
+ //
116
+ // Memory scoping note:
117
+ // Tracing copies the pointers, not the string content, of the strings passed
118
+ // in for category_group, name, and arg_names. Thus, the following code will
119
+ // cause problems:
120
+ // char* str = strdup("importantName");
121
+ // TRACE_EVENT_INSTANT0("SUBSYSTEM", str); // BAD!
122
+ // free(str); // Trace system now has dangling pointer
123
+ //
124
+ // To avoid this issue with the |name| and |arg_name| parameters, use the
125
+ // TRACE_EVENT_COPY_XXX overloads of the macros at additional runtime overhead.
126
+ // Notes: The category must always be in a long-lived char* (i.e. static const).
127
+ // The |arg_values|, when used, are always deep copied with the _COPY
128
+ // macros.
129
+ //
130
+ // When are string argument values copied:
131
+ // const char* arg_values are only referenced by default:
132
+ // TRACE_EVENT1("category", "name",
133
+ // "arg1", "literal string is only referenced");
134
+ // Use TRACE_STR_COPY to force copying of a const char*:
135
+ // TRACE_EVENT1("category", "name",
136
+ // "arg1", TRACE_STR_COPY("string will be copied"));
137
+ // std::string arg_values are always copied:
138
+ // TRACE_EVENT1("category", "name",
139
+ // "arg1", std::string("string will be copied"));
140
+ //
141
+ //
142
+ // Convertable notes:
143
+ // Converting a large data type to a string can be costly. To help with this,
144
+ // the trace framework provides an interface ConvertableToTraceFormat. If you
145
+ // inherit from it and implement the AppendAsTraceFormat method the trace
146
+ // framework will call back to your object to convert a trace output time. This
147
+ // means, if the category for the event is disabled, the conversion will not
148
+ // happen.
149
+ //
150
+ // class MyData : public base::trace_event::ConvertableToTraceFormat {
151
+ // public:
152
+ // MyData() {}
153
+ // void AppendAsTraceFormat(std::string* out) const override {
154
+ // out->append("{\"foo\":1}");
155
+ // }
156
+ // MyData(const MyData&) = delete;
157
+ // MyData& operator=(const MyData&) = delete;
158
+ //
159
+ // private:
160
+ // ~MyData() override {}
161
+ // };
162
+ //
163
+ // TRACE_EVENT1("foo", "bar", "data",
164
+ // std::unique_ptr<ConvertableToTraceFormat>(new MyData()));
165
+ //
166
+ // The trace framework will take ownership if the passed pointer and it will
167
+ // be free'd when the trace buffer is flushed.
168
+ //
169
+ // Note, we only do the conversion when the buffer is flushed, so the provided
170
+ // data object should not be modified after it's passed to the trace framework.
171
+ //
172
+ //
173
+ // Thread Safety:
174
+ // A thread safe singleton and mutex are used for thread safety. Category
175
+ // enabled flags are used to limit the performance impact when the system
176
+ // is not enabled.
177
+ //
178
+ // TRACE_EVENT macros first cache a pointer to a category. The categories are
179
+ // statically allocated and safe at all times, even after exit. Fetching a
180
+ // category is protected by the TraceLog::lock_. Multiple threads initializing
181
+ // the static variable is safe, as they will be serialized by the lock and
182
+ // multiple calls will return the same pointer to the category.
183
+ //
184
+ // Then the category_group_enabled flag is checked. This is a unsigned char, and
185
+ // not intended to be multithread safe. It optimizes access to AddTraceEvent
186
+ // which is threadsafe internally via TraceLog::lock_. The enabled flag may
187
+ // cause some threads to incorrectly call or skip calling AddTraceEvent near
188
+ // the time of the system being enabled or disabled. This is acceptable as
189
+ // we tolerate some data loss while the system is being enabled/disabled and
190
+ // because AddTraceEvent is threadsafe internally and checks the enabled state
191
+ // again under lock.
192
+ //
193
+ // Without the use of these static category pointers and enabled flags all
194
+ // trace points would carry a significant performance cost of acquiring a lock
195
+ // and resolving the category.
196
+
197
+ // Check that nobody includes this file directly. Clients are supposed to
198
+ // include the surrounding "trace_event.h" of their project instead.
199
+ #if defined(TRACE_EVENT0)
200
+ #error "Another copy of this file has already been included."
201
+ #endif
202
+
203
+ // This will mark the trace event as disabled by default. The user will need
204
+ // to explicitly enable the event.
205
+ #define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name
206
+
207
+ // Records a pair of begin and end events called "name" for the current
208
+ // scope, with 0, 1 or 2 associated arguments. If the category is not
209
+ // enabled, then this does nothing.
210
+ // - category and name strings must have application lifetime (statics or
211
+ // literals). They may not include " chars.
212
+ #define TRACE_EVENT0(category_group, name) \
213
+ INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name)
214
+ #define TRACE_EVENT_WITH_FLOW0(category_group, name, bind_id, flow_flags) \
215
+ INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, bind_id, \
216
+ flow_flags)
217
+ #define TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \
218
+ INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val)
219
+ #define TRACE_EVENT_WITH_FLOW1(category_group, name, bind_id, flow_flags, \
220
+ arg1_name, arg1_val) \
221
+ INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, bind_id, \
222
+ flow_flags, arg1_name, arg1_val)
223
+ #define TRACE_EVENT2(category_group, name, arg1_name, arg1_val, arg2_name, \
224
+ arg2_val) \
225
+ INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val, \
226
+ arg2_name, arg2_val)
227
+ #define TRACE_EVENT_WITH_FLOW2(category_group, name, bind_id, flow_flags, \
228
+ arg1_name, arg1_val, arg2_name, arg2_val) \
229
+ INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, bind_id, \
230
+ flow_flags, arg1_name, arg1_val, \
231
+ arg2_name, arg2_val)
232
+
233
+ // Records a single event called "name" immediately, with 0, 1 or 2
234
+ // associated arguments. If the category is not enabled, then this
235
+ // does nothing.
236
+ // - category and name strings must have application lifetime (statics or
237
+ // literals). They may not include " chars.
238
+ #define TRACE_EVENT_INSTANT0(category_group, name, scope) \
239
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category_group, name, \
240
+ TRACE_EVENT_FLAG_NONE | scope)
241
+ #define TRACE_EVENT_INSTANT1(category_group, name, scope, arg1_name, arg1_val) \
242
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category_group, name, \
243
+ TRACE_EVENT_FLAG_NONE | scope, arg1_name, arg1_val)
244
+ #define TRACE_EVENT_INSTANT2(category_group, name, scope, arg1_name, arg1_val, \
245
+ arg2_name, arg2_val) \
246
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category_group, name, \
247
+ TRACE_EVENT_FLAG_NONE | scope, arg1_name, arg1_val, \
248
+ arg2_name, arg2_val)
249
+ #define TRACE_EVENT_COPY_INSTANT0(category_group, name, scope) \
250
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category_group, name, \
251
+ TRACE_EVENT_FLAG_COPY | scope)
252
+ #define TRACE_EVENT_COPY_INSTANT1(category_group, name, scope, arg1_name, \
253
+ arg1_val) \
254
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category_group, name, \
255
+ TRACE_EVENT_FLAG_COPY | scope, arg1_name, arg1_val)
256
+ #define TRACE_EVENT_COPY_INSTANT2(category_group, name, scope, arg1_name, \
257
+ arg1_val, arg2_name, arg2_val) \
258
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category_group, name, \
259
+ TRACE_EVENT_FLAG_COPY | scope, arg1_name, arg1_val, \
260
+ arg2_name, arg2_val)
261
+
262
+ #define TRACE_EVENT_INSTANT_WITH_TIMESTAMP0(category_group, name, scope, \
263
+ timestamp) \
264
+ INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \
265
+ TRACE_EVENT_PHASE_INSTANT, category_group, name, timestamp, \
266
+ TRACE_EVENT_FLAG_NONE | scope)
267
+
268
+ #define TRACE_EVENT_INSTANT_WITH_TIMESTAMP1(category_group, name, scope, \
269
+ timestamp, arg_name, arg_val) \
270
+ INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \
271
+ TRACE_EVENT_PHASE_INSTANT, category_group, name, timestamp, \
272
+ TRACE_EVENT_FLAG_NONE | scope, arg_name, arg_val)
273
+
274
+ // Records a single BEGIN event called "name" immediately, with 0, 1 or 2
275
+ // associated arguments. If the category is not enabled, then this
276
+ // does nothing.
277
+ // - category and name strings must have application lifetime (statics or
278
+ // literals). They may not include " chars.
279
+ #define TRACE_EVENT_BEGIN(category_group, name, ...) \
280
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, category_group, name, \
281
+ TRACE_EVENT_FLAG_NONE, ##__VA_ARGS__)
282
+ #define TRACE_EVENT_BEGIN0(category_group, name) \
283
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, category_group, name, \
284
+ TRACE_EVENT_FLAG_NONE)
285
+ #define TRACE_EVENT_BEGIN1(category_group, name, arg1_name, arg1_val) \
286
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, category_group, name, \
287
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
288
+ #define TRACE_EVENT_BEGIN2(category_group, name, arg1_name, arg1_val, \
289
+ arg2_name, arg2_val) \
290
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, category_group, name, \
291
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \
292
+ arg2_name, arg2_val)
293
+ #define TRACE_EVENT_COPY_BEGIN0(category_group, name) \
294
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, category_group, name, \
295
+ TRACE_EVENT_FLAG_COPY)
296
+ #define TRACE_EVENT_COPY_BEGIN1(category_group, name, arg1_name, arg1_val) \
297
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, category_group, name, \
298
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
299
+ #define TRACE_EVENT_COPY_BEGIN2(category_group, name, arg1_name, arg1_val, \
300
+ arg2_name, arg2_val) \
301
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, category_group, name, \
302
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, \
303
+ arg2_name, arg2_val)
304
+
305
+ // Similar to TRACE_EVENT_BEGINx but with a custom |at| timestamp provided.
306
+ // - |id| is used to match the _BEGIN event with the _END event.
307
+ // Events are considered to match if their category_group, name and id values
308
+ // all match. |id| must either be a pointer or an integer value up to 64 bits.
309
+ // If it's a pointer, the bits will be xored with a hash of the process ID so
310
+ // that the same pointer on two different processes will not collide.
311
+ #define TRACE_EVENT_BEGIN_WITH_ID_TID_AND_TIMESTAMP0(category_group, name, id, \
312
+ thread_id, timestamp) \
313
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
314
+ TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, thread_id, \
315
+ timestamp, TRACE_EVENT_FLAG_NONE)
316
+ #define TRACE_EVENT_COPY_BEGIN_WITH_ID_TID_AND_TIMESTAMP0( \
317
+ category_group, name, id, thread_id, timestamp) \
318
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
319
+ TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, thread_id, \
320
+ timestamp, TRACE_EVENT_FLAG_COPY)
321
+ #define TRACE_EVENT_COPY_BEGIN_WITH_ID_TID_AND_TIMESTAMP1( \
322
+ category_group, name, id, thread_id, timestamp, arg1_name, arg1_val) \
323
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
324
+ TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, thread_id, \
325
+ timestamp, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
326
+ #define TRACE_EVENT_COPY_BEGIN_WITH_ID_TID_AND_TIMESTAMP2( \
327
+ category_group, name, id, thread_id, timestamp, arg1_name, arg1_val, \
328
+ arg2_name, arg2_val) \
329
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
330
+ TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, thread_id, \
331
+ timestamp, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, arg2_name, \
332
+ arg2_val)
333
+
334
+ // Records a single END event for "name" immediately. If the category
335
+ // is not enabled, then this does nothing.
336
+ // - category and name strings must have application lifetime (statics or
337
+ // literals). They may not include " chars.
338
+ #define TRACE_EVENT_END(category_group, name, ...) \
339
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, category_group, name, \
340
+ TRACE_EVENT_FLAG_NONE, ##__VA_ARGS__)
341
+ #define TRACE_EVENT_END0(category_group, name) \
342
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, category_group, name, \
343
+ TRACE_EVENT_FLAG_NONE)
344
+ #define TRACE_EVENT_END1(category_group, name, arg1_name, arg1_val) \
345
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, category_group, name, \
346
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
347
+ #define TRACE_EVENT_END2(category_group, name, arg1_name, arg1_val, arg2_name, \
348
+ arg2_val) \
349
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, category_group, name, \
350
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \
351
+ arg2_name, arg2_val)
352
+ #define TRACE_EVENT_COPY_END0(category_group, name) \
353
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, category_group, name, \
354
+ TRACE_EVENT_FLAG_COPY)
355
+ #define TRACE_EVENT_COPY_END1(category_group, name, arg1_name, arg1_val) \
356
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, category_group, name, \
357
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
358
+ #define TRACE_EVENT_COPY_END2(category_group, name, arg1_name, arg1_val, \
359
+ arg2_name, arg2_val) \
360
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, category_group, name, \
361
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, \
362
+ arg2_name, arg2_val)
363
+
364
+ #define TRACE_EVENT_MARK_WITH_TIMESTAMP0(category_group, name, timestamp) \
365
+ INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \
366
+ TRACE_EVENT_PHASE_MARK, category_group, name, timestamp, \
367
+ TRACE_EVENT_FLAG_NONE)
368
+
369
+ #define TRACE_EVENT_MARK_WITH_TIMESTAMP1(category_group, name, timestamp, \
370
+ arg1_name, arg1_val) \
371
+ INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \
372
+ TRACE_EVENT_PHASE_MARK, category_group, name, timestamp, \
373
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
374
+
375
+ #define TRACE_EVENT_MARK_WITH_TIMESTAMP2( \
376
+ category_group, name, timestamp, arg1_name, arg1_val, arg2_name, arg2_val) \
377
+ INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \
378
+ TRACE_EVENT_PHASE_MARK, category_group, name, timestamp, \
379
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val)
380
+
381
+ #define TRACE_EVENT_COPY_MARK(category_group, name) \
382
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_MARK, category_group, name, \
383
+ TRACE_EVENT_FLAG_COPY)
384
+
385
+ #define TRACE_EVENT_COPY_MARK_WITH_TIMESTAMP(category_group, name, timestamp) \
386
+ INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \
387
+ TRACE_EVENT_PHASE_MARK, category_group, name, timestamp, \
388
+ TRACE_EVENT_FLAG_COPY)
389
+
390
+ // Similar to TRACE_EVENT_ENDx but with a custom |at| timestamp provided.
391
+ // - |id| is used to match the _BEGIN event with the _END event.
392
+ // Events are considered to match if their category_group, name and id values
393
+ // all match. |id| must either be a pointer or an integer value up to 64 bits.
394
+ // If it's a pointer, the bits will be xored with a hash of the process ID so
395
+ // that the same pointer on two different processes will not collide.
396
+ #define TRACE_EVENT_END_WITH_ID_TID_AND_TIMESTAMP0(category_group, name, id, \
397
+ thread_id, timestamp) \
398
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
399
+ TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, thread_id, \
400
+ timestamp, TRACE_EVENT_FLAG_NONE)
401
+ #define TRACE_EVENT_COPY_END_WITH_ID_TID_AND_TIMESTAMP0( \
402
+ category_group, name, id, thread_id, timestamp) \
403
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
404
+ TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, thread_id, \
405
+ timestamp, TRACE_EVENT_FLAG_COPY)
406
+ #define TRACE_EVENT_COPY_END_WITH_ID_TID_AND_TIMESTAMP1( \
407
+ category_group, name, id, thread_id, timestamp, arg1_name, arg1_val) \
408
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
409
+ TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, thread_id, \
410
+ timestamp, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
411
+ #define TRACE_EVENT_COPY_END_WITH_ID_TID_AND_TIMESTAMP2( \
412
+ category_group, name, id, thread_id, timestamp, arg1_name, arg1_val, \
413
+ arg2_name, arg2_val) \
414
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
415
+ TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, thread_id, \
416
+ timestamp, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, arg2_name, \
417
+ arg2_val)
418
+
419
+ // Records the value of a counter called "name" immediately. Value
420
+ // must be representable as a 32 bit integer.
421
+ // - category and name strings must have application lifetime (statics or
422
+ // literals). They may not include " chars.
423
+ #define TRACE_COUNTER1(category_group, name, value) \
424
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, category_group, name, \
425
+ TRACE_EVENT_FLAG_NONE, "value", \
426
+ static_cast<int>(value))
427
+ #define TRACE_COPY_COUNTER1(category_group, name, value) \
428
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, category_group, name, \
429
+ TRACE_EVENT_FLAG_COPY, "value", \
430
+ static_cast<int>(value))
431
+
432
+ // Records the values of a multi-parted counter called "name" immediately.
433
+ // The UI will treat value1 and value2 as parts of a whole, displaying their
434
+ // values as a stacked-bar chart.
435
+ // - category and name strings must have application lifetime (statics or
436
+ // literals). They may not include " chars.
437
+ #define TRACE_COUNTER2(category_group, name, value1_name, value1_val, \
438
+ value2_name, value2_val) \
439
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, category_group, name, \
440
+ TRACE_EVENT_FLAG_NONE, value1_name, \
441
+ static_cast<int>(value1_val), value2_name, \
442
+ static_cast<int>(value2_val))
443
+ #define TRACE_COPY_COUNTER2(category_group, name, value1_name, value1_val, \
444
+ value2_name, value2_val) \
445
+ INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, category_group, name, \
446
+ TRACE_EVENT_FLAG_COPY, value1_name, \
447
+ static_cast<int>(value1_val), value2_name, \
448
+ static_cast<int>(value2_val))
449
+
450
+ // Similar to TRACE_COUNTERx, but with a custom |timestamp| provided.
451
+ #define TRACE_COUNTER_WITH_TIMESTAMP1(category_group, name, timestamp, value) \
452
+ INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \
453
+ TRACE_EVENT_PHASE_COUNTER, category_group, name, timestamp, \
454
+ TRACE_EVENT_FLAG_NONE, "value", static_cast<int>(value))
455
+
456
+ #define TRACE_COUNTER_WITH_TIMESTAMP2(category_group, name, timestamp, \
457
+ value1_name, value1_val, value2_name, \
458
+ value2_val) \
459
+ INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \
460
+ TRACE_EVENT_PHASE_COUNTER, category_group, name, timestamp, \
461
+ TRACE_EVENT_FLAG_NONE, value1_name, static_cast<int>(value1_val), \
462
+ value2_name, static_cast<int>(value2_val))
463
+
464
+ // Records the value of a counter called "name" immediately. Value
465
+ // must be representable as a 32 bit integer.
466
+ // - category and name strings must have application lifetime (statics or
467
+ // literals). They may not include " chars.
468
+ // - |id| is used to disambiguate counters with the same name. It must either
469
+ // be a pointer or an integer value up to 64 bits. If it's a pointer, the bits
470
+ // will be xored with a hash of the process ID so that the same pointer on
471
+ // two different processes will not collide.
472
+ #define TRACE_COUNTER_ID1(category_group, name, id, value) \
473
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, category_group, \
474
+ name, id, TRACE_EVENT_FLAG_NONE, "value", \
475
+ static_cast<int>(value))
476
+ #define TRACE_COPY_COUNTER_ID1(category_group, name, id, value) \
477
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, category_group, \
478
+ name, id, TRACE_EVENT_FLAG_COPY, "value", \
479
+ static_cast<int>(value))
480
+
481
+ // Records the values of a multi-parted counter called "name" immediately.
482
+ // The UI will treat value1 and value2 as parts of a whole, displaying their
483
+ // values as a stacked-bar chart.
484
+ // - category and name strings must have application lifetime (statics or
485
+ // literals). They may not include " chars.
486
+ // - |id| is used to disambiguate counters with the same name. It must either
487
+ // be a pointer or an integer value up to 64 bits. If it's a pointer, the bits
488
+ // will be xored with a hash of the process ID so that the same pointer on
489
+ // two different processes will not collide.
490
+ #define TRACE_COUNTER_ID2(category_group, name, id, value1_name, value1_val, \
491
+ value2_name, value2_val) \
492
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, category_group, \
493
+ name, id, TRACE_EVENT_FLAG_NONE, \
494
+ value1_name, static_cast<int>(value1_val), \
495
+ value2_name, static_cast<int>(value2_val))
496
+ #define TRACE_COPY_COUNTER_ID2(category_group, name, id, value1_name, \
497
+ value1_val, value2_name, value2_val) \
498
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, category_group, \
499
+ name, id, TRACE_EVENT_FLAG_COPY, \
500
+ value1_name, static_cast<int>(value1_val), \
501
+ value2_name, static_cast<int>(value2_val))
502
+
503
+ // TRACE_EVENT_SAMPLE_* events are injected by the sampling profiler.
504
+ #define TRACE_EVENT_SAMPLE_WITH_TID_AND_TIMESTAMP0(category_group, name, \
505
+ thread_id, timestamp) \
506
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
507
+ TRACE_EVENT_PHASE_SAMPLE, category_group, name, 0, thread_id, timestamp, \
508
+ TRACE_EVENT_FLAG_NONE)
509
+
510
+ #define TRACE_EVENT_SAMPLE_WITH_TID_AND_TIMESTAMP1( \
511
+ category_group, name, thread_id, timestamp, arg1_name, arg1_val) \
512
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
513
+ TRACE_EVENT_PHASE_SAMPLE, category_group, name, 0, thread_id, timestamp, \
514
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
515
+
516
+ #define TRACE_EVENT_SAMPLE_WITH_TID_AND_TIMESTAMP2(category_group, name, \
517
+ thread_id, timestamp, \
518
+ arg1_name, arg1_val, \
519
+ arg2_name, arg2_val) \
520
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
521
+ TRACE_EVENT_PHASE_SAMPLE, category_group, name, 0, thread_id, timestamp, \
522
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val)
523
+
524
+ #define TRACE_EVENT_SAMPLE_WITH_ID1(category_group, name, id, arg1_name, \
525
+ arg1_val) \
526
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_SAMPLE, category_group, \
527
+ name, id, TRACE_EVENT_FLAG_NONE, arg1_name, \
528
+ arg1_val)
529
+
530
+ // ASYNC_STEP_* APIs should be only used by legacy code. New code should
531
+ // consider using NESTABLE_ASYNC_* APIs to describe substeps within an async
532
+ // event.
533
+ // Records a single ASYNC_BEGIN event called "name" immediately, with 0, 1 or 2
534
+ // associated arguments. If the category is not enabled, then this
535
+ // does nothing.
536
+ // - category and name strings must have application lifetime (statics or
537
+ // literals). They may not include " chars.
538
+ // - |id| is used to match the ASYNC_BEGIN event with the ASYNC_END event. ASYNC
539
+ // events are considered to match if their category_group, name and id values
540
+ // all match. |id| must either be a pointer or an integer value up to 64 bits.
541
+ // If it's a pointer, the bits will be xored with a hash of the process ID so
542
+ // that the same pointer on two different processes will not collide.
543
+ //
544
+ // An asynchronous operation can consist of multiple phases. The first phase is
545
+ // defined by the ASYNC_BEGIN calls. Additional phases can be defined using the
546
+ // ASYNC_STEP_INTO or ASYNC_STEP_PAST macros. The ASYNC_STEP_INTO macro will
547
+ // annotate the block following the call. The ASYNC_STEP_PAST macro will
548
+ // annotate the block prior to the call. Note that any particular event must use
549
+ // only STEP_INTO or STEP_PAST macros; they can not mix and match. When the
550
+ // operation completes, call ASYNC_END.
551
+ //
552
+ // An ASYNC trace typically occurs on a single thread (if not, they will only be
553
+ // drawn on the thread defined in the ASYNC_BEGIN event), but all events in that
554
+ // operation must use the same |name| and |id|. Each step can have its own
555
+ // args.
556
+ #define TRACE_EVENT_ASYNC_BEGIN0(category_group, name, id) \
557
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \
558
+ category_group, name, id, \
559
+ TRACE_EVENT_FLAG_NONE)
560
+ #define TRACE_EVENT_ASYNC_BEGIN1(category_group, name, id, arg1_name, \
561
+ arg1_val) \
562
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \
563
+ category_group, name, id, \
564
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
565
+ #define TRACE_EVENT_ASYNC_BEGIN2(category_group, name, id, arg1_name, \
566
+ arg1_val, arg2_name, arg2_val) \
567
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
568
+ TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, \
569
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val)
570
+ #define TRACE_EVENT_COPY_ASYNC_BEGIN0(category_group, name, id) \
571
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \
572
+ category_group, name, id, \
573
+ TRACE_EVENT_FLAG_COPY)
574
+ #define TRACE_EVENT_COPY_ASYNC_BEGIN1(category_group, name, id, arg1_name, \
575
+ arg1_val) \
576
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \
577
+ category_group, name, id, \
578
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
579
+ #define TRACE_EVENT_COPY_ASYNC_BEGIN2(category_group, name, id, arg1_name, \
580
+ arg1_val, arg2_name, arg2_val) \
581
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
582
+ TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, \
583
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, arg2_name, arg2_val)
584
+
585
+ // Similar to TRACE_EVENT_ASYNC_BEGINx but with a custom |at| timestamp
586
+ // provided.
587
+ #define TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP0(category_group, name, id, \
588
+ timestamp) \
589
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
590
+ TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, \
591
+ TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE)
592
+ #define TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( \
593
+ category_group, name, id, timestamp, arg1_name, arg1_val) \
594
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
595
+ TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, \
596
+ TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE, \
597
+ arg1_name, arg1_val)
598
+ #define TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP2(category_group, name, id, \
599
+ timestamp, arg1_name, \
600
+ arg1_val, arg2_name, arg2_val) \
601
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
602
+ TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, \
603
+ TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE, \
604
+ arg1_name, arg1_val, arg2_name, arg2_val)
605
+ #define TRACE_EVENT_COPY_ASYNC_BEGIN_WITH_TIMESTAMP0(category_group, name, id, \
606
+ timestamp) \
607
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
608
+ TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, \
609
+ TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_COPY)
610
+
611
+ // Records a single ASYNC_STEP_INTO event for |step| immediately. If the
612
+ // category is not enabled, then this does nothing. The |name| and |id| must
613
+ // match the ASYNC_BEGIN event above. The |step| param identifies this step
614
+ // within the async event. This should be called at the beginning of the next
615
+ // phase of an asynchronous operation. The ASYNC_BEGIN event must not have any
616
+ // ASYNC_STEP_PAST events.
617
+ #define TRACE_EVENT_ASYNC_STEP_INTO0(category_group, name, id, step) \
618
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP_INTO, \
619
+ category_group, name, id, \
620
+ TRACE_EVENT_FLAG_NONE, "step", step)
621
+ #define TRACE_EVENT_ASYNC_STEP_INTO1(category_group, name, id, step, \
622
+ arg1_name, arg1_val) \
623
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
624
+ TRACE_EVENT_PHASE_ASYNC_STEP_INTO, category_group, name, id, \
625
+ TRACE_EVENT_FLAG_NONE, "step", step, arg1_name, arg1_val)
626
+
627
+ // Similar to TRACE_EVENT_ASYNC_STEP_INTOx but with a custom |at| timestamp
628
+ // provided.
629
+ #define TRACE_EVENT_ASYNC_STEP_INTO_WITH_TIMESTAMP0(category_group, name, id, \
630
+ step, timestamp) \
631
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
632
+ TRACE_EVENT_PHASE_ASYNC_STEP_INTO, category_group, name, id, \
633
+ TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE, \
634
+ "step", step)
635
+
636
+ // Records a single ASYNC_STEP_PAST event for |step| immediately. If the
637
+ // category is not enabled, then this does nothing. The |name| and |id| must
638
+ // match the ASYNC_BEGIN event above. The |step| param identifies this step
639
+ // within the async event. This should be called at the beginning of the next
640
+ // phase of an asynchronous operation. The ASYNC_BEGIN event must not have any
641
+ // ASYNC_STEP_INTO events.
642
+ #define TRACE_EVENT_ASYNC_STEP_PAST0(category_group, name, id, step) \
643
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP_PAST, \
644
+ category_group, name, id, \
645
+ TRACE_EVENT_FLAG_NONE, "step", step)
646
+ #define TRACE_EVENT_ASYNC_STEP_PAST1(category_group, name, id, step, \
647
+ arg1_name, arg1_val) \
648
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
649
+ TRACE_EVENT_PHASE_ASYNC_STEP_PAST, category_group, name, id, \
650
+ TRACE_EVENT_FLAG_NONE, "step", step, arg1_name, arg1_val)
651
+
652
+ // Records a single ASYNC_END event for "name" immediately. If the category
653
+ // is not enabled, then this does nothing.
654
+ #define TRACE_EVENT_ASYNC_END0(category_group, name, id) \
655
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \
656
+ category_group, name, id, \
657
+ TRACE_EVENT_FLAG_NONE)
658
+ #define TRACE_EVENT_ASYNC_END1(category_group, name, id, arg1_name, arg1_val) \
659
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \
660
+ category_group, name, id, \
661
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
662
+ #define TRACE_EVENT_ASYNC_END2(category_group, name, id, arg1_name, arg1_val, \
663
+ arg2_name, arg2_val) \
664
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
665
+ TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \
666
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val)
667
+ #define TRACE_EVENT_COPY_ASYNC_END0(category_group, name, id) \
668
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \
669
+ category_group, name, id, \
670
+ TRACE_EVENT_FLAG_COPY)
671
+ #define TRACE_EVENT_COPY_ASYNC_END1(category_group, name, id, arg1_name, \
672
+ arg1_val) \
673
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \
674
+ category_group, name, id, \
675
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
676
+ #define TRACE_EVENT_COPY_ASYNC_END2(category_group, name, id, arg1_name, \
677
+ arg1_val, arg2_name, arg2_val) \
678
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
679
+ TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \
680
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, arg2_name, arg2_val)
681
+
682
+ // Similar to TRACE_EVENT_ASYNC_ENDx but with a custom |at| timestamp provided.
683
+ #define TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP0(category_group, name, id, \
684
+ timestamp) \
685
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
686
+ TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \
687
+ TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE)
688
+ #define TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP1(category_group, name, id, \
689
+ timestamp, arg1_name, arg1_val) \
690
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
691
+ TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \
692
+ TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE, \
693
+ arg1_name, arg1_val)
694
+ #define TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP2(category_group, name, id, \
695
+ timestamp, arg1_name, arg1_val, \
696
+ arg2_name, arg2_val) \
697
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
698
+ TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \
699
+ TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE, \
700
+ arg1_name, arg1_val, arg2_name, arg2_val)
701
+
702
+ // NESTABLE_ASYNC_* APIs are used to describe an async operation, which can
703
+ // be nested within a NESTABLE_ASYNC event and/or have inner NESTABLE_ASYNC
704
+ // events.
705
+ // - category and name strings must have application lifetime (statics or
706
+ // literals). They may not include " chars.
707
+ // - A pair of NESTABLE_ASYNC_BEGIN event and NESTABLE_ASYNC_END event is
708
+ // considered as a match if their category_group, name and id all match.
709
+ // - |id| must either be a pointer or an integer value up to 64 bits.
710
+ // If it's a pointer, the bits will be xored with a hash of the process ID so
711
+ // that the same pointer on two different processes will not collide.
712
+ // - |id| is used to match a child NESTABLE_ASYNC event with its parent
713
+ // NESTABLE_ASYNC event. Therefore, events in the same nested event tree must
714
+ // be logged using the same id and category_group.
715
+ //
716
+ // Unmatched NESTABLE_ASYNC_END event will be parsed as an event that starts
717
+ // at the first NESTABLE_ASYNC event of that id, and unmatched
718
+ // NESTABLE_ASYNC_BEGIN event will be parsed as an event that ends at the last
719
+ // NESTABLE_ASYNC event of that id. Corresponding warning messages for
720
+ // unmatched events will be shown in the analysis view.
721
+
722
+ // Records a single NESTABLE_ASYNC_BEGIN event called "name" immediately, with
723
+ // 0, 1 or 2 associated arguments. If the category is not enabled, then this
724
+ // does nothing.
725
+ #define TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(category_group, name, id) \
726
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, \
727
+ category_group, name, id, \
728
+ TRACE_EVENT_FLAG_NONE)
729
+ #define TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(category_group, name, id, arg1_name, \
730
+ arg1_val) \
731
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, \
732
+ category_group, name, id, \
733
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
734
+ #define TRACE_EVENT_NESTABLE_ASYNC_BEGIN2(category_group, name, id, arg1_name, \
735
+ arg1_val, arg2_name, arg2_val) \
736
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
737
+ TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, category_group, name, id, \
738
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val)
739
+ // Records a single NESTABLE_ASYNC_END event called "name" immediately, with 0
740
+ // or 2 associated arguments. If the category is not enabled, then this does
741
+ // nothing.
742
+ #define TRACE_EVENT_NESTABLE_ASYNC_END0(category_group, name, id) \
743
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, \
744
+ category_group, name, id, \
745
+ TRACE_EVENT_FLAG_NONE)
746
+ // Records a single NESTABLE_ASYNC_END event called "name" immediately, with 1
747
+ // associated argument. If the category is not enabled, then this does nothing.
748
+ #define TRACE_EVENT_NESTABLE_ASYNC_END1(category_group, name, id, arg1_name, \
749
+ arg1_val) \
750
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, \
751
+ category_group, name, id, \
752
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
753
+ #define TRACE_EVENT_NESTABLE_ASYNC_END2(category_group, name, id, arg1_name, \
754
+ arg1_val, arg2_name, arg2_val) \
755
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
756
+ TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, category_group, name, id, \
757
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val)
758
+
759
+ // Records a single NESTABLE_ASYNC_INSTANT event called "name" immediately,
760
+ // with none, one or two associated argument. If the category is not enabled,
761
+ // then this does nothing.
762
+ #define TRACE_EVENT_NESTABLE_ASYNC_INSTANT0(category_group, name, id) \
763
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT, \
764
+ category_group, name, id, \
765
+ TRACE_EVENT_FLAG_NONE)
766
+
767
+ #define TRACE_EVENT_NESTABLE_ASYNC_INSTANT1(category_group, name, id, \
768
+ arg1_name, arg1_val) \
769
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT, \
770
+ category_group, name, id, \
771
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
772
+
773
+ #define TRACE_EVENT_NESTABLE_ASYNC_INSTANT2( \
774
+ category_group, name, id, arg1_name, arg1_val, arg2_name, arg2_val) \
775
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
776
+ TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT, category_group, name, id, \
777
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val)
778
+
779
+ #define TRACE_EVENT_COPY_NESTABLE_ASYNC_BEGIN_WITH_TTS2( \
780
+ category_group, name, id, arg1_name, arg1_val, arg2_name, arg2_val) \
781
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
782
+ TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, category_group, name, id, \
783
+ TRACE_EVENT_FLAG_ASYNC_TTS | TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, \
784
+ arg2_name, arg2_val)
785
+ #define TRACE_EVENT_COPY_NESTABLE_ASYNC_END_WITH_TTS2( \
786
+ category_group, name, id, arg1_name, arg1_val, arg2_name, arg2_val) \
787
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
788
+ TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, category_group, name, id, \
789
+ TRACE_EVENT_FLAG_ASYNC_TTS | TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, \
790
+ arg2_name, arg2_val)
791
+
792
+ // Similar to TRACE_EVENT_NESTABLE_ASYNC_{BEGIN,END}x but with a custom
793
+ // |timestamp| provided.
794
+ #define TRACE_EVENT_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0(category_group, name, \
795
+ id, timestamp) \
796
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
797
+ TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, category_group, name, id, \
798
+ TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE)
799
+ #define TRACE_EVENT_NESTABLE_ASYNC_END_WITH_TIMESTAMP0(category_group, name, \
800
+ id, timestamp) \
801
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
802
+ TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, category_group, name, id, \
803
+ TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE)
804
+ #define TRACE_EVENT_NESTABLE_ASYNC_END_WITH_TIMESTAMP1( \
805
+ category_group, name, id, timestamp, arg1_name, arg1_val) \
806
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
807
+ TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, category_group, name, id, \
808
+ TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE, \
809
+ arg1_name, arg1_val)
810
+ #define TRACE_EVENT_NESTABLE_ASYNC_INSTANT_WITH_TIMESTAMP0( \
811
+ category_group, name, id, timestamp) \
812
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
813
+ TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT, category_group, name, id, \
814
+ TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE)
815
+ #define TRACE_EVENT_COPY_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0( \
816
+ category_group, name, id, timestamp) \
817
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
818
+ TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, category_group, name, id, \
819
+ TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_COPY)
820
+ #define TRACE_EVENT_COPY_NESTABLE_ASYNC_END_WITH_TIMESTAMP0( \
821
+ category_group, name, id, timestamp) \
822
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
823
+ TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, category_group, name, id, \
824
+ TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_COPY)
825
+
826
+ // Records a single FLOW_BEGIN event called "name" immediately, with 0, 1 or 2
827
+ // associated arguments. If the category is not enabled, then this
828
+ // does nothing.
829
+ // - category and name strings must have application lifetime (statics or
830
+ // literals). They may not include " chars.
831
+ // - |id| is used to match the FLOW_BEGIN event with the FLOW_END event. FLOW
832
+ // events are considered to match if their category_group, name and id values
833
+ // all match. |id| must either be a pointer or an integer value up to 64 bits.
834
+ // If it's a pointer, the bits will be xored with a hash of the process ID so
835
+ // that the same pointer on two different processes will not collide.
836
+ // FLOW events are different from ASYNC events in how they are drawn by the
837
+ // tracing UI. A FLOW defines asynchronous data flow, such as posting a task
838
+ // (FLOW_BEGIN) and later executing that task (FLOW_END). Expect FLOWs to be
839
+ // drawn as lines or arrows from FLOW_BEGIN scopes to FLOW_END scopes. Similar
840
+ // to ASYNC, a FLOW can consist of multiple phases. The first phase is defined
841
+ // by the FLOW_BEGIN calls. Additional phases can be defined using the FLOW_STEP
842
+ // macros. When the operation completes, call FLOW_END. An async operation can
843
+ // span threads and processes, but all events in that operation must use the
844
+ // same |name| and |id|. Each event can have its own args.
845
+ #define TRACE_EVENT_FLOW_BEGIN0(category_group, name, id) \
846
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \
847
+ category_group, name, id, \
848
+ TRACE_EVENT_FLAG_NONE)
849
+ #define TRACE_EVENT_FLOW_BEGIN1(category_group, name, id, arg1_name, arg1_val) \
850
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \
851
+ category_group, name, id, \
852
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
853
+ #define TRACE_EVENT_FLOW_BEGIN2(category_group, name, id, arg1_name, arg1_val, \
854
+ arg2_name, arg2_val) \
855
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
856
+ TRACE_EVENT_PHASE_FLOW_BEGIN, category_group, name, id, \
857
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val)
858
+ #define TRACE_EVENT_COPY_FLOW_BEGIN0(category_group, name, id) \
859
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \
860
+ category_group, name, id, \
861
+ TRACE_EVENT_FLAG_COPY)
862
+ #define TRACE_EVENT_COPY_FLOW_BEGIN1(category_group, name, id, arg1_name, \
863
+ arg1_val) \
864
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \
865
+ category_group, name, id, \
866
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
867
+ #define TRACE_EVENT_COPY_FLOW_BEGIN2(category_group, name, id, arg1_name, \
868
+ arg1_val, arg2_name, arg2_val) \
869
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
870
+ TRACE_EVENT_PHASE_FLOW_BEGIN, category_group, name, id, \
871
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, arg2_name, arg2_val)
872
+
873
+ // Records a single FLOW_STEP event for |step| immediately. If the category
874
+ // is not enabled, then this does nothing. The |name| and |id| must match the
875
+ // FLOW_BEGIN event above. The |step| param identifies this step within the
876
+ // async event. This should be called at the beginning of the next phase of an
877
+ // asynchronous operation.
878
+ #define TRACE_EVENT_FLOW_STEP0(category_group, name, id, step) \
879
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_STEP, \
880
+ category_group, name, id, \
881
+ TRACE_EVENT_FLAG_NONE, "step", step)
882
+ #define TRACE_EVENT_FLOW_STEP1(category_group, name, id, step, arg1_name, \
883
+ arg1_val) \
884
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
885
+ TRACE_EVENT_PHASE_FLOW_STEP, category_group, name, id, \
886
+ TRACE_EVENT_FLAG_NONE, "step", step, arg1_name, arg1_val)
887
+ #define TRACE_EVENT_COPY_FLOW_STEP0(category_group, name, id, step) \
888
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_STEP, \
889
+ category_group, name, id, \
890
+ TRACE_EVENT_FLAG_COPY, "step", step)
891
+ #define TRACE_EVENT_COPY_FLOW_STEP1(category_group, name, id, step, arg1_name, \
892
+ arg1_val) \
893
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
894
+ TRACE_EVENT_PHASE_FLOW_STEP, category_group, name, id, \
895
+ TRACE_EVENT_FLAG_COPY, "step", step, arg1_name, arg1_val)
896
+
897
+ // Records a single FLOW_END event for "name" immediately. If the category
898
+ // is not enabled, then this does nothing.
899
+ #define TRACE_EVENT_FLOW_END0(category_group, name, id) \
900
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \
901
+ name, id, TRACE_EVENT_FLAG_NONE)
902
+ #define TRACE_EVENT_FLOW_END_BIND_TO_ENCLOSING0(category_group, name, id) \
903
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \
904
+ name, id, \
905
+ TRACE_EVENT_FLAG_BIND_TO_ENCLOSING)
906
+ #define TRACE_EVENT_FLOW_END1(category_group, name, id, arg1_name, arg1_val) \
907
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \
908
+ name, id, TRACE_EVENT_FLAG_NONE, arg1_name, \
909
+ arg1_val)
910
+ #define TRACE_EVENT_FLOW_END2(category_group, name, id, arg1_name, arg1_val, \
911
+ arg2_name, arg2_val) \
912
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \
913
+ name, id, TRACE_EVENT_FLAG_NONE, arg1_name, \
914
+ arg1_val, arg2_name, arg2_val)
915
+ #define TRACE_EVENT_COPY_FLOW_END0(category_group, name, id) \
916
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \
917
+ name, id, TRACE_EVENT_FLAG_COPY)
918
+ #define TRACE_EVENT_COPY_FLOW_END1(category_group, name, id, arg1_name, \
919
+ arg1_val) \
920
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \
921
+ name, id, TRACE_EVENT_FLAG_COPY, arg1_name, \
922
+ arg1_val)
923
+ #define TRACE_EVENT_COPY_FLOW_END2(category_group, name, id, arg1_name, \
924
+ arg1_val, arg2_name, arg2_val) \
925
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, category_group, \
926
+ name, id, TRACE_EVENT_FLAG_COPY, arg1_name, \
927
+ arg1_val, arg2_name, arg2_val)
928
+
929
+ // Special trace event macro to trace task execution with the location where it
930
+ // was posted from.
931
+ #define TRACE_TASK_EXECUTION(run_function, task) \
932
+ INTERNAL_TRACE_TASK_EXECUTION(run_function, task)
933
+
934
+ // TRACE_EVENT_METADATA* events are information related to other
935
+ // injected events, not events in their own right.
936
+ #define TRACE_EVENT_METADATA1(category_group, name, arg1_name, arg1_val) \
937
+ INTERNAL_TRACE_EVENT_METADATA_ADD(category_group, name, arg1_name, arg1_val)
938
+
939
+ // Records a clock sync event.
940
+ #define TRACE_EVENT_CLOCK_SYNC_RECEIVER(sync_id) \
941
+ INTERNAL_TRACE_EVENT_ADD( \
942
+ TRACE_EVENT_PHASE_CLOCK_SYNC, "__metadata", "clock_sync", \
943
+ TRACE_EVENT_FLAG_NONE, "sync_id", sync_id)
944
+ #define TRACE_EVENT_CLOCK_SYNC_ISSUER(sync_id, issue_ts, issue_end_ts) \
945
+ INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \
946
+ TRACE_EVENT_PHASE_CLOCK_SYNC, "__metadata", "clock_sync", \
947
+ issue_end_ts, TRACE_EVENT_FLAG_NONE, \
948
+ "sync_id", sync_id, "issue_ts", issue_ts)
949
+
950
+ // Macros to track the life time and value of arbitrary client objects.
951
+ // See also TraceTrackableObject.
952
+ #define TRACE_EVENT_OBJECT_CREATED_WITH_ID(category_group, name, id) \
953
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
954
+ TRACE_EVENT_PHASE_CREATE_OBJECT, category_group, name, id, \
955
+ TRACE_EVENT_FLAG_NONE)
956
+
957
+ #define TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(category_group, name, id, \
958
+ snapshot) \
959
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
960
+ TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, category_group, name, \
961
+ id, TRACE_EVENT_FLAG_NONE, "snapshot", snapshot)
962
+
963
+ #define TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID_AND_TIMESTAMP( \
964
+ category_group, name, id, timestamp, snapshot) \
965
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
966
+ TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, category_group, name, \
967
+ id, TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE, \
968
+ "snapshot", snapshot)
969
+
970
+ #define TRACE_EVENT_OBJECT_DELETED_WITH_ID(category_group, name, id) \
971
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
972
+ TRACE_EVENT_PHASE_DELETE_OBJECT, category_group, name, id, \
973
+ TRACE_EVENT_FLAG_NONE)
974
+
975
+ // Records entering and leaving trace event contexts. |category_group| and
976
+ // |name| specify the context category and type. |context| is a
977
+ // snapshotted context object id.
978
+ #define TRACE_EVENT_ENTER_CONTEXT(category_group, name, context) \
979
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
980
+ TRACE_EVENT_PHASE_ENTER_CONTEXT, category_group, name, context, \
981
+ TRACE_EVENT_FLAG_NONE)
982
+ #define TRACE_EVENT_LEAVE_CONTEXT(category_group, name, context) \
983
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
984
+ TRACE_EVENT_PHASE_LEAVE_CONTEXT, category_group, name, context, \
985
+ TRACE_EVENT_FLAG_NONE)
986
+ #define TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context) \
987
+ INTERNAL_TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context)
988
+
989
+ // Macro to specify that two trace IDs are identical. For example,
990
+ // TRACE_LINK_IDS(
991
+ // "category", "name",
992
+ // TRACE_ID_WITH_SCOPE("net::URLRequest", 0x1000),
993
+ // TRACE_ID_WITH_SCOPE("blink::ResourceFetcher::FetchRequest", 0x2000))
994
+ // tells the trace consumer that events with ID ("net::URLRequest", 0x1000) from
995
+ // the current process have the same ID as events with ID
996
+ // ("blink::ResourceFetcher::FetchRequest", 0x2000).
997
+ #define TRACE_LINK_IDS(category_group, name, id, linked_id) \
998
+ INTERNAL_TRACE_EVENT_ADD_LINK_IDS(category_group, name, id, linked_id);
999
+
1000
+ // Macro to efficiently determine if a given category group is enabled.
1001
+ #define TRACE_EVENT_CATEGORY_GROUP_ENABLED(category_group, ret) \
1002
+ do { \
1003
+ INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
1004
+ if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \
1005
+ *ret = true; \
1006
+ } else { \
1007
+ *ret = false; \
1008
+ } \
1009
+ } while (0)
1010
+
1011
+ // Macro to explicitly warm up a given category group. This could be useful in
1012
+ // cases where we want to initialize a category group before any trace events
1013
+ // for that category group is reported. For example, to have a category group
1014
+ // always show up in the "record categories" list for manually selecting
1015
+ // settings in about://tracing.
1016
+ #define TRACE_EVENT_WARMUP_CATEGORY(category_group) \
1017
+ INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group)
1018
+
1019
+ // Macro to efficiently determine, through polling, if a new trace has begun.
1020
+ #define TRACE_EVENT_IS_NEW_TRACE(ret) \
1021
+ do { \
1022
+ static int INTERNAL_TRACE_EVENT_UID(lastRecordingNumber) = 0; \
1023
+ int num_traces_recorded = TRACE_EVENT_API_GET_NUM_TRACES_RECORDED(); \
1024
+ if (num_traces_recorded != -1 && \
1025
+ num_traces_recorded != \
1026
+ INTERNAL_TRACE_EVENT_UID(lastRecordingNumber)) { \
1027
+ INTERNAL_TRACE_EVENT_UID(lastRecordingNumber) = num_traces_recorded; \
1028
+ *ret = true; \
1029
+ } else { \
1030
+ *ret = false; \
1031
+ } \
1032
+ } while (0)
1033
+
1034
+ // Notes regarding the following definitions:
1035
+ // New values can be added and propagated to third party libraries, but existing
1036
+ // definitions must never be changed, because third party libraries may use old
1037
+ // definitions.
1038
+
1039
+ // Phase indicates the nature of an event entry. E.g. part of a begin/end pair.
1040
+ #define TRACE_EVENT_PHASE_BEGIN ('B')
1041
+ #define TRACE_EVENT_PHASE_END ('E')
1042
+ #define TRACE_EVENT_PHASE_COMPLETE ('X')
1043
+ #define TRACE_EVENT_PHASE_INSTANT ('I')
1044
+ #define TRACE_EVENT_PHASE_ASYNC_BEGIN ('S')
1045
+ #define TRACE_EVENT_PHASE_ASYNC_STEP_INTO ('T')
1046
+ #define TRACE_EVENT_PHASE_ASYNC_STEP_PAST ('p')
1047
+ #define TRACE_EVENT_PHASE_ASYNC_END ('F')
1048
+ #define TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN ('b')
1049
+ #define TRACE_EVENT_PHASE_NESTABLE_ASYNC_END ('e')
1050
+ #define TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT ('n')
1051
+ #define TRACE_EVENT_PHASE_FLOW_BEGIN ('s')
1052
+ #define TRACE_EVENT_PHASE_FLOW_STEP ('t')
1053
+ #define TRACE_EVENT_PHASE_FLOW_END ('f')
1054
+ #define TRACE_EVENT_PHASE_METADATA ('M')
1055
+ #define TRACE_EVENT_PHASE_COUNTER ('C')
1056
+ #define TRACE_EVENT_PHASE_SAMPLE ('P')
1057
+ #define TRACE_EVENT_PHASE_CREATE_OBJECT ('N')
1058
+ #define TRACE_EVENT_PHASE_SNAPSHOT_OBJECT ('O')
1059
+ #define TRACE_EVENT_PHASE_DELETE_OBJECT ('D')
1060
+ #define TRACE_EVENT_PHASE_MEMORY_DUMP ('v')
1061
+ #define TRACE_EVENT_PHASE_MARK ('R')
1062
+ #define TRACE_EVENT_PHASE_CLOCK_SYNC ('c')
1063
+ #define TRACE_EVENT_PHASE_ENTER_CONTEXT ('(')
1064
+ #define TRACE_EVENT_PHASE_LEAVE_CONTEXT (')')
1065
+ #define TRACE_EVENT_PHASE_LINK_IDS ('=')
1066
+
1067
+ // Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT.
1068
+ #define TRACE_EVENT_FLAG_NONE (static_cast<unsigned int>(0))
1069
+ #define TRACE_EVENT_FLAG_COPY (static_cast<unsigned int>(1 << 0))
1070
+ #define TRACE_EVENT_FLAG_HAS_ID (static_cast<unsigned int>(1 << 1))
1071
+ // TODO(crbug.com/639003): Free this bit after ID mangling is deprecated.
1072
+ #define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned int>(1 << 2))
1073
+ #define TRACE_EVENT_FLAG_SCOPE_OFFSET (static_cast<unsigned int>(1 << 3))
1074
+ #define TRACE_EVENT_FLAG_SCOPE_EXTRA (static_cast<unsigned int>(1 << 4))
1075
+ #define TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP (static_cast<unsigned int>(1 << 5))
1076
+ #define TRACE_EVENT_FLAG_ASYNC_TTS (static_cast<unsigned int>(1 << 6))
1077
+ #define TRACE_EVENT_FLAG_BIND_TO_ENCLOSING (static_cast<unsigned int>(1 << 7))
1078
+ #define TRACE_EVENT_FLAG_FLOW_IN (static_cast<unsigned int>(1 << 8))
1079
+ #define TRACE_EVENT_FLAG_FLOW_OUT (static_cast<unsigned int>(1 << 9))
1080
+ #define TRACE_EVENT_FLAG_HAS_CONTEXT_ID (static_cast<unsigned int>(1 << 10))
1081
+ #define TRACE_EVENT_FLAG_HAS_PROCESS_ID (static_cast<unsigned int>(1 << 11))
1082
+ #define TRACE_EVENT_FLAG_HAS_LOCAL_ID (static_cast<unsigned int>(1 << 12))
1083
+ #define TRACE_EVENT_FLAG_HAS_GLOBAL_ID (static_cast<unsigned int>(1 << 13))
1084
+
1085
+ #define TRACE_EVENT_FLAG_SCOPE_MASK \
1086
+ (static_cast<unsigned int>(TRACE_EVENT_FLAG_SCOPE_OFFSET | \
1087
+ TRACE_EVENT_FLAG_SCOPE_EXTRA))
1088
+
1089
+ // Type values for identifying types in the TraceValue union.
1090
+ #define TRACE_VALUE_TYPE_BOOL (static_cast<unsigned char>(1))
1091
+ #define TRACE_VALUE_TYPE_UINT (static_cast<unsigned char>(2))
1092
+ #define TRACE_VALUE_TYPE_INT (static_cast<unsigned char>(3))
1093
+ #define TRACE_VALUE_TYPE_DOUBLE (static_cast<unsigned char>(4))
1094
+ #define TRACE_VALUE_TYPE_POINTER (static_cast<unsigned char>(5))
1095
+ #define TRACE_VALUE_TYPE_STRING (static_cast<unsigned char>(6))
1096
+ #define TRACE_VALUE_TYPE_COPY_STRING (static_cast<unsigned char>(7))
1097
+ #define TRACE_VALUE_TYPE_CONVERTABLE (static_cast<unsigned char>(8))
1098
+
1099
+ // Enum reflecting the scope of an INSTANT event. Must fit within
1100
+ // TRACE_EVENT_FLAG_SCOPE_MASK.
1101
+ #define TRACE_EVENT_SCOPE_GLOBAL (static_cast<unsigned char>(0 << 3))
1102
+ #define TRACE_EVENT_SCOPE_PROCESS (static_cast<unsigned char>(1 << 3))
1103
+ #define TRACE_EVENT_SCOPE_THREAD (static_cast<unsigned char>(2 << 3))
1104
+
1105
+ #define TRACE_EVENT_SCOPE_NAME_GLOBAL ('g')
1106
+ #define TRACE_EVENT_SCOPE_NAME_PROCESS ('p')
1107
+ #define TRACE_EVENT_SCOPE_NAME_THREAD ('t')
1108
+
1109
+ #endif // SRC_TRACE_EVENT_COMMON_H