-
Notifications
You must be signed in to change notification settings - Fork 0
/
perfetto_trace.proto
12257 lines (10804 loc) · 419 KB
/
perfetto_trace.proto
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
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// AUTOGENERATED - DO NOT EDIT
// ---------------------------
// This file has been generated by
// AOSP://external/perfetto/tools/gen_merged_protos
// merging the perfetto config protos.
// This fused proto is intended to be copied in:
// - Android tree, for statsd.
// - Google internal repos.
syntax = "proto2";
package perfetto.protos;
option go_package = "github.com/google/perfetto/perfetto_proto";
// Begin of protos/perfetto/common/ftrace_descriptor.proto
message FtraceDescriptor {
message AtraceCategory {
optional string name = 1;
optional string description = 2;
}
// Report the available atrace categories.
//
// Used by Traceur via `perfetto --query`.
repeated AtraceCategory atrace_categories = 1;
}
// End of protos/perfetto/common/ftrace_descriptor.proto
// Begin of protos/perfetto/common/gpu_counter_descriptor.proto
// Description of GPU counters.
// This message is sent by a GPU counter producer to specify the counters
// available in the hardware.
message GpuCounterDescriptor {
// Logical groups for a counter. This is used in the UI to present the
// related counters together.
enum GpuCounterGroup {
UNCLASSIFIED = 0;
SYSTEM = 1;
VERTICES = 2;
FRAGMENTS = 3;
PRIMITIVES = 4;
// Includes counters relating to caching and bandwidth.
MEMORY = 5;
COMPUTE = 6;
}
message GpuCounterSpec {
optional uint32 counter_id = 1;
optional string name = 2;
optional string description = 3;
// MeasureUnit unit (deprecated)
reserved 4;
oneof peak_value {
int64 int_peak_value = 5;
double double_peak_value = 6;
}
repeated MeasureUnit numerator_units = 7;
repeated MeasureUnit denominator_units = 8;
optional bool select_by_default = 9;
repeated GpuCounterGroup groups = 10;
}
repeated GpuCounterSpec specs = 1;
// Allow producer to group counters into block to represent counter islands.
// A capacity may be specified to indicate the number of counters that can be
// enable simultaneously in that block.
message GpuCounterBlock {
// required. Unique ID for the counter group.
optional uint32 block_id = 1;
// optional. Number of counters supported by the block. No limit if unset.
optional uint32 block_capacity = 2;
// optional. Name of block.
optional string name = 3;
// optional. Description for the block.
optional string description = 4;
// list of counters that are part of the block.
repeated uint32 counter_ids = 5;
}
repeated GpuCounterBlock blocks = 2;
// optional. Minimum sampling period supported by the producer in
// nanoseconds.
optional uint64 min_sampling_period_ns = 3;
// optional. Maximum sampling period supported by the producer in
// nanoseconds.
optional uint64 max_sampling_period_ns = 4;
// optional. The producer supports counter sampling by instrumenting the
// command buffer.
optional bool supports_instrumented_sampling = 5;
// next id: 41
enum MeasureUnit {
NONE = 0;
BIT = 1;
KILOBIT = 2;
MEGABIT = 3;
GIGABIT = 4;
TERABIT = 5;
PETABIT = 6;
BYTE = 7;
KILOBYTE = 8;
MEGABYTE = 9;
GIGABYTE = 10;
TERABYTE = 11;
PETABYTE = 12;
HERTZ = 13;
KILOHERTZ = 14;
MEGAHERTZ = 15;
GIGAHERTZ = 16;
TERAHERTZ = 17;
PETAHERTZ = 18;
NANOSECOND = 19;
MICROSECOND = 20;
MILLISECOND = 21;
SECOND = 22;
MINUTE = 23;
HOUR = 24;
VERTEX = 25;
PIXEL = 26;
TRIANGLE = 27;
PRIMITIVE = 38;
FRAGMENT = 39;
MILLIWATT = 28;
WATT = 29;
KILOWATT = 30;
JOULE = 31;
VOLT = 32;
AMPERE = 33;
CELSIUS = 34;
FAHRENHEIT = 35;
KELVIN = 36;
// Values should be out of 100.
PERCENT = 37;
INSTRUCTION = 40;
}
}
// End of protos/perfetto/common/gpu_counter_descriptor.proto
// Begin of protos/perfetto/common/track_event_descriptor.proto
message TrackEventCategory {
optional string name = 1;
optional string description = 2;
repeated string tags = 3;
}
message TrackEventDescriptor {
repeated TrackEventCategory available_categories = 1;
}
// End of protos/perfetto/common/track_event_descriptor.proto
// Begin of protos/perfetto/common/data_source_descriptor.proto
// This message is sent from Producer(s) to the tracing Service when registering
// to advertise their capabilities. It describes the structure of tracing
// protos that will be produced by the data source and the supported filters.
message DataSourceDescriptor {
// e.g., "linux.ftrace", "chromium.tracing"
optional string name = 1;
// When non-zero, this is a unique ID within the scope of the Producer for
// this data source (it is NOT globally unique). This is useful to
// differentiate between data sources with matching names when calling
// UpdateDataSource(). This field has been introduced in November 2021
// (v22, Android T) and is not supported on older versions.
optional uint64 id = 7;
// When true the data source is expected to ack the stop request through the
// NotifyDataSourceStopped() IPC. This field has been introduced after
// Android P in Jul 2018 and is not supported on older versions.
optional bool will_notify_on_stop = 2;
// When true the data source is expected to ack the start request through the
// NotifyDataSourceStarted() IPC. This field has been introduced after
// Android P in March 2019 and is not supported on older versions.
optional bool will_notify_on_start = 3;
// If true, opt into receiving the ClearIncrementalState() IPC. This should be
// set if the data source writes packets that refer to previous trace
// contents, and knows how to stop referring to the already-emitted data.
optional bool handles_incremental_state_clear = 4;
// Optional specification about available GPU counters.
optional GpuCounterDescriptor gpu_counter_descriptor = 5 [lazy = true];
optional TrackEventDescriptor track_event_descriptor = 6 [lazy = true];
optional FtraceDescriptor ftrace_descriptor = 8 [lazy = true];
}
// End of protos/perfetto/common/data_source_descriptor.proto
// Begin of protos/perfetto/common/tracing_service_state.proto
// Reports the state of the tracing service. Used to gather details about the
// data sources connected.
// See ConsumerPort::QueryServiceState().
message TracingServiceState {
// Describes a producer process.
message Producer {
// Unique ID of the producer (monotonic counter).
optional int32 id = 1;
// Typically matches the process name.
optional string name = 2;
// Unix pid of the remote process. Supported only on Linux-based systems.
// Introduced in v24 / Android T.
optional int32 pid = 5;
// Unix uid of the remote process.
optional int32 uid = 3;
// The version of the client library used by the producer.
// This is a human readable string with and its format varies depending on
// the build system and the repo (standalone vs AOSP).
// This is intended for human debugging only.
optional string sdk_version = 4;
}
// Describes a data source registered by a producer. Data sources are listed
// regardless of the fact that they are being used or not.
message DataSource {
// Descriptor passed by the data source when calling RegisterDataSource().
optional DataSourceDescriptor ds_descriptor = 1;
// ID of the producer, as per Producer.id.
optional int32 producer_id = 2;
}
message TracingSession {
// The TracingSessionID.
optional uint64 id = 1;
// The Unix uid of the consumer that started the session.
// This is meaningful only if the caller is root. In all other cases only
// tracing sessions that match the caller UID will be displayed.
optional int32 consumer_uid = 2;
// Internal state of the tracing session.
// These strings are FYI only and subjected to change.
optional string state = 3;
// The unique_session_name as set in the trace config (might be empty).
optional string unique_session_name = 4;
// The number and size of each buffer.
repeated uint32 buffer_size_kb = 5;
// Duration, as specified in the TraceConfig.duration_ms.
optional uint32 duration_ms = 6;
// Number of data sources involved in the session.
optional uint32 num_data_sources = 7;
// Time when the session was started, in the CLOCK_REALTIME domain.
// Available only on Linux-based systems.
optional int64 start_realtime_ns = 8;
}
// Lists all the producers connected.
repeated Producer producers = 1;
// Lists the data sources available.
repeated DataSource data_sources = 2;
// Lists the tracing sessions active AND owned by a consumer that has the same
// UID of the caller (or all of them if the caller is root).
// Introduced in v24 / Android T.
repeated TracingSession tracing_sessions = 6;
// This is always set to true from v24 and beyond. This flag is only used to
// tell the difference between: (1) talking to a recent service which happens
// to have no tracing session active; (2) talking to an older version of the
// service which will never report any tracing session.
optional bool supports_tracing_sessions = 7;
// Total number of tracing sessions.
optional int32 num_sessions = 3;
// Number of tracing sessions in the started state. Always <= num_sessions.
optional int32 num_sessions_started = 4;
// The version of traced (the same returned by `traced --version`).
// This is a human readable string with and its format varies depending on
// the build system and the repo (standalone vs AOSP).
// This is intended for human debugging only.
optional string tracing_service_version = 5;
}
// End of protos/perfetto/common/tracing_service_state.proto
// Begin of protos/perfetto/common/builtin_clock.proto
enum BuiltinClock {
BUILTIN_CLOCK_UNKNOWN = 0;
BUILTIN_CLOCK_REALTIME = 1;
BUILTIN_CLOCK_REALTIME_COARSE = 2;
BUILTIN_CLOCK_MONOTONIC = 3;
BUILTIN_CLOCK_MONOTONIC_COARSE = 4;
BUILTIN_CLOCK_MONOTONIC_RAW = 5;
BUILTIN_CLOCK_BOOTTIME = 6;
BUILTIN_CLOCK_MAX_ID = 63;
reserved 7, 8;
// An internal CL (ag/16521245) has taken this for BUILTIN_CLOCK_TSC.
// That might get upstreamed later on. Avoid diverging on this ID in future.
reserved 9;
}
// End of protos/perfetto/common/builtin_clock.proto
// Begin of protos/perfetto/config/android/android_game_intervention_list_config.proto
// Data source that lists game modes and game interventions of games
// on an Android device.
message AndroidGameInterventionListConfig {
// If not empty, emit info about only the following list of package names
// (exact match, no regex). Otherwise, emit info about all packages.
repeated string package_name_filter = 1;
}
// End of protos/perfetto/config/android/android_game_intervention_list_config.proto
// Begin of protos/perfetto/common/android_log_constants.proto
// Values from NDK's android/log.h.
enum AndroidLogId {
// MAIN.
LID_DEFAULT = 0;
LID_RADIO = 1;
LID_EVENTS = 2;
LID_SYSTEM = 3;
LID_CRASH = 4;
LID_STATS = 5;
LID_SECURITY = 6;
LID_KERNEL = 7;
}
enum AndroidLogPriority {
PRIO_UNSPECIFIED = 0;
// _DEFAULT, but should never be seen in logs.
PRIO_UNUSED = 1;
PRIO_VERBOSE = 2;
PRIO_DEBUG = 3;
PRIO_INFO = 4;
PRIO_WARN = 5;
PRIO_ERROR = 6;
PRIO_FATAL = 7;
}
// End of protos/perfetto/common/android_log_constants.proto
// Begin of protos/perfetto/config/android/android_log_config.proto
message AndroidLogConfig {
repeated AndroidLogId log_ids = 1;
// Was |poll_ms|, deprecated.
reserved 2;
// If set ignores all log messages whose prio is < the given value.
optional AndroidLogPriority min_prio = 3;
// If non-empty ignores all log messages whose tag doesn't match one of the
// specified values.
repeated string filter_tags = 4;
}
// End of protos/perfetto/config/android/android_log_config.proto
// Begin of protos/perfetto/config/android/android_polled_state_config.proto
// Data source that polls for display state. This should only be used for
// backward-compatibility; AndroidSystemPropertyConfig should be preferred.
message AndroidPolledStateConfig {
// Frequency of polling. If absent the state will be recorded once, at the
// start of the trace.
// This is required to be > 100ms to avoid excessive CPU usage.
optional uint32 poll_ms = 1;
}
// End of protos/perfetto/config/android/android_polled_state_config.proto
// Begin of protos/perfetto/config/android/android_system_property_config.proto
// Data source that polls for system properties.
message AndroidSystemPropertyConfig {
// Frequency of polling. If absent the state will be recorded once, at the
// start of the trace.
// This is required to be > 100ms to avoid excessive CPU usage.
optional uint32 poll_ms = 1;
// Properties to poll. All property names must start with "debug.tracing.".
repeated string property_name = 2;
}
// End of protos/perfetto/config/android/android_system_property_config.proto
// Begin of protos/perfetto/config/android/network_trace_config.proto
// Network tracing data source that records details on all packets sent or
// received by the network.
message NetworkPacketTraceConfig {
// Polling frequency in milliseconds. Network tracing writes to a fixed size
// ring buffer. The polling interval should be such that the ring buffer is
// unlikely to fill in that interval (or that filling is an acceptable risk).
// The minimum polling rate is 100ms (values below this are ignored).
// Introduced in Android 14 (U).
optional uint32 poll_ms = 1;
// The aggregation_threshold is the number of packets at which an event will
// switch from per-packet details to aggregate details. For example, a value
// of 50 means that if a particular event (grouped by the unique combinations
// of metadata fields: {interface, direction, uid, etc}) has fewer than 50
// packets, the exact timestamp and length are recorded for each packet. If
// there were 50 or more packets in an event, it would only record the total
// duration, packets, and length. A value of zero or unspecified will always
/// record per-packet details. A value of 1 always records aggregate details.
optional uint32 aggregation_threshold = 2;
// Specifies the maximum number of packet contexts to intern at a time. This
// prevents the interning table from growing too large and controls whether
// interning is enabled or disabled (a value of zero disables interning and
// is the default). When a data sources interning table reaches this amount,
// packet contexts will be inlined into NetworkPacketEvents.
optional uint32 intern_limit = 3;
// The following fields specify whether certain fields should be dropped from
// the output. Dropping fields improves normalization results, reduces the
// size of the interning table, and slightly reduces event size.
optional bool drop_local_port = 4;
optional bool drop_remote_port = 5;
optional bool drop_tcp_flags = 6;
}
// End of protos/perfetto/config/android/network_trace_config.proto
// Begin of protos/perfetto/config/android/packages_list_config.proto
// Data source that lists details (such as version code) about packages on an
// Android device.
message PackagesListConfig {
// If not empty, emit info about only the following list of package names
// (exact match, no regex). Otherwise, emit info about all packages.
repeated string package_name_filter = 1;
}
// End of protos/perfetto/config/android/packages_list_config.proto
// Begin of protos/perfetto/config/chrome/chrome_config.proto
message ChromeConfig {
optional string trace_config = 1;
// When enabled, the data source should only fill in fields in the output that
// are not potentially privacy sensitive.
optional bool privacy_filtering_enabled = 2;
// Instead of emitting binary protobuf, convert the trace data to the legacy
// JSON format. Note that the trace data will still be returned as a series of
// TracePackets, but the embedded data will be JSON instead of serialized
// protobuf.
optional bool convert_to_legacy_json = 3;
// Priority of the tracing session client. A higher priority session may
// preempt a lower priority one in configurations where concurrent sessions
// aren't supported.
enum ClientPriority {
UNKNOWN = 0;
BACKGROUND = 1;
USER_INITIATED = 2;
}
optional ClientPriority client_priority = 4;
// Applicable only when using legacy JSON format.
// If |json_agent_label_filter| is not empty, only data pertaining to
// the specified tracing agent label (e.g. "traceEvents") will be returned.
optional string json_agent_label_filter = 5;
}
// End of protos/perfetto/config/chrome/chrome_config.proto
// Begin of protos/perfetto/config/ftrace/ftrace_config.proto
// Next id: 26.
message FtraceConfig {
repeated string ftrace_events = 1;
repeated string atrace_categories = 2;
repeated string atrace_apps = 3;
// *Per-CPU* buffer size.
optional uint32 buffer_size_kb = 10;
optional uint32 drain_period_ms = 11;
// Configuration for compact encoding of scheduler events. When enabled (and
// recording the relevant ftrace events), specific high-volume events are
// encoded in a denser format than normal.
message CompactSchedConfig {
// If true, and sched_switch or sched_waking ftrace events are enabled,
// record those events in the compact format.
optional bool enabled = 1;
}
optional CompactSchedConfig compact_sched = 12;
// Optional filter for "ftrace/print" events.
//
// The filter consists of multiple rules. As soon as a rule matches (the rules
// are processed in order), its `allow` field will be used as the outcome: if
// `allow` is true, the event will be included in the trace, otherwise it will
// be discarded. If an event does not match any rule, it will be allowed by
// default (a rule with an empty prefix and allow=false, disallows everything
// by default).
message PrintFilter {
message Rule {
// Matches an atrace message of the form:
// <type>|pid|<prefix>...
message AtraceMessage {
optional string type = 1;
optional string prefix = 2;
}
oneof match {
// This rule matches if `prefix` matches exactly with the beginning of
// the "ftrace/print" "buf" field.
string prefix = 1;
// This rule matches if the "buf" field contains an atrace-style print
// message as specified in `atrace_msg`.
AtraceMessage atrace_msg = 3;
}
optional bool allow = 2;
}
repeated Rule rules = 1;
}
optional PrintFilter print_filter = 22;
// Enables symbol name resolution against /proc/kallsyms.
// It requires that either traced_probes is running as root or that
// kptr_restrict has been manually lowered.
// It does not disclose KASLR, symbol addresses are mangled.
optional bool symbolize_ksyms = 13;
// When symbolize_ksyms=true, tetermines whether the traced_probes daemon
// should keep the symbol map in memory (and reuse it for future tracing
// sessions) or clear it (saving memory) and re-create it on each tracing
// session (wasting cpu and wall time).
// The tradeoff is roughly:
// KSYMS_RETAIN: pay a fixed ~1.2 MB cost after the first trace.
// KSYMS_CLEANUP_ON_STOP: pay a ~300-500ms cost when starting each trace.
// Default behavior: KSYMS_CLEANUP_ON_STOP.
enum KsymsMemPolicy {
KSYMS_UNSPECIFIED = 0;
KSYMS_CLEANUP_ON_STOP = 1;
KSYMS_RETAIN = 2;
}
optional KsymsMemPolicy ksyms_mem_policy = 17;
// By default the kernel symbolizer is lazily initialized on a deferred task
// to reduce ftrace's time-to-start-recording. Unfortunately that makes
// ksyms integration tests hard. This flag forces the kernel symbolizer to be
// initialized synchronously on the data source start and hence avoiding
// timing races in tests.
// DEPRECATED in v28 / Android U. This is now the default behavior, setting it
// to true is a no-op.
optional bool initialize_ksyms_synchronously_for_testing = 14
[deprecated = true];
// When this boolean is true AND the ftrace_events contains "kmem/rss_stat",
// this option causes traced_probes to enable the "kmem/rss_stat_throttled"
// event instead if present, and fall back to "kmem/rss_stat" if not present.
// The historical context for this is the following:
// - Up to Android S (12), the rss_stat was internally throttled in its
// kernel implementation.
// - A change introduced in the kernels after S has introduced a new
// "rss_stat_throttled" making the original "rss_stat" event unthrottled
// (hence very spammy).
// - Not all Android T/13 devices will receive a new kernel though, hence we
// need to deal with both cases.
// For more context: go/rss-stat-throttled.
optional bool throttle_rss_stat = 15;
// If true, avoid enabling events that aren't statically known by
// traced_probes. Otherwise, the default is to emit such events as
// GenericFtraceEvent protos.
// Prefer to keep this flag at its default. This was added for Android
// tracing, where atrace categories and/or atrace HAL requested events can
// expand to events that aren't of interest to the tracing user.
// Introduced in: Android T.
optional bool disable_generic_events = 16;
// The list of syscalls that should be recorded by sys_{enter,exit} ftrace
// events. When empty, all syscalls are recorded. If neither sys_{enter,exit}
// are enabled, this setting has no effect. Example: ["sys_read", "sys_open"].
// Introduced in: Android U.
repeated string syscall_events = 18;
// If true, enable the "function_graph" kernel tracer that emits events
// whenever a kernel function is entered and exited
// (funcgraph_entry/funcgraph_exit).
// Notes on use:
// * Requires |symbolize_ksyms| for function name resolution.
// * Use |function_filters| or |function_graph_roots| to constrain the traced
// set of functions, otherwise the event bandwidth will be too high for
// practical use.
// * The data source might be rejected if there is already a concurrent
// ftrace data source that does not use function graph itself, as we do not
// support switching kernel tracers mid-trace.
// * Requires a kernel compiled with CONFIG_FUNCTION_GRAPH_TRACER. This is
// enabled if "cat /sys/kernel/tracing/available_tracers" includes
// "function_graph".
// Android:
// * Available only on debuggable builds.
// * Introduced in: Android U.
optional bool enable_function_graph = 19;
// Constrains the set of functions traced when |enable_function_graph| is
// true. Supports globs, e.g. "sched*". You can specify multiple filters,
// in which case all matching functions will be traced. See kernel
// documentation on ftrace "set_ftrace_filter" file for more details.
// Android:
// * Available only on debuggable builds.
// * Introduced in: Android U.
repeated string function_filters = 20;
// If |enable_function_graph| is true, trace this set of functions *and* all
// of its callees. Supports globs. Can be set together with
// |function_filters|, in which case only callees matching the filter will be
// traced. If setting both, you most likely want all roots to also be
// included in |function_filters|.
// Android:
// * Available only on debuggable builds.
// * Introduced in: Android U.
repeated string function_graph_roots = 21;
// If true, does not clear ftrace buffers before the start of the program.
// This makes sense only if this is the first ftrace data source instance
// created after the daemon has been started. Can be useful for gathering boot
// traces, if ftrace has been separately configured (e.g. via kernel
// commandline).
optional bool preserve_ftrace_buffer = 23;
// If true, overrides the default timestamp clock and uses a raw hardware
// based monotonic clock for getting timestamps.
// * Introduced in: Android U.
optional bool use_monotonic_raw_clock = 24;
// Caution: under development as of 2023/03/01.
// If |instance_name| is not empty, then attempt to use that tracefs instance
// for event recording. Normally, this means
// `/sys/kernel/tracing/instances/$instance_name`.
//
// The name "hyp" is reserved.
//
// The instance must already exist, the tracing daemon *will not* create it
// for you as it typically doesn't have such permissions.
// Only a subset of features is guaranteed to work with non-default instances,
// at the time of writing:
// * ftrace_events
// * buffer_size_kb
// TODO(b/249050813): reword comment once instance support is stable.
optional string instance_name = 25;
}
// End of protos/perfetto/config/ftrace/ftrace_config.proto
// Begin of protos/perfetto/config/gpu/gpu_counter_config.proto
message GpuCounterConfig {
// Desired sampling interval for counters.
optional uint64 counter_period_ns = 1;
// List of counters to be sampled. Counter IDs correspond to the ones
// described in GpuCounterSpec in the data source descriptor.
repeated uint32 counter_ids = 2;
// Sample counters by instrumenting command buffers.
optional bool instrumented_sampling = 3;
// Fix gpu clock rate during trace session.
optional bool fix_gpu_clock = 4;
}
// End of protos/perfetto/config/gpu/gpu_counter_config.proto
// Begin of protos/perfetto/config/gpu/vulkan_memory_config.proto
message VulkanMemoryConfig {
// Tracking driver memory usage events
optional bool track_driver_memory_usage = 1;
// Tracking device memory usage events
optional bool track_device_memory_usage = 2;
}
// End of protos/perfetto/config/gpu/vulkan_memory_config.proto
// Begin of protos/perfetto/config/inode_file/inode_file_config.proto
message InodeFileConfig {
message MountPointMappingEntry {
optional string mountpoint = 1;
repeated string scan_roots = 2;
}
// How long to pause between batches.
optional uint32 scan_interval_ms = 1;
// How long to wait before the first scan in order to accumulate inodes.
optional uint32 scan_delay_ms = 2;
// How many inodes to scan in one batch.
optional uint32 scan_batch_size = 3;
// Do not scan for inodes not found in the static map.
optional bool do_not_scan = 4;
// If non-empty, only scan inodes corresponding to block devices named in
// this list.
repeated string scan_mount_points = 5;
// When encountering an inode belonging to a block device corresponding
// to one of the mount points in this map, scan its scan_roots instead.
repeated MountPointMappingEntry mount_point_mapping = 6;
}
// End of protos/perfetto/config/inode_file/inode_file_config.proto
// Begin of protos/perfetto/config/interceptors/console_config.proto
message ConsoleConfig {
enum Output {
OUTPUT_UNSPECIFIED = 0;
OUTPUT_STDOUT = 1;
OUTPUT_STDERR = 2;
}
optional Output output = 1;
optional bool enable_colors = 2;
}
// End of protos/perfetto/config/interceptors/console_config.proto
// Begin of protos/perfetto/config/interceptor_config.proto
// Configuration for trace packet interception. Used for diverting trace data to
// non-Perfetto sources (e.g., logging to the console, ETW) when using the
// Perfetto SDK.
message InterceptorConfig {
// Matches the name given to RegisterInterceptor().
optional string name = 1;
optional ConsoleConfig console_config = 100 [lazy = true];
}
// End of protos/perfetto/config/interceptor_config.proto
// Begin of protos/perfetto/config/power/android_power_config.proto
message AndroidPowerConfig {
enum BatteryCounters {
BATTERY_COUNTER_UNSPECIFIED = 0;
// Coulomb counter.
BATTERY_COUNTER_CHARGE = 1;
// Charge (%).
BATTERY_COUNTER_CAPACITY_PERCENT = 2;
// Instantaneous current.
BATTERY_COUNTER_CURRENT = 3;
// Avg current.
BATTERY_COUNTER_CURRENT_AVG = 4;
}
optional uint32 battery_poll_ms = 1;
repeated BatteryCounters battery_counters = 2;
// Where available enables per-power-rail measurements.
optional bool collect_power_rails = 3;
// Provides a breakdown of energy estimation for various subsystem (e.g. GPU).
// Available from Android S.
optional bool collect_energy_estimation_breakdown = 4;
// Provides a breakdown of time in state for various subsystems.
// Available from Android U.
optional bool collect_entity_state_residency = 5;
}
// End of protos/perfetto/config/power/android_power_config.proto
// Begin of protos/perfetto/config/process_stats/process_stats_config.proto
message ProcessStatsConfig {
enum Quirks {
QUIRKS_UNSPECIFIED = 0;
// This has been deprecated and ignored as per 2018-05-01. Full scan at
// startup is now disabled by default and can be re-enabled using the
// |scan_all_processes_on_start| arg.
DISABLE_INITIAL_DUMP = 1 [deprecated = true];
DISABLE_ON_DEMAND = 2;
}
repeated Quirks quirks = 1;
// If enabled all processes will be scanned and dumped when the trace starts.
optional bool scan_all_processes_on_start = 2;
// If enabled thread names are also recoded (this is redundant if sched_switch
// is enabled).
optional bool record_thread_names = 3;
// If > 0 samples counters (see process_stats.proto) from
// /proc/pid/status and oom_score_adj every X ms.
// This is required to be > 100ms to avoid excessive CPU usage.
// TODO(primiano): add CPU cost for change this value.
optional uint32 proc_stats_poll_ms = 4;
// If empty samples stats for all processes. If non empty samples stats only
// for processes matching the given string in their argv0 (i.e. the first
// entry of /proc/pid/cmdline).
// TODO(primiano): implement this feature.
// repeated string proc_stats_filter = 5;
// This is required to be either = 0 or a multiple of |proc_stats_poll_ms|
// (default: |proc_stats_poll_ms|). If = 0, will be set to
// |proc_stats_poll_ms|. Non-multiples will be rounded down to the nearest
// multiple.
optional uint32 proc_stats_cache_ttl_ms = 6;
// DEPRECATED record_thread_time_in_state
reserved 7;
// DEPRECATED thread_time_in_state_cache_size
reserved 8;
// If true this will resolve filedescriptors for each process so these
// can be mapped to their actual device or file.
// Requires raw_syscalls/sys_exit ftrace events to be enabled or
// new fds opened after initially scanning a process will not be
// recognized.
optional bool resolve_process_fds = 9;
}
// End of protos/perfetto/config/process_stats/process_stats_config.proto
// Begin of protos/perfetto/config/profiling/heapprofd_config.proto
// Configuration for go/heapprofd.
// Next id: 28
message HeapprofdConfig {
message ContinuousDumpConfig {
// ms to wait before first dump.
optional uint32 dump_phase_ms = 5;
// ms to wait between following dumps.
optional uint32 dump_interval_ms = 6;
}
// Sampling rate for all heaps not specified via heap_sampling_intervals.
//
// These are:
// * All heaps if heap_sampling_intervals is empty.
// * Those profiled due to all_heaps and not named in heaps if
// heap_sampling_intervals is not empty.
// * The implicit libc.malloc heap if heaps is empty.
//
// Set to 1 for perfect accuracy.
// Otherwise, sample every sample_interval_bytes on average.
//
// See
// https://perfetto.dev/docs/data-sources/native-heap-profiler#sampling-interval
// for more details.
//
// BUGS
// Before Android 12, setting this to 0 would crash the target process.
//
// N.B. This must be explicitly set to a non-zero value for all heaps (with
// this field or with heap_sampling_intervals), otherwise the producer will
// not start.
optional uint64 sampling_interval_bytes = 1;
// If less than the given numbers of bytes are left free in the shared
// memory buffer, increase sampling interval by a factor of two.
// Adaptive sampling is disabled when set to 0.
optional uint64 adaptive_sampling_shmem_threshold = 24;
// Stop doubling the sampling_interval once the sampling interval has reached
// this value.
optional uint64 adaptive_sampling_max_sampling_interval_bytes = 25;
// E.g. surfaceflinger, com.android.phone
// This input is normalized in the following way: if it contains slashes,
// everything up to the last slash is discarded. If it contains "@",
// everything after the first @ is discared.
// E.g. /system/bin/[email protected] normalizes to surfaceflinger.
// This transformation is also applied to the processes' command lines when
// matching.
repeated string process_cmdline = 2;
// For watermark based triggering or local debugging.
repeated uint64 pid = 4;
// Only profile target if it was installed by one of the packages given.
// Special values are:
// * @system: installed on the system partition
// * @product: installed on the product partition
// * @null: sideloaded
// Supported on Android 12+.
repeated string target_installed_by = 26;
// Which heaps to sample, e.g. "libc.malloc". If left empty, only samples
// "malloc".
//
// Introduced in Android 12.
repeated string heaps = 20;
// Which heaps not to sample, e.g. "libc.malloc". This is useful when used in
// combination with all_heaps;
//
// Introduced in Android 12.
repeated string exclude_heaps = 27;
optional bool stream_allocations = 23;
// If given, needs to be the same length as heaps and gives the sampling
// interval for the respective entry in heaps.
//
// Otherwise, sampling_interval_bytes is used.
//
// It is recommended to set sampling_interval_bytes to a reasonable default
// value when using this, as a value of 0 for sampling_interval_bytes will
// crash the target process before Android 12.
//
// Introduced in Android 12.
//
// All values must be non-zero or the producer will not start.
repeated uint64 heap_sampling_intervals = 22;
// Sample all heaps registered by target process. Introduced in Android 12.
optional bool all_heaps = 21;
// Profile all processes eligible for profiling on the system.
// See
// https://perfetto.dev/docs/data-sources/native-heap-profiler#heapprofd-targets
// for which processes are eligible.
//
// On unmodified userdebug builds, this will lead to system crashes. Zygote
// will crash when trying to launch a new process as it will have an
// unexpected open socket to heapprofd.
//
// heapprofd will likely be overloaded by the amount of data for low
// sampling intervals.
optional bool all = 5;
// Do not profile processes whose anon RSS + swap < given value.
// Introduced in Android 11.
optional uint32 min_anonymous_memory_kb = 15;
// Stop profile if heapprofd memory usage goes beyond the given value.
// Introduced in Android 11.
optional uint32 max_heapprofd_memory_kb = 16;
// Stop profile if heapprofd CPU time since start of this data-source
// goes beyond given value.
// Introduced in Android 11.
optional uint64 max_heapprofd_cpu_secs = 17;
// Do not emit function names for mappings starting with this prefix.
// E.g. /system to not emit symbols for any system libraries.
repeated string skip_symbol_prefix = 7;
// Dump at a predefined interval.
optional ContinuousDumpConfig continuous_dump_config = 6;
// Size of the shared memory buffer between the profiled processes and
// heapprofd. Defaults to 8 MiB. If larger than 500 MiB, truncated to 500
// MiB.
//
// Needs to be:
// * at least 8192,