1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
base / trace_event / builtin_categories.h [blame]
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_TRACE_EVENT_BUILTIN_CATEGORIES_H_
#define BASE_TRACE_EVENT_BUILTIN_CATEGORIES_H_
#include <cstddef>
#include <iterator>
#include "base/base_export.h"
#include "base/trace_event/common/trace_event_common.h"
#include "base/tracing_buildflags.h"
#include "build/build_config.h"
// List of builtin category names. If you want to use a new category name in
// your code and you get a static assert, this is the right place to register
// the name. If the name is going to be used only for testing, please add it to
// |kCategoriesForTesting| instead.
//
// Since spaces aren't allowed, use '_' to separate words in category names
// (e.g., "content_capture").
//
// Parameter |X| must be a *macro* that takes a single |name| string argument,
// denoting a category name.
#define INTERNAL_TRACE_LIST_BUILTIN_CATEGORIES(X) \
/* These entries must go first to be consistent with the \
* CategoryRegistry::kCategory* consts.*/ \
X("tracing_categories_exhausted._must_increase_kMaxCategories") \
X("tracing_already_shutdown") \
X("__metadata") \
/* The rest of the list is in alphabetical order */ \
X("accessibility") \
X("AccountFetcherService") \
X("android.adpf") \
X("android.ui.jank") \
X("android_webview") \
X("android_webview.timeline") \
/* Actions on Google Hardware, used in Google-internal code. */ \
X("aogh") \
X("audio") \
X("base") \
X("benchmark") \
X("blink") \
X("blink.animations") \
X("blink.bindings") \
X("blink.console") \
X("blink.net") \
X("blink.resource") \
X("blink.user_timing") \
X("blink.worker") \
X("blink_style") \
X("Blob") \
X("browser") \
X("browsing_data") \
X("CacheStorage") \
X("Calculators") \
X("CameraStream") \
X("cppgc") \
X("camera") \
X("cast_app") \
X("cast_perf_test") \
X("cast.mdns") \
X("cast.mdns.socket") \
X("cast.stream") \
X("cc") \
X("cc.debug") \
X("cdp.perf") \
X("chromeos") \
X("cma") \
X("compositor") \
/* Config categories do not emit trace events, but are used */ \
/* to configure enabling additional information at runtime, */ \
/* which then is emitted in other trace events. */ \
/* Controls details emitted by TaskAnnotator::EmitTaskTimingDetails */ \
X("config.scheduler.record_task_post_time") \
X("content") \
X("content_capture") \
X("interactions") \
X("delegated_ink_trails") \
X("device") \
X("devtools") \
X("devtools.contrast") \
X("devtools.timeline") \
X("disk_cache") \
X("download") \
X("download_service") \
X("drm") \
X("drmcursor") \
X("dwrite") \
X("evdev") \
X("event") \
X("exo") \
X("extensions") \
X("explore_sites") \
X("FileSystem") \
X("file_system_provider") \
X("fledge") \
X("fonts") \
X("GAMEPAD") \
X("gpu") \
X("gpu.angle") \
X("gpu.angle.texture_metrics") \
X("gpu.capture") \
X("graphics.pipeline") \
X("headless") \
/* Traces for //components/history. */ \
X("history") \
X("hwoverlays") \
X("identity") \
X("ime") \
X("IndexedDB") \
X("input") \
X("input.scrolling") \
X("io") \
X("ipc") \
X("Java") \
X("jni") \
X("jpeg") \
X("latency") \
X("latencyInfo") \
X("leveldb") \
X("loading") \
X("log") \
X("login") \
X("media") \
X("mediastream") \
X("media_router") \
X("memory") \
X("midi") \
X("mojom") \
X("mus") \
X("native") \
X("navigation") \
X("navigation.debug") \
X("net") \
X("network.scheduler") \
X("netlog") \
X("offline_pages") \
X("omnibox") \
X("oobe") \
X("openscreen") \
X("ozone") \
X("partition_alloc") \
X("passwords") \
X("p2p") \
X("page-serialization") \
X("paint_preview") \
X("pepper") \
X("PlatformMalloc") \
X("power") \
X("ppapi") \
X("ppapi_proxy") \
X("print") \
X("raf_investigation") \
X("rail") \
X("renderer") \
X("renderer_host") \
X("renderer.scheduler") \
X("resources") \
X("RLZ") \
X("ServiceWorker") \
X("SiteEngagement") \
X("safe_browsing") \
X("scheduler") \
X("scheduler.long_tasks") \
X("screenlock_monitor") \
X("segmentation_platform") \
X("sequence_manager") \
X("service_manager") \
X("sharing") \
X("shell") \
X("shutdown") \
X("skia") \
X("sql") \
X("stadia_media") \
X("stadia_rtc") \
X("startup") \
X("sync") \
X("system_apps") \
X("test_gpu") \
X("toplevel") \
X("toplevel.flow") \
X("ui") \
X("v8") \
X("v8.execute") \
X("v8.wasm") \
X("ValueStoreFrontend::Backend") \
X("views") \
X("views.frame") \
X("viz") \
X("vk") \
X("wakeup.flow") \
X("wayland") \
X("webaudio") \
X("webengine.fidl") \
X("weblayer") \
X("WebCore") \
X("webnn") \
X("webrtc") \
X("webrtc_stats") \
X("xr") \
X(TRACE_DISABLED_BY_DEFAULT("android_view_hierarchy")) \
X(TRACE_DISABLED_BY_DEFAULT("animation-worklet")) \
X(TRACE_DISABLED_BY_DEFAULT("audio")) \
X(TRACE_DISABLED_BY_DEFAULT("audio.latency")) \
X(TRACE_DISABLED_BY_DEFAULT("audio-worklet")) \
X(TRACE_DISABLED_BY_DEFAULT("base")) \
X(TRACE_DISABLED_BY_DEFAULT("blink.debug")) \
X(TRACE_DISABLED_BY_DEFAULT("blink.debug.display_lock")) \
X(TRACE_DISABLED_BY_DEFAULT("blink.debug.layout")) \
X(TRACE_DISABLED_BY_DEFAULT("blink.debug.layout.trees")) \
X(TRACE_DISABLED_BY_DEFAULT("blink.feature_usage")) \
X(TRACE_DISABLED_BY_DEFAULT("blink.image_decoding")) \
X(TRACE_DISABLED_BY_DEFAULT("blink.invalidation")) \
X(TRACE_DISABLED_BY_DEFAULT("identifiability")) \
X(TRACE_DISABLED_BY_DEFAULT("identifiability.high_entropy_api")) \
X(TRACE_DISABLED_BY_DEFAULT("cc")) \
X(TRACE_DISABLED_BY_DEFAULT("cc.debug")) \
X(TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf")) \
X(TRACE_DISABLED_BY_DEFAULT("cc.debug.display_items")) \
X(TRACE_DISABLED_BY_DEFAULT("cc.debug.lcd_text")) \
X(TRACE_DISABLED_BY_DEFAULT("cc.debug.picture")) \
X(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler")) \
X(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.frames")) \
X(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.now")) \
X(TRACE_DISABLED_BY_DEFAULT("content.verbose")) \
X(TRACE_DISABLED_BY_DEFAULT("cpu_profiler")) \
X(TRACE_DISABLED_BY_DEFAULT("cppgc")) \
X(TRACE_DISABLED_BY_DEFAULT("cpu_profiler.debug")) \
X(TRACE_DISABLED_BY_DEFAULT("crypto.dpapi")) \
X(TRACE_DISABLED_BY_DEFAULT("devtools.screenshot")) \
X(TRACE_DISABLED_BY_DEFAULT("devtools.timeline")) \
X(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.frame")) \
X(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.inputs")) \
X(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidationTracking")) \
X(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.layers")) \
X(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.picture")) \
X(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack")) \
X(TRACE_DISABLED_BY_DEFAULT("devtools.target-rundown")) \
X(TRACE_DISABLED_BY_DEFAULT("devtools.v8-source-rundown")) \
X(TRACE_DISABLED_BY_DEFAULT("devtools.v8-source-rundown-sources")) \
X(TRACE_DISABLED_BY_DEFAULT("file")) \
X(TRACE_DISABLED_BY_DEFAULT("fonts")) \
X(TRACE_DISABLED_BY_DEFAULT("gpu_cmd_queue")) \
X(TRACE_DISABLED_BY_DEFAULT("gpu.dawn")) \
X(TRACE_DISABLED_BY_DEFAULT("gpu.debug")) \
X(TRACE_DISABLED_BY_DEFAULT("gpu.decoder")) \
X(TRACE_DISABLED_BY_DEFAULT("gpu.device")) \
X(TRACE_DISABLED_BY_DEFAULT("gpu.graphite.dawn")) \
X(TRACE_DISABLED_BY_DEFAULT("gpu.service")) \
X(TRACE_DISABLED_BY_DEFAULT("gpu.vulkan.vma")) \
X(TRACE_DISABLED_BY_DEFAULT("histogram_samples")) \
X(TRACE_DISABLED_BY_DEFAULT("java-heap-profiler")) \
X(TRACE_DISABLED_BY_DEFAULT("layer-element")) \
X(TRACE_DISABLED_BY_DEFAULT("layout_shift.debug")) \
X(TRACE_DISABLED_BY_DEFAULT("lifecycles")) \
X(TRACE_DISABLED_BY_DEFAULT("loading")) \
X(TRACE_DISABLED_BY_DEFAULT("mediastream")) \
X(TRACE_DISABLED_BY_DEFAULT("memory-infra")) \
X(TRACE_DISABLED_BY_DEFAULT("memory-infra.v8.code_stats")) \
X(TRACE_DISABLED_BY_DEFAULT("mojom")) \
X(TRACE_DISABLED_BY_DEFAULT("navigation")) \
X(TRACE_DISABLED_BY_DEFAULT("net")) \
X(TRACE_DISABLED_BY_DEFAULT("network")) \
X(TRACE_DISABLED_BY_DEFAULT("paint-worklet")) \
X(TRACE_DISABLED_BY_DEFAULT("power")) \
X(TRACE_DISABLED_BY_DEFAULT("system_metrics")) \
X(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler")) \
X(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler.debug")) \
X(TRACE_DISABLED_BY_DEFAULT("sequence_manager")) \
X(TRACE_DISABLED_BY_DEFAULT("sequence_manager.debug")) \
X(TRACE_DISABLED_BY_DEFAULT("sequence_manager.verbose_snapshots")) \
X(TRACE_DISABLED_BY_DEFAULT("skia")) \
X(TRACE_DISABLED_BY_DEFAULT("skia.gpu")) \
X(TRACE_DISABLED_BY_DEFAULT("skia.gpu.cache")) \
X(TRACE_DISABLED_BY_DEFAULT("skia.shaders")) \
X(TRACE_DISABLED_BY_DEFAULT("skottie")) \
X(TRACE_DISABLED_BY_DEFAULT("SyncFileSystem")) \
X(TRACE_DISABLED_BY_DEFAULT("system_power")) \
X(TRACE_DISABLED_BY_DEFAULT("thread_pool_diagnostics")) \
X(TRACE_DISABLED_BY_DEFAULT("toplevel.ipc")) \
X(TRACE_DISABLED_BY_DEFAULT("user_action_samples")) \
X(TRACE_DISABLED_BY_DEFAULT("v8.compile")) \
X(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler")) \
X(TRACE_DISABLED_BY_DEFAULT("v8.gc")) \
X(TRACE_DISABLED_BY_DEFAULT("v8.gc_stats")) \
X(TRACE_DISABLED_BY_DEFAULT("v8.ic_stats")) \
X(TRACE_DISABLED_BY_DEFAULT("v8.inspector")) \
X(TRACE_DISABLED_BY_DEFAULT("v8.runtime")) \
X(TRACE_DISABLED_BY_DEFAULT("v8.runtime_stats")) \
X(TRACE_DISABLED_BY_DEFAULT("v8.runtime_stats_sampling")) \
X(TRACE_DISABLED_BY_DEFAULT("v8.stack_trace")) \
X(TRACE_DISABLED_BY_DEFAULT("v8.turbofan")) \
X(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed")) \
X(TRACE_DISABLED_BY_DEFAULT("v8.wasm.turbofan")) \
X(TRACE_DISABLED_BY_DEFAULT("video_and_image_capture")) \
X(TRACE_DISABLED_BY_DEFAULT("display.framedisplayed")) \
X(TRACE_DISABLED_BY_DEFAULT("viz.gpu_composite_time")) \
X(TRACE_DISABLED_BY_DEFAULT("viz.debug.overlay_planes")) \
X(TRACE_DISABLED_BY_DEFAULT("viz.hit_testing_flow")) \
X(TRACE_DISABLED_BY_DEFAULT("viz.overdraw")) \
X(TRACE_DISABLED_BY_DEFAULT("viz.quads")) \
X(TRACE_DISABLED_BY_DEFAULT("viz.surface_id_flow")) \
X(TRACE_DISABLED_BY_DEFAULT("viz.surface_lifetime")) \
X(TRACE_DISABLED_BY_DEFAULT("viz.triangles")) \
X(TRACE_DISABLED_BY_DEFAULT("viz.visual_debugger")) \
X(TRACE_DISABLED_BY_DEFAULT("webaudio.audionode")) \
X(TRACE_DISABLED_BY_DEFAULT("webgpu")) \
X(TRACE_DISABLED_BY_DEFAULT("webnn")) \
X(TRACE_DISABLED_BY_DEFAULT("webrtc")) \
X(TRACE_DISABLED_BY_DEFAULT("worker.scheduler")) \
X(TRACE_DISABLED_BY_DEFAULT("xr.debug"))
#define INTERNAL_TRACE_LIST_BUILTIN_CATEGORY_GROUPS(X) \
X("android_webview,toplevel") \
X("android_webview.timeline,android.ui.jank") \
X("base,toplevel") \
X("benchmark,drm") \
X("benchmark,latencyInfo,rail") \
X("benchmark,latencyInfo,rail,input.scrolling") \
X("benchmark,loading") \
X("benchmark,rail") \
X("benchmark,uma") \
X("benchmark,ui") \
X("benchmark,viz") \
X("benchmark,viz," TRACE_DISABLED_BY_DEFAULT("display.framedisplayed")) \
X("blink,benchmark") \
X("blink,benchmark,rail," TRACE_DISABLED_BY_DEFAULT("blink.debug.layout")) \
X("blink,blink.resource") \
X("blink,blink_style") \
X("blink,devtools.timeline") \
X("blink,latency") \
X("blink,loading") \
X("blink,rail") \
X("blink.animations,devtools.timeline,benchmark,rail") \
X("blink.user_timing,rail") \
X("browser,content,navigation") \
X("browser,navigation") \
X("browser,navigation,benchmark") \
X("browser,startup") \
X("category1,category2") \
X("cc,benchmark") \
X("cc,benchmark,input,input.scrolling") \
X("cc,benchmark,latency") \
X("cc,benchmark," TRACE_DISABLED_BY_DEFAULT("devtools.timeline.frame")) \
X("cc,input") \
X("cc,raf_investigation") \
X("cc," TRACE_DISABLED_BY_DEFAULT("devtools.timeline")) \
X("cc,benchmark," TRACE_DISABLED_BY_DEFAULT("devtools.timeline.frame")) \
X("content,navigation") \
X("devtools.timeline,rail") \
X("drm,hwoverlays") \
X("dwrite,fonts") \
X("fonts,ui") \
X("gpu,benchmark") \
X("gpu,benchmark,android_webview") \
X("gpu,benchmark,webview") \
X("gpu,login") \
X("gpu,startup") \
X("gpu,toplevel.flow") \
X("gpu.angle,startup") \
X("inc2,inc") \
X("inc,inc2") \
X("input,benchmark") \
X("input,benchmark,devtools.timeline") \
X("input,benchmark,devtools.timeline,latencyInfo") \
X("input,benchmark,latencyInfo") \
X("input,latency") \
X("input,rail") \
X("input,input.scrolling") \
X("input,views") \
X("interactions,input.scrolling") \
X("interactions,startup") \
X("ipc,security") \
X("ipc,toplevel") \
X("Java,devtools," TRACE_DISABLED_BY_DEFAULT("devtools.timeline")) \
X("loading,interactions") \
X("loading,rail") \
X("loading,rail,devtools.timeline") \
X("login,screenlock_monitor") \
X("media,gpu") \
X("media,rail") \
X("navigation,benchmark,rail") \
X("navigation,rail") \
X("renderer,benchmark,rail") \
X("renderer,benchmark,rail,input.scrolling") \
X("renderer,webkit") \
X("renderer_host,navigation") \
X("renderer_host," TRACE_DISABLED_BY_DEFAULT("viz.surface_id_flow")) \
X("scheduler,devtools.timeline,loading") \
X("shutdown,viz") \
X("startup,benchmark,rail") \
X("startup,rail") \
X("toplevel,graphics.pipeline") \
X("toplevel,Java") \
X("toplevel,latency") \
X("toplevel,viz") \
X("ui,input") \
X("ui,latency") \
X("ui,toplevel") \
X("v8," TRACE_DISABLED_BY_DEFAULT("v8.compile")) \
X("v8,devtools.timeline") \
X("v8,devtools.timeline," TRACE_DISABLED_BY_DEFAULT("v8.compile")) \
X("viz,android.adpf") \
X("viz,benchmark") \
X("viz,benchmark,graphics.pipeline") \
X("viz,benchmark,input.scrolling") \
X("viz,input.scrolling") \
X("wakeup.flow,toplevel.flow") \
X("WebCore,benchmark,rail") \
X(TRACE_DISABLED_BY_DEFAULT("cc.debug") "," TRACE_DISABLED_BY_DEFAULT( \
"viz.quads") "," TRACE_DISABLED_BY_DEFAULT("devtools.timeline.layers")) \
X(TRACE_DISABLED_BY_DEFAULT("cc.debug.display_items") "," \
TRACE_DISABLED_BY_DEFAULT("cc.debug.picture") "," \
TRACE_DISABLED_BY_DEFAULT("devtools.timeline.picture")) \
X(TRACE_DISABLED_BY_DEFAULT("v8.inspector") "," TRACE_DISABLED_BY_DEFAULT( \
"v8.stack_trace"))
#define INTERNAL_TRACE_INIT_CATEGORY_NAME(name) name,
#define INTERNAL_TRACE_INIT_CATEGORY(name) {0, 0, name},
PERFETTO_DEFINE_TEST_CATEGORY_PREFIXES("cat",
"foo",
"test",
"kTest",
"noise",
"Testing",
"NotTesting",
TRACE_DISABLED_BY_DEFAULT("test"),
TRACE_DISABLED_BY_DEFAULT("Testing"),
TRACE_DISABLED_BY_DEFAULT("NotTesting"));
#define INTERNAL_CATEGORY(X) perfetto::Category(X),
#define INTERNAL_CATEGORY_GROUP(X) perfetto::Category::Group(X),
// Define a Perfetto TrackEvent data source using the list of categories defined
// above. See https://perfetto.dev/docs/instrumentation/track-events.
PERFETTO_DEFINE_CATEGORIES_IN_NAMESPACE_WITH_ATTRS(
base,
BASE_EXPORT,
INTERNAL_TRACE_LIST_BUILTIN_CATEGORIES(INTERNAL_CATEGORY)
INTERNAL_TRACE_LIST_BUILTIN_CATEGORY_GROUPS(INTERNAL_CATEGORY_GROUP));
PERFETTO_USE_CATEGORIES_FROM_NAMESPACE(base);
#undef INTERNAL_CATEGORY
#undef INTERNAL_CATEGORY_GROUP
namespace base {
namespace trace_event {
// Constexpr version of string comparison operator. |a| and |b| must be valid
// C-style strings known at compile-time.
constexpr bool StrEqConstexpr(const char* a, const char* b) {
for (; *a != '\0' && *b != '\0'; ++a, ++b) {
if (*a != *b)
return false;
}
return *a == *b;
}
// Tests for |StrEqConstexpr()|.
static_assert(StrEqConstexpr("foo", "foo"), "strings should be equal");
static_assert(!StrEqConstexpr("foo", "Foo"), "strings should not be equal");
static_assert(!StrEqConstexpr("foo", "foo1"), "strings should not be equal");
static_assert(!StrEqConstexpr("foo2", "foo"), "strings should not be equal");
static_assert(StrEqConstexpr("", ""), "strings should be equal");
static_assert(!StrEqConstexpr("foo", ""), "strings should not be equal");
static_assert(!StrEqConstexpr("", "foo"), "strings should not be equal");
static_assert(!StrEqConstexpr("ab", "abc"), "strings should not be equal");
static_assert(!StrEqConstexpr("abc", "ab"), "strings should not be equal");
} // namespace trace_event
} // namespace base
#endif // BASE_TRACE_EVENT_BUILTIN_CATEGORIES_H_