From dace8fa1a4f83cd6e959173f0ec03b1b636accbc Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Wed, 8 May 2024 14:56:43 -0700 Subject: [PATCH] horrid vendoring Change-Id: Idf7891fe0fdbfed4e9ad660aa7613a67cb55e304 --- src/libtracing/perfetto/base/BUILD.gn | 33 + src/libtracing/perfetto/base/build_config.h | 160 + .../android_tree/perfetto_build_flags.h | 51 + .../bazel/perfetto_build_flags.h | 51 + src/libtracing/perfetto/base/compiler.h | 157 + src/libtracing/perfetto/base/export.h | 41 + src/libtracing/perfetto/base/flat_set.h | 100 + src/libtracing/perfetto/base/logging.h | 248 + .../perfetto/base/platform_handle.h | 71 + src/libtracing/perfetto/base/proc_utils.h | 59 + src/libtracing/perfetto/base/status.h | 117 + src/libtracing/perfetto/base/task_runner.h | 78 + src/libtracing/perfetto/base/template_util.h | 75 + src/libtracing/perfetto/base/thread_utils.h | 85 + src/libtracing/perfetto/base/time.h | 294 + src/libtracing/perfetto/ext/base/BUILD.gn | 73 + .../perfetto/ext/base/android_utils.h | 39 + src/libtracing/perfetto/ext/base/base64.h | 68 + .../perfetto/ext/base/circular_queue.h | 337 + .../perfetto/ext/base/container_annotations.h | 59 + src/libtracing/perfetto/ext/base/crash_keys.h | 162 + .../perfetto/ext/base/ctrl_c_handler.h | 32 + src/libtracing/perfetto/ext/base/endian.h | 58 + src/libtracing/perfetto/ext/base/event_fd.h | 64 + src/libtracing/perfetto/ext/base/file_utils.h | 114 + .../perfetto/ext/base/flat_hash_map.h | 395 + src/libtracing/perfetto/ext/base/getopt.h | 51 + .../perfetto/ext/base/getopt_compat.h | 71 + src/libtracing/perfetto/ext/base/hash.h | 137 + .../perfetto/ext/base/http/BUILD.gn | 21 + .../perfetto/ext/base/http/http_server.h | 189 + src/libtracing/perfetto/ext/base/http/sha1.h | 39 + src/libtracing/perfetto/ext/base/metatrace.h | 318 + .../perfetto/ext/base/metatrace_events.h | 117 + .../perfetto/ext/base/no_destructor.h | 78 + .../perfetto/ext/base/paged_memory.h | 105 + .../perfetto/ext/base/periodic_task.h | 90 + src/libtracing/perfetto/ext/base/pipe.h | 50 + src/libtracing/perfetto/ext/base/platform.h | 40 + .../perfetto/ext/base/scoped_file.h | 122 + .../perfetto/ext/base/scoped_mmap.h | 92 + src/libtracing/perfetto/ext/base/small_set.h | 62 + .../perfetto/ext/base/small_vector.h | 197 + src/libtracing/perfetto/ext/base/status_or.h | 83 + .../perfetto/ext/base/string_splitter.h | 90 + .../perfetto/ext/base/string_utils.h | 233 + .../perfetto/ext/base/string_view.h | 201 + .../perfetto/ext/base/string_writer.h | 183 + src/libtracing/perfetto/ext/base/subprocess.h | 281 + src/libtracing/perfetto/ext/base/sys_types.h | 63 + src/libtracing/perfetto/ext/base/temp_file.h | 80 + .../perfetto/ext/base/thread_annotations.h | 38 + .../perfetto/ext/base/thread_checker.h | 68 + .../perfetto/ext/base/thread_task_runner.h | 85 + .../perfetto/ext/base/thread_utils.h | 90 + .../perfetto/ext/base/threading/BUILD.gn | 33 + .../perfetto/ext/base/threading/channel.h | 180 + .../perfetto/ext/base/threading/future.h | 149 + .../ext/base/threading/future_combinators.h | 76 + .../perfetto/ext/base/threading/poll.h | 245 + .../perfetto/ext/base/threading/spawn.h | 149 + .../perfetto/ext/base/threading/stream.h | 190 + .../ext/base/threading/stream_combinators.h | 315 + .../perfetto/ext/base/threading/thread_pool.h | 80 + .../perfetto/ext/base/threading/util.h | 210 + .../perfetto/ext/base/unix_socket.h | 464 + .../perfetto/ext/base/unix_task_runner.h | 133 + src/libtracing/perfetto/ext/base/utils.h | 196 + src/libtracing/perfetto/ext/base/uuid.h | 75 + src/libtracing/perfetto/ext/base/version.h | 47 + .../perfetto/ext/base/waitable_event.h | 50 + src/libtracing/perfetto/ext/base/watchdog.h | 79 + .../perfetto/ext/base/watchdog_noop.h | 51 + .../perfetto/ext/base/watchdog_posix.h | 202 + src/libtracing/perfetto/ext/base/weak_ptr.h | 120 + src/libtracing/perfetto/ext/ipc/BUILD.gn | 32 + .../perfetto/ext/ipc/async_result.h | 74 + src/libtracing/perfetto/ext/ipc/basic_types.h | 55 + src/libtracing/perfetto/ext/ipc/client.h | 89 + src/libtracing/perfetto/ext/ipc/client_info.h | 77 + .../perfetto/ext/ipc/codegen_helpers.h | 54 + src/libtracing/perfetto/ext/ipc/deferred.h | 136 + src/libtracing/perfetto/ext/ipc/host.h | 83 + src/libtracing/perfetto/ext/ipc/service.h | 80 + .../perfetto/ext/ipc/service_descriptor.h | 72 + .../perfetto/ext/ipc/service_proxy.h | 102 + .../perfetto/ext/protozero/BUILD.gn | 21 + .../ext/protozero/proto_ring_buffer.h | 153 + .../perfetto/ext/trace_processor/BUILD.gn | 27 + .../perfetto/ext/trace_processor/demangle.h | 34 + .../ext/trace_processor/export_json.h | 63 + .../importers/memory_tracker/BUILD.gn | 31 + .../importers/memory_tracker/graph.h | 316 + .../memory_tracker/graph_processor.h | 250 + .../memory_tracker/memory_allocator_node_id.h | 62 + .../memory_tracker/memory_graph_edge.h | 55 + .../memory_tracker/raw_memory_graph_node.h | 147 + .../memory_tracker/raw_process_memory_node.h | 86 + .../perfetto/ext/trace_processor/rpc/BUILD.gn | 19 + .../rpc/query_result_serializer.h | 102 + src/libtracing/perfetto/ext/traced/BUILD.gn | 29 + .../perfetto/ext/traced/data_source_types.h | 62 + .../perfetto/ext/traced/sys_stats_counters.h | 384 + src/libtracing/perfetto/ext/traced/traced.h | 29 + .../perfetto/ext/tracing/core/BUILD.gn | 41 + .../perfetto/ext/tracing/core/basic_types.h | 107 + .../ext/tracing/core/client_identity.h | 51 + .../ext/tracing/core/commit_data_request.h | 28 + .../perfetto/ext/tracing/core/consumer.h | 95 + .../core/null_consumer_endpoint_for_testing.h | 56 + .../ext/tracing/core/observable_events.h | 28 + .../perfetto/ext/tracing/core/producer.h | 134 + .../perfetto/ext/tracing/core/shared_memory.h | 54 + .../ext/tracing/core/shared_memory_abi.h | 627 + .../ext/tracing/core/shared_memory_arbiter.h | 215 + .../perfetto/ext/tracing/core/slice.h | 77 + .../perfetto/ext/tracing/core/trace_packet.h | 106 + .../perfetto/ext/tracing/core/trace_stats.h | 28 + .../perfetto/ext/tracing/core/trace_writer.h | 53 + .../ext/tracing/core/tracing_service.h | 442 + .../perfetto/ext/tracing/ipc/BUILD.gn | 25 + .../ext/tracing/ipc/consumer_ipc_client.h | 54 + .../ext/tracing/ipc/producer_ipc_client.h | 102 + .../ext/tracing/ipc/service_ipc_host.h | 84 + .../protozero/contiguous_memory_range.h | 38 + .../perfetto/protozero/copyable_ptr.h | 87 + .../perfetto/protozero/cpp_message_obj.h | 46 + src/libtracing/perfetto/protozero/field.h | 214 + .../perfetto/protozero/field_writer.h | 188 + .../perfetto/protozero/gen_field_helpers.h | 163 + src/libtracing/perfetto/protozero/meson.build | 19 + src/libtracing/perfetto/protozero/message.h | 260 + .../perfetto/protozero/message_arena.h | 95 + .../perfetto/protozero/message_handle.h | 179 + .../protozero/packed_repeated_fields.h | 115 + .../perfetto/protozero/proto_decoder.h | 470 + .../perfetto/protozero/proto_utils.h | 296 + .../perfetto/protozero/root_message.h | 53 + .../protozero/scattered_heap_buffer.h | 185 + .../scattered_stream_null_delegate.h | 46 + .../protozero/scattered_stream_writer.h | 179 + .../perfetto/protozero/static_buffer.h | 102 + src/libtracing/perfetto/public/BUILD.gn | 45 + src/libtracing/perfetto/public/abi/BUILD.gn | 37 + src/libtracing/perfetto/public/abi/atomic.h | 67 + .../perfetto/public/abi/backend_type.h | 34 + .../perfetto/public/abi/data_source_abi.h | 372 + src/libtracing/perfetto/public/abi/export.h | 48 + .../perfetto/public/abi/heap_buffer.h | 54 + .../perfetto/public/abi/pb_decoder_abi.h | 93 + .../perfetto/public/abi/producer_abi.h | 51 + .../perfetto/public/abi/stream_writer_abi.h | 111 + .../perfetto/public/abi/thread_utils_abi.h | 55 + .../perfetto/public/abi/tracing_session_abi.h | 123 + .../perfetto/public/abi/track_event_abi.h | 152 + .../perfetto/public/abi/track_event_hl_abi.h | 196 + .../perfetto/public/abi/track_event_ll_abi.h | 117 + src/libtracing/perfetto/public/compiler.h | 54 + src/libtracing/perfetto/public/data_source.h | 272 + src/libtracing/perfetto/public/fnv1a.h | 38 + src/libtracing/perfetto/public/pb_decoder.h | 170 + src/libtracing/perfetto/public/pb_macros.h | 280 + src/libtracing/perfetto/public/pb_msg.h | 251 + src/libtracing/perfetto/public/pb_packed.h | 168 + src/libtracing/perfetto/public/pb_utils.h | 164 + src/libtracing/perfetto/public/producer.h | 61 + .../perfetto/public/protos/BUILD.gn | 32 + .../public/protos/common/builtin_clock.pzc.h | 39 + .../common/data_source_descriptor.pzc.h | 79 + .../protos/config/data_source_config.pzc.h | 257 + .../public/protos/config/trace_config.pzc.h | 570 + .../track_event/track_event_config.pzc.h | 75 + .../trace/interned_data/interned_data.pzc.h | 197 + .../public/protos/trace/test_event.pzc.h | 79 + .../perfetto/public/protos/trace/trace.pzc.h | 37 + .../public/protos/trace/trace_packet.pzc.h | 548 + .../track_event/counter_descriptor.pzc.h | 80 + .../trace/track_event/debug_annotation.pzc.h | 185 + .../trace/track_event/track_descriptor.pzc.h | 77 + .../trace/track_event/track_event.pzc.h | 391 + .../public/protos/trace/trigger.pzc.h | 42 + .../perfetto/public/stream_writer.h | 103 + .../perfetto/public/te_category_macros.h | 168 + src/libtracing/perfetto/public/te_macros.h | 320 + src/libtracing/perfetto/public/thread_utils.h | 49 + .../perfetto/public/tracing_session.h | 34 + src/libtracing/perfetto/public/track_event.h | 508 + src/libtracing/protos/README.md | 20 + .../android_energy_consumer_descriptor.proto | 43 + .../common/android_log_constants.proto | 47 + .../perfetto/common/builtin_clock.proto | 33 + .../perfetto/common/commit_data_request.proto | 84 + .../common/data_source_descriptor.proto | 69 + .../protos/perfetto/common/descriptor.proto | 238 + .../perfetto/common/ftrace_descriptor.proto | 31 + .../common/gpu_counter_descriptor.proto | 139 + .../common/interceptor_descriptor.proto | 25 + .../perfetto/common/observable_events.proto | 71 + .../protos/perfetto/common/perf_events.proto | 153 + .../perfetto/common/protolog_common.proto | 29 + .../perfetto/common/sys_stats_counters.proto | 253 + .../protos/perfetto/common/trace_stats.proto | 227 + .../common/tracing_service_capabilities.proto | 41 + .../common/tracing_service_state.proto | 129 + .../common/track_event_descriptor.proto | 29 + ...ndroid_game_intervention_list_config.proto | 27 + .../android/android_input_event_config.proto | 120 + .../config/android/android_log_config.proto | 34 + .../android/android_polled_state_config.proto | 28 + .../android_sdk_sysprop_guard_config.proto | 82 + .../android_system_property_config.proto | 30 + .../config/android/network_trace_config.proto | 54 + .../config/android/packages_list_config.proto | 27 + .../config/android/protolog_config.proto | 53 + .../surfaceflinger_layers_config.proto | 58 + .../surfaceflinger_transactions_config.proto | 38 + .../config/chrome/chrome_config.proto | 48 + .../config/chrome/scenario_config.proto | 127 + .../perfetto/config/chrome/v8_config.proto | 31 + .../perfetto/config/data_source_config.proto | 214 + .../perfetto/config/etw/etw_config.proto | 36 + .../config/ftrace/ftrace_config.proto | 236 + .../config/gpu/gpu_counter_config.proto | 34 + .../config/gpu/vulkan_memory_config.proto | 27 + .../config/inode_file/inode_file_config.proto | 46 + .../perfetto/config/interceptor_config.proto | 31 + .../config/interceptors/console_config.proto | 28 + .../perfetto/config/perfetto_config.proto | 4075 +++++ .../config/power/android_power_config.proto | 53 + .../process_stats/process_stats_config.proto | 79 + .../config/profiling/heapprofd_config.proto | 202 + .../config/profiling/java_hprof_config.proto | 90 + .../config/profiling/perf_event_config.proto | 218 + .../perfetto/config/statsd/atom_ids.proto | 907 + .../config/statsd/statsd_tracing_config.proto | 44 + .../perfetto/config/stress_test_config.proto | 77 + .../config/sys_stats/sys_stats_config.proto | 82 + .../config/system_info/system_info.proto | 27 + .../protos/perfetto/config/test_config.proto | 63 + .../protos/perfetto/config/trace_config.proto | 695 + .../track_event/track_event_config.proto | 102 + src/libtracing/protos/perfetto/ipc/OWNERS | 9 + .../protos/perfetto/ipc/consumer_port.proto | 312 + .../protos/perfetto/ipc/producer_port.proto | 352 + .../protos/perfetto/ipc/relay_port.proto | 58 + .../protos/perfetto/ipc/wire_protocol.proto | 104 + .../protos/perfetto/metrics/android/OWNERS | 1 + .../metrics/android/ad_services_metric.proto | 56 + .../android/android_blocking_call.proto | 39 + .../android_blocking_calls_cuj_metric.proto | 49 + .../android_blocking_calls_unagg.proto | 36 + .../metrics/android/android_boot.proto | 63 + .../metrics/android/android_boot_unagg.proto | 29 + .../android_frame_timeline_metric.proto | 86 + ...roid_garbage_collection_unagg_metric.proto | 63 + ..._notifications_blocking_calls_metric.proto | 26 + .../android/android_trusty_workqueues.proto | 22 + .../perfetto/metrics/android/anr_metric.proto | 41 + .../android/app_process_starts_metric.proto | 41 + .../metrics/android/batt_metric.proto | 60 + .../metrics/android/binder_metric.proto | 92 + .../metrics/android/camera_metric.proto | 42 + .../metrics/android/camera_unagg_metric.proto | 45 + .../metrics/android/codec_metrics.proto | 73 + .../perfetto/metrics/android/cpu_metric.proto | 81 + .../metrics/android/display_metrics.proto | 65 + .../metrics/android/dma_heap_metric.proto | 30 + .../metrics/android/dvfs_metric.proto | 43 + .../metrics/android/fastrpc_metric.proto | 35 + .../perfetto/metrics/android/g2d_metric.proto | 56 + .../perfetto/metrics/android/gpu_metric.proto | 68 + .../perfetto/metrics/android/hwcomposer.proto | 138 + .../metrics/android/hwui_metric.proto | 103 + .../perfetto/metrics/android/io_metric.proto | 48 + .../metrics/android/io_unagg_metric.proto | 36 + .../perfetto/metrics/android/ion_metric.proto | 35 + .../metrics/android/irq_runtime_metric.proto | 53 + .../metrics/android/jank_cuj_metric.proto | 155 + .../metrics/android/java_heap_histogram.proto | 50 + .../metrics/android/java_heap_stats.proto | 61 + .../perfetto/metrics/android/lmk_metric.proto | 35 + .../metrics/android/lmk_reason_metric.proto | 55 + .../perfetto/metrics/android/mem_metric.proto | 56 + .../metrics/android/mem_unagg_metric.proto | 43 + .../monitor_contention_agg_metric.proto | 34 + .../android/monitor_contention_metric.proto | 73 + .../metrics/android/multiuser_metric.proto | 48 + .../metrics/android/network_metric.proto | 176 + .../metrics/android/other_traces.proto | 25 + .../metrics/android/package_list.proto | 28 + .../metrics/android/powrails_metric.proto | 46 + .../metrics/android/process_metadata.proto | 51 + .../metrics/android/profiler_smaps.proto | 36 + .../metrics/android/rt_runtime_metric.proto | 38 + .../perfetto/metrics/android/simpleperf.proto | 60 + .../metrics/android/startup_metric.proto | 315 + .../metrics/android/surfaceflinger.proto | 85 + ...ysui_notif_shade_list_builder_metric.proto | 41 + ...i_slice_performance_statistical_data.proto | 35 + ...date_notif_on_ui_mode_changed_metric.proto | 39 + .../perfetto/metrics/android/task_names.proto | 43 + .../android/thread_time_in_state_metric.proto | 48 + .../metrics/android/trace_quality.proto | 32 + .../metrics/android/unsymbolized_frames.proto | 36 + .../metrics/chrome/all_chrome_metrics.proto | 56 + .../metrics/chrome/args_class_names.proto | 31 + .../metrics/chrome/dropped_frames.proto | 29 + .../perfetto/metrics/chrome/frame_times.proto | 28 + .../metrics/chrome/histogram_hashes.proto | 26 + .../metrics/chrome/long_latency.proto | 40 + .../metrics/chrome/media_metric.proto | 37 + .../chrome/performance_mark_hashes.proto | 27 + .../metrics/chrome/reported_by_page.proto | 31 + .../perfetto/metrics/chrome/scroll_jank.proto | 34 + .../metrics/chrome/scroll_jank_v3.proto | 65 + .../perfetto/metrics/chrome/slice_names.proto | 27 + .../metrics/chrome/test_chrome_metric.proto | 25 + .../perfetto/metrics/chrome/touch_jank.proto | 35 + .../metrics/chrome/unsymbolized_args.proto | 39 + .../metrics/chrome/user_event_hashes.proto | 26 + .../perfetto/metrics/custom_options.proto | 26 + .../protos/perfetto/metrics/metrics.proto | 312 + .../metrics/perfetto_merged_metrics.proto | 2735 +++ .../metrics/webview/all_webview_metrics.proto | 26 + .../webview/webview_jank_approximation.proto | 27 + .../android_game_intervention_list.proto | 42 + .../trace/android/android_input_event.proto | 134 + .../perfetto/trace/android/android_log.proto | 77 + .../android/android_system_property.proto | 27 + .../perfetto/trace/android/camera_event.proto | 160 + .../trace/android/frame_timeline_event.proto | 194 + .../trace/android/gpu_mem_event.proto | 25 + .../trace/android/graphics_frame_event.proto | 52 + .../trace/android/initial_display_state.proto | 24 + .../trace/android/network_trace.proto | 97 + .../trace/android/packages_list.proto | 36 + .../perfetto/trace/android/protolog.proto | 62 + .../trace/android/shell_transition.proto | 113 + .../trace/android/surfaceflinger_common.proto | 93 + .../trace/android/surfaceflinger_layers.proto | 262 + .../android/surfaceflinger_transactions.proto | 317 + .../perfetto/trace/android/winscope.proto | 33 + .../chrome/chrome_benchmark_metadata.proto | 50 + .../trace/chrome/chrome_metadata.proto | 103 + .../trace/chrome/chrome_trace_event.proto | 126 + .../trace/chrome/chrome_trace_packet.proto | 68 + .../trace/chrome/chrome_trigger.proto | 28 + .../protos/perfetto/trace/chrome/v8.proto | 271 + .../perfetto/trace/clock_snapshot.proto | 76 + .../protos/perfetto/trace/etw/all_protos.gni | 19 + .../protos/perfetto/trace/etw/etw.proto | 153 + .../protos/perfetto/trace/etw/etw_event.proto | 30 + .../perfetto/trace/etw/etw_event_bundle.proto | 29 + .../perfetto/trace/extension_descriptor.proto | 29 + .../trace/filesystem/inode_file_map.proto | 47 + .../perfetto/trace/ftrace/all_protos.gni | 86 + .../perfetto/trace/ftrace/android_fs.proto | 47 + .../protos/perfetto/trace/ftrace/binder.proto | 47 + .../protos/perfetto/trace/ftrace/block.proto | 140 + .../protos/perfetto/trace/ftrace/cgroup.proto | 68 + .../protos/perfetto/trace/ftrace/clk.proto | 17 + .../protos/perfetto/trace/ftrace/cma.proto | 24 + .../perfetto/trace/ftrace/compaction.proto | 95 + .../protos/perfetto/trace/ftrace/cpuhp.proto | 37 + .../perfetto/trace/ftrace/cros_ec.proto | 15 + .../perfetto/trace/ftrace/dma_fence.proto | 37 + .../perfetto/trace/ftrace/dmabuf_heap.proto | 12 + .../protos/perfetto/trace/ftrace/dpu.proto | 29 + .../protos/perfetto/trace/ftrace/drm.proto | 18 + .../protos/perfetto/trace/ftrace/ext4.proto | 696 + .../protos/perfetto/trace/ftrace/f2fs.proto | 324 + .../perfetto/trace/ftrace/fastrpc.proto | 38 + .../protos/perfetto/trace/ftrace/fence.proto | 31 + .../perfetto/trace/ftrace/filemap.proto | 21 + .../protos/perfetto/trace/ftrace/ftrace.proto | 22 + .../perfetto/trace/ftrace/ftrace_event.proto | 622 + .../trace/ftrace/ftrace_event_bundle.proto | 135 + .../perfetto/trace/ftrace/ftrace_stats.proto | 140 + .../protos/perfetto/trace/ftrace/g2d.proto | 13 + .../perfetto/trace/ftrace/generic.proto | 35 + .../perfetto/trace/ftrace/gpu_mem.proto | 12 + .../perfetto/trace/ftrace/gpu_scheduler.proto | 26 + .../protos/perfetto/trace/ftrace/hyp.proto | 21 + .../protos/perfetto/trace/ftrace/i2c.proto | 67 + .../protos/perfetto/trace/ftrace/ion.proto | 12 + .../protos/perfetto/trace/ftrace/ipi.proto | 17 + .../protos/perfetto/trace/ftrace/irq.proto | 25 + .../protos/perfetto/trace/ftrace/kfree.proto | 11 + .../perfetto/trace/ftrace/kmalloc.proto | 14 + .../protos/perfetto/trace/ftrace/kmem.proto | 241 + .../protos/perfetto/trace/ftrace/kvm.proto | 170 + .../trace/ftrace/lowmemorykiller.proto | 14 + .../protos/perfetto/trace/ftrace/lwis.proto | 14 + .../protos/perfetto/trace/ftrace/mali.proto | 65 + .../protos/perfetto/trace/ftrace/mdss.proto | 154 + .../perfetto/trace/ftrace/mm_event.proto | 13 + .../protos/perfetto/trace/ftrace/net.proto | 42 + .../protos/perfetto/trace/ftrace/oom.proto | 15 + .../protos/perfetto/trace/ftrace/panel.proto | 28 + .../trace/ftrace/perf_trace_counters.proto | 26 + .../protos/perfetto/trace/ftrace/power.proto | 59 + .../protos/perfetto/trace/ftrace/print.proto | 11 + .../protos/perfetto/trace/ftrace/printk.proto | 10 + .../perfetto/trace/ftrace/raw_syscalls.proto | 15 + .../perfetto/trace/ftrace/regulator.proto | 31 + .../protos/perfetto/trace/ftrace/rpm.proto | 11 + .../perfetto/trace/ftrace/samsung.proto | 14 + .../protos/perfetto/trace/ftrace/sched.proto | 110 + .../protos/perfetto/trace/ftrace/scm.proto | 13 + .../protos/perfetto/trace/ftrace/sde.proto | 57 + .../protos/perfetto/trace/ftrace/signal.proto | 20 + .../protos/perfetto/trace/ftrace/skb.proto | 12 + .../protos/perfetto/trace/ftrace/sock.proto | 18 + .../protos/perfetto/trace/ftrace/sync.proto | 20 + .../perfetto/trace/ftrace/synthetic.proto | 16 + .../perfetto/trace/ftrace/systrace.proto | 13 + .../protos/perfetto/trace/ftrace/task.proto | 19 + .../protos/perfetto/trace/ftrace/tcp.proto | 16 + .../trace/ftrace/test_bundle_wrapper.proto | 26 + .../perfetto/trace/ftrace/thermal.proto | 17 + .../protos/perfetto/trace/ftrace/trusty.proto | 96 + .../protos/perfetto/trace/ftrace/ufs.proto | 23 + .../protos/perfetto/trace/ftrace/v4l2.proto | 115 + .../perfetto/trace/ftrace/virtio_gpu.proto | 29 + .../perfetto/trace/ftrace/virtio_video.proto | 35 + .../protos/perfetto/trace/ftrace/vmscan.proto | 45 + .../perfetto/trace/ftrace/workqueue.proto | 25 + .../trace/gpu/gpu_counter_event.proto | 40 + .../protos/perfetto/trace/gpu/gpu_log.proto | 36 + .../trace/gpu/gpu_render_stage_event.proto | 146 + .../perfetto/trace/gpu/vulkan_api_event.proto | 52 + .../trace/gpu/vulkan_memory_event.proto | 103 + .../trace/interned_data/interned_data.proto | 140 + .../protos/perfetto/trace/memory_graph.proto | 123 + .../trace/perfetto/perfetto_metatrace.proto | 68 + .../perfetto/tracing_service_event.proto | 67 + .../perfetto/trace/perfetto_trace.proto | 14990 ++++++++++++++++ .../android_energy_estimation_breakdown.proto | 49 + .../android_entity_state_residency.proto | 60 + .../trace/power/battery_counters.proto | 46 + .../perfetto/trace/power/power_rails.proto | 51 + .../trace/profiling/deobfuscation.proto | 44 + .../perfetto/trace/profiling/heap_graph.proto | 150 + .../trace/profiling/profile_common.proto | 152 + .../trace/profiling/profile_packet.proto | 363 + .../perfetto/trace/profiling/smaps.proto | 47 + .../perfetto/trace/ps/process_stats.proto | 103 + .../perfetto/trace/ps/process_tree.proto | 89 + .../perfetto/trace/remote_clock_sync.proto | 35 + .../perfetto/trace/statsd/statsd_atom.proto | 35 + .../perfetto/trace/sys_stats/sys_stats.proto | 162 + .../protos/perfetto/trace/system_info.proto | 57 + .../perfetto/trace/system_info/cpu_info.proto | 36 + .../protos/perfetto/trace/test_event.proto | 52 + .../perfetto/trace/test_extensions.proto | 43 + .../protos/perfetto/trace/trace.proto | 31 + .../protos/perfetto/trace/trace_packet.proto | 354 + .../trace/trace_packet_defaults.proto | 44 + .../protos/perfetto/trace/trace_uuid.proto | 30 + .../track_event/chrome_active_processes.proto | 24 + .../chrome_application_state_info.proto | 34 + .../chrome_compositor_scheduler_state.proto | 270 + .../chrome_content_settings_event_info.proto | 27 + .../track_event/chrome_frame_reporter.proto | 114 + .../track_event/chrome_histogram_sample.proto | 35 + .../track_event/chrome_keyed_service.proto | 26 + .../track_event/chrome_latency_info.proto | 88 + .../trace/track_event/chrome_legacy_ipc.proto | 72 + .../track_event/chrome_message_pump.proto | 28 + .../track_event/chrome_mojo_event_info.proto | 55 + .../chrome_process_descriptor.proto | 93 + .../chrome_renderer_scheduler_state.proto | 39 + .../chrome_thread_descriptor.proto | 86 + .../trace/track_event/chrome_user_event.proto | 31 + .../chrome_window_handle_event_info.proto | 26 + .../track_event/counter_descriptor.proto | 95 + .../trace/track_event/debug_annotation.proto | 143 + .../trace/track_event/log_message.proto | 46 + .../trace/track_event/pixel_modem.proto | 25 + .../track_event/process_descriptor.proto | 61 + .../trace/track_event/range_of_interest.proto | 26 + .../trace/track_event/screenshot.proto | 23 + .../trace/track_event/source_location.proto | 40 + .../trace/track_event/task_execution.proto | 26 + .../trace/track_event/thread_descriptor.proto | 75 + .../trace/track_event/track_descriptor.proto | 94 + .../trace/track_event/track_event.proto | 435 + .../trace/translation/translation_table.proto | 51 + .../protos/perfetto/trace/trigger.proto | 31 + .../protos/perfetto/trace/ui_state.proto | 54 + .../metatrace_categories.proto | 38 + .../trace_processor/metrics_impl.proto | 57 + .../perfetto/trace_processor/proto_files.gni | 22 + .../trace_processor/serialization.proto | 118 + .../perfetto/trace_processor/stack.proto | 39 + .../trace_processor/trace_processor.proto | 330 + .../protos/third_party/CHROMIUM_OWNERS | 21 + src/libtracing/protos/third_party/OWNERS | 3 + .../chromium/chrome_track_event.proto | 1974 ++ .../protos/third_party/chromium/sources.gni | 11 + .../protos/third_party/pprof/profile.proto | 230 + .../third_party/statsd/shell_config.proto | 38 + .../third_party/statsd/shell_data.proto | 27 + .../protozero_src/copyable_ptr_unittest.cc | 118 + src/libtracing/protozero_src/field.cc | 81 + .../filtering/filter_bytecode_common.h | 49 + .../filtering/filter_bytecode_generator.cc | 99 + .../filtering/filter_bytecode_generator.h | 79 + .../filter_bytecode_generator_unittest.cc | 143 + .../filtering/filter_bytecode_parser.cc | 244 + .../filtering/filter_bytecode_parser.h | 140 + .../filter_bytecode_parser_fuzzer.cc | 94 + .../filter_bytecode_parser_unittest.cc | 261 + .../protozero_src/filtering/filter_util.cc | 426 + .../protozero_src/filtering/filter_util.h | 136 + .../filtering/filter_util_unittest.cc | 381 + .../protozero_src/filtering/message_filter.cc | 329 + .../protozero_src/filtering/message_filter.h | 241 + .../filtering/message_filter_benchmark.cc | 48 + .../filtering/message_filter_fuzzer.cc | 104 + .../filtering/message_filter_unittest.cc | 934 + .../filtering/message_tokenizer.h | 199 + .../filtering/message_tokenizer_unittest.cc | 179 + .../protozero_src/filtering/string_filter.cc | 161 + .../protozero_src/filtering/string_filter.h | 66 + .../filtering/string_filter_benchmark.cc | 165 + .../filtering/string_filter_unittest.cc | 282 + .../protozero_src/gen_field_helpers.cc | 105 + src/libtracing/protozero_src/message.cc | 220 + src/libtracing/protozero_src/message_arena.cc | 72 + .../protozero_src/message_arena_unittest.cc | 66 + .../protozero_src/message_handle_unittest.cc | 35 + .../protozero_src/message_unittest.cc | 474 + .../protozero_src/packed_repeated_fields.cc | 43 + src/libtracing/protozero_src/proto_decoder.cc | 269 + .../protozero_src/proto_decoder_fuzzer.cc | 44 + .../protozero_src/proto_decoder_unittest.cc | 651 + .../protozero_src/proto_ring_buffer.cc | 192 + .../proto_ring_buffer_unittest.cc | 268 + .../protozero_src/proto_utils_unittest.cc | 232 + .../protoc_plugin/cppgen_plugin.cc | 913 + .../protoc_plugin/protozero_c_plugin.cc | 623 + .../protoc_plugin/protozero_plugin.cc | 1136 ++ .../protozero_src/scattered_heap_buffer.cc | 121 + .../scattered_stream_null_delegate.cc | 37 + .../protozero_src/scattered_stream_writer.cc | 92 + .../scattered_stream_writer_unittest.cc | 133 + src/libtracing/protozero_src/static_buffer.cc | 35 + .../test/cppgen_conformance_unittest.cc | 401 + .../test/example_proto/extensions.proto | 44 + .../test/example_proto/library.proto | 34 + .../library_internals/galaxies.proto | 27 + .../other_package/test_messages.proto | 40 + .../subpackage/test_messages.proto | 40 + .../test/example_proto/test_messages.proto | 195 + .../test/example_proto/upper_import.proto | 21 + .../test/fake_scattered_buffer.cc | 74 + .../test/fake_scattered_buffer.h | 54 + .../test/proto_ring_buffer_benchmark.cc | 75 + .../protozero_src/test/protozero_benchmark.cc | 200 + .../test/protozero_conformance_unittest.cc | 373 + .../protozero_src/virtual_destructors.cc | 25 + 562 files changed, 84479 insertions(+) create mode 100644 src/libtracing/perfetto/base/BUILD.gn create mode 100644 src/libtracing/perfetto/base/build_config.h create mode 100644 src/libtracing/perfetto/base/build_configs/android_tree/perfetto_build_flags.h create mode 100644 src/libtracing/perfetto/base/build_configs/bazel/perfetto_build_flags.h create mode 100644 src/libtracing/perfetto/base/compiler.h create mode 100644 src/libtracing/perfetto/base/export.h create mode 100644 src/libtracing/perfetto/base/flat_set.h create mode 100644 src/libtracing/perfetto/base/logging.h create mode 100644 src/libtracing/perfetto/base/platform_handle.h create mode 100644 src/libtracing/perfetto/base/proc_utils.h create mode 100644 src/libtracing/perfetto/base/status.h create mode 100644 src/libtracing/perfetto/base/task_runner.h create mode 100644 src/libtracing/perfetto/base/template_util.h create mode 100644 src/libtracing/perfetto/base/thread_utils.h create mode 100644 src/libtracing/perfetto/base/time.h create mode 100644 src/libtracing/perfetto/ext/base/BUILD.gn create mode 100644 src/libtracing/perfetto/ext/base/android_utils.h create mode 100644 src/libtracing/perfetto/ext/base/base64.h create mode 100644 src/libtracing/perfetto/ext/base/circular_queue.h create mode 100644 src/libtracing/perfetto/ext/base/container_annotations.h create mode 100644 src/libtracing/perfetto/ext/base/crash_keys.h create mode 100644 src/libtracing/perfetto/ext/base/ctrl_c_handler.h create mode 100644 src/libtracing/perfetto/ext/base/endian.h create mode 100644 src/libtracing/perfetto/ext/base/event_fd.h create mode 100644 src/libtracing/perfetto/ext/base/file_utils.h create mode 100644 src/libtracing/perfetto/ext/base/flat_hash_map.h create mode 100644 src/libtracing/perfetto/ext/base/getopt.h create mode 100644 src/libtracing/perfetto/ext/base/getopt_compat.h create mode 100644 src/libtracing/perfetto/ext/base/hash.h create mode 100644 src/libtracing/perfetto/ext/base/http/BUILD.gn create mode 100644 src/libtracing/perfetto/ext/base/http/http_server.h create mode 100644 src/libtracing/perfetto/ext/base/http/sha1.h create mode 100644 src/libtracing/perfetto/ext/base/metatrace.h create mode 100644 src/libtracing/perfetto/ext/base/metatrace_events.h create mode 100644 src/libtracing/perfetto/ext/base/no_destructor.h create mode 100644 src/libtracing/perfetto/ext/base/paged_memory.h create mode 100644 src/libtracing/perfetto/ext/base/periodic_task.h create mode 100644 src/libtracing/perfetto/ext/base/pipe.h create mode 100644 src/libtracing/perfetto/ext/base/platform.h create mode 100644 src/libtracing/perfetto/ext/base/scoped_file.h create mode 100644 src/libtracing/perfetto/ext/base/scoped_mmap.h create mode 100644 src/libtracing/perfetto/ext/base/small_set.h create mode 100644 src/libtracing/perfetto/ext/base/small_vector.h create mode 100644 src/libtracing/perfetto/ext/base/status_or.h create mode 100644 src/libtracing/perfetto/ext/base/string_splitter.h create mode 100644 src/libtracing/perfetto/ext/base/string_utils.h create mode 100644 src/libtracing/perfetto/ext/base/string_view.h create mode 100644 src/libtracing/perfetto/ext/base/string_writer.h create mode 100644 src/libtracing/perfetto/ext/base/subprocess.h create mode 100644 src/libtracing/perfetto/ext/base/sys_types.h create mode 100644 src/libtracing/perfetto/ext/base/temp_file.h create mode 100644 src/libtracing/perfetto/ext/base/thread_annotations.h create mode 100644 src/libtracing/perfetto/ext/base/thread_checker.h create mode 100644 src/libtracing/perfetto/ext/base/thread_task_runner.h create mode 100644 src/libtracing/perfetto/ext/base/thread_utils.h create mode 100644 src/libtracing/perfetto/ext/base/threading/BUILD.gn create mode 100644 src/libtracing/perfetto/ext/base/threading/channel.h create mode 100644 src/libtracing/perfetto/ext/base/threading/future.h create mode 100644 src/libtracing/perfetto/ext/base/threading/future_combinators.h create mode 100644 src/libtracing/perfetto/ext/base/threading/poll.h create mode 100644 src/libtracing/perfetto/ext/base/threading/spawn.h create mode 100644 src/libtracing/perfetto/ext/base/threading/stream.h create mode 100644 src/libtracing/perfetto/ext/base/threading/stream_combinators.h create mode 100644 src/libtracing/perfetto/ext/base/threading/thread_pool.h create mode 100644 src/libtracing/perfetto/ext/base/threading/util.h create mode 100644 src/libtracing/perfetto/ext/base/unix_socket.h create mode 100644 src/libtracing/perfetto/ext/base/unix_task_runner.h create mode 100644 src/libtracing/perfetto/ext/base/utils.h create mode 100644 src/libtracing/perfetto/ext/base/uuid.h create mode 100644 src/libtracing/perfetto/ext/base/version.h create mode 100644 src/libtracing/perfetto/ext/base/waitable_event.h create mode 100644 src/libtracing/perfetto/ext/base/watchdog.h create mode 100644 src/libtracing/perfetto/ext/base/watchdog_noop.h create mode 100644 src/libtracing/perfetto/ext/base/watchdog_posix.h create mode 100644 src/libtracing/perfetto/ext/base/weak_ptr.h create mode 100644 src/libtracing/perfetto/ext/ipc/BUILD.gn create mode 100644 src/libtracing/perfetto/ext/ipc/async_result.h create mode 100644 src/libtracing/perfetto/ext/ipc/basic_types.h create mode 100644 src/libtracing/perfetto/ext/ipc/client.h create mode 100644 src/libtracing/perfetto/ext/ipc/client_info.h create mode 100644 src/libtracing/perfetto/ext/ipc/codegen_helpers.h create mode 100644 src/libtracing/perfetto/ext/ipc/deferred.h create mode 100644 src/libtracing/perfetto/ext/ipc/host.h create mode 100644 src/libtracing/perfetto/ext/ipc/service.h create mode 100644 src/libtracing/perfetto/ext/ipc/service_descriptor.h create mode 100644 src/libtracing/perfetto/ext/ipc/service_proxy.h create mode 100644 src/libtracing/perfetto/ext/protozero/BUILD.gn create mode 100644 src/libtracing/perfetto/ext/protozero/proto_ring_buffer.h create mode 100644 src/libtracing/perfetto/ext/trace_processor/BUILD.gn create mode 100644 src/libtracing/perfetto/ext/trace_processor/demangle.h create mode 100644 src/libtracing/perfetto/ext/trace_processor/export_json.h create mode 100644 src/libtracing/perfetto/ext/trace_processor/importers/memory_tracker/BUILD.gn create mode 100644 src/libtracing/perfetto/ext/trace_processor/importers/memory_tracker/graph.h create mode 100644 src/libtracing/perfetto/ext/trace_processor/importers/memory_tracker/graph_processor.h create mode 100644 src/libtracing/perfetto/ext/trace_processor/importers/memory_tracker/memory_allocator_node_id.h create mode 100644 src/libtracing/perfetto/ext/trace_processor/importers/memory_tracker/memory_graph_edge.h create mode 100644 src/libtracing/perfetto/ext/trace_processor/importers/memory_tracker/raw_memory_graph_node.h create mode 100644 src/libtracing/perfetto/ext/trace_processor/importers/memory_tracker/raw_process_memory_node.h create mode 100644 src/libtracing/perfetto/ext/trace_processor/rpc/BUILD.gn create mode 100644 src/libtracing/perfetto/ext/trace_processor/rpc/query_result_serializer.h create mode 100644 src/libtracing/perfetto/ext/traced/BUILD.gn create mode 100644 src/libtracing/perfetto/ext/traced/data_source_types.h create mode 100644 src/libtracing/perfetto/ext/traced/sys_stats_counters.h create mode 100644 src/libtracing/perfetto/ext/traced/traced.h create mode 100644 src/libtracing/perfetto/ext/tracing/core/BUILD.gn create mode 100644 src/libtracing/perfetto/ext/tracing/core/basic_types.h create mode 100644 src/libtracing/perfetto/ext/tracing/core/client_identity.h create mode 100644 src/libtracing/perfetto/ext/tracing/core/commit_data_request.h create mode 100644 src/libtracing/perfetto/ext/tracing/core/consumer.h create mode 100644 src/libtracing/perfetto/ext/tracing/core/null_consumer_endpoint_for_testing.h create mode 100644 src/libtracing/perfetto/ext/tracing/core/observable_events.h create mode 100644 src/libtracing/perfetto/ext/tracing/core/producer.h create mode 100644 src/libtracing/perfetto/ext/tracing/core/shared_memory.h create mode 100644 src/libtracing/perfetto/ext/tracing/core/shared_memory_abi.h create mode 100644 src/libtracing/perfetto/ext/tracing/core/shared_memory_arbiter.h create mode 100644 src/libtracing/perfetto/ext/tracing/core/slice.h create mode 100644 src/libtracing/perfetto/ext/tracing/core/trace_packet.h create mode 100644 src/libtracing/perfetto/ext/tracing/core/trace_stats.h create mode 100644 src/libtracing/perfetto/ext/tracing/core/trace_writer.h create mode 100644 src/libtracing/perfetto/ext/tracing/core/tracing_service.h create mode 100644 src/libtracing/perfetto/ext/tracing/ipc/BUILD.gn create mode 100644 src/libtracing/perfetto/ext/tracing/ipc/consumer_ipc_client.h create mode 100644 src/libtracing/perfetto/ext/tracing/ipc/producer_ipc_client.h create mode 100644 src/libtracing/perfetto/ext/tracing/ipc/service_ipc_host.h create mode 100644 src/libtracing/perfetto/protozero/contiguous_memory_range.h create mode 100644 src/libtracing/perfetto/protozero/copyable_ptr.h create mode 100644 src/libtracing/perfetto/protozero/cpp_message_obj.h create mode 100644 src/libtracing/perfetto/protozero/field.h create mode 100644 src/libtracing/perfetto/protozero/field_writer.h create mode 100644 src/libtracing/perfetto/protozero/gen_field_helpers.h create mode 100644 src/libtracing/perfetto/protozero/meson.build create mode 100644 src/libtracing/perfetto/protozero/message.h create mode 100644 src/libtracing/perfetto/protozero/message_arena.h create mode 100644 src/libtracing/perfetto/protozero/message_handle.h create mode 100644 src/libtracing/perfetto/protozero/packed_repeated_fields.h create mode 100644 src/libtracing/perfetto/protozero/proto_decoder.h create mode 100644 src/libtracing/perfetto/protozero/proto_utils.h create mode 100644 src/libtracing/perfetto/protozero/root_message.h create mode 100644 src/libtracing/perfetto/protozero/scattered_heap_buffer.h create mode 100644 src/libtracing/perfetto/protozero/scattered_stream_null_delegate.h create mode 100644 src/libtracing/perfetto/protozero/scattered_stream_writer.h create mode 100644 src/libtracing/perfetto/protozero/static_buffer.h create mode 100644 src/libtracing/perfetto/public/BUILD.gn create mode 100644 src/libtracing/perfetto/public/abi/BUILD.gn create mode 100644 src/libtracing/perfetto/public/abi/atomic.h create mode 100644 src/libtracing/perfetto/public/abi/backend_type.h create mode 100644 src/libtracing/perfetto/public/abi/data_source_abi.h create mode 100644 src/libtracing/perfetto/public/abi/export.h create mode 100644 src/libtracing/perfetto/public/abi/heap_buffer.h create mode 100644 src/libtracing/perfetto/public/abi/pb_decoder_abi.h create mode 100644 src/libtracing/perfetto/public/abi/producer_abi.h create mode 100644 src/libtracing/perfetto/public/abi/stream_writer_abi.h create mode 100644 src/libtracing/perfetto/public/abi/thread_utils_abi.h create mode 100644 src/libtracing/perfetto/public/abi/tracing_session_abi.h create mode 100644 src/libtracing/perfetto/public/abi/track_event_abi.h create mode 100644 src/libtracing/perfetto/public/abi/track_event_hl_abi.h create mode 100644 src/libtracing/perfetto/public/abi/track_event_ll_abi.h create mode 100644 src/libtracing/perfetto/public/compiler.h create mode 100644 src/libtracing/perfetto/public/data_source.h create mode 100644 src/libtracing/perfetto/public/fnv1a.h create mode 100644 src/libtracing/perfetto/public/pb_decoder.h create mode 100644 src/libtracing/perfetto/public/pb_macros.h create mode 100644 src/libtracing/perfetto/public/pb_msg.h create mode 100644 src/libtracing/perfetto/public/pb_packed.h create mode 100644 src/libtracing/perfetto/public/pb_utils.h create mode 100644 src/libtracing/perfetto/public/producer.h create mode 100644 src/libtracing/perfetto/public/protos/BUILD.gn create mode 100644 src/libtracing/perfetto/public/protos/common/builtin_clock.pzc.h create mode 100644 src/libtracing/perfetto/public/protos/common/data_source_descriptor.pzc.h create mode 100644 src/libtracing/perfetto/public/protos/config/data_source_config.pzc.h create mode 100644 src/libtracing/perfetto/public/protos/config/trace_config.pzc.h create mode 100644 src/libtracing/perfetto/public/protos/config/track_event/track_event_config.pzc.h create mode 100644 src/libtracing/perfetto/public/protos/trace/interned_data/interned_data.pzc.h create mode 100644 src/libtracing/perfetto/public/protos/trace/test_event.pzc.h create mode 100644 src/libtracing/perfetto/public/protos/trace/trace.pzc.h create mode 100644 src/libtracing/perfetto/public/protos/trace/trace_packet.pzc.h create mode 100644 src/libtracing/perfetto/public/protos/trace/track_event/counter_descriptor.pzc.h create mode 100644 src/libtracing/perfetto/public/protos/trace/track_event/debug_annotation.pzc.h create mode 100644 src/libtracing/perfetto/public/protos/trace/track_event/track_descriptor.pzc.h create mode 100644 src/libtracing/perfetto/public/protos/trace/track_event/track_event.pzc.h create mode 100644 src/libtracing/perfetto/public/protos/trace/trigger.pzc.h create mode 100644 src/libtracing/perfetto/public/stream_writer.h create mode 100644 src/libtracing/perfetto/public/te_category_macros.h create mode 100644 src/libtracing/perfetto/public/te_macros.h create mode 100644 src/libtracing/perfetto/public/thread_utils.h create mode 100644 src/libtracing/perfetto/public/tracing_session.h create mode 100644 src/libtracing/perfetto/public/track_event.h create mode 100644 src/libtracing/protos/README.md create mode 100644 src/libtracing/protos/perfetto/common/android_energy_consumer_descriptor.proto create mode 100644 src/libtracing/protos/perfetto/common/android_log_constants.proto create mode 100644 src/libtracing/protos/perfetto/common/builtin_clock.proto create mode 100644 src/libtracing/protos/perfetto/common/commit_data_request.proto create mode 100644 src/libtracing/protos/perfetto/common/data_source_descriptor.proto create mode 100644 src/libtracing/protos/perfetto/common/descriptor.proto create mode 100644 src/libtracing/protos/perfetto/common/ftrace_descriptor.proto create mode 100644 src/libtracing/protos/perfetto/common/gpu_counter_descriptor.proto create mode 100644 src/libtracing/protos/perfetto/common/interceptor_descriptor.proto create mode 100644 src/libtracing/protos/perfetto/common/observable_events.proto create mode 100644 src/libtracing/protos/perfetto/common/perf_events.proto create mode 100644 src/libtracing/protos/perfetto/common/protolog_common.proto create mode 100644 src/libtracing/protos/perfetto/common/sys_stats_counters.proto create mode 100644 src/libtracing/protos/perfetto/common/trace_stats.proto create mode 100644 src/libtracing/protos/perfetto/common/tracing_service_capabilities.proto create mode 100644 src/libtracing/protos/perfetto/common/tracing_service_state.proto create mode 100644 src/libtracing/protos/perfetto/common/track_event_descriptor.proto create mode 100644 src/libtracing/protos/perfetto/config/android/android_game_intervention_list_config.proto create mode 100644 src/libtracing/protos/perfetto/config/android/android_input_event_config.proto create mode 100644 src/libtracing/protos/perfetto/config/android/android_log_config.proto create mode 100644 src/libtracing/protos/perfetto/config/android/android_polled_state_config.proto create mode 100644 src/libtracing/protos/perfetto/config/android/android_sdk_sysprop_guard_config.proto create mode 100644 src/libtracing/protos/perfetto/config/android/android_system_property_config.proto create mode 100644 src/libtracing/protos/perfetto/config/android/network_trace_config.proto create mode 100644 src/libtracing/protos/perfetto/config/android/packages_list_config.proto create mode 100644 src/libtracing/protos/perfetto/config/android/protolog_config.proto create mode 100644 src/libtracing/protos/perfetto/config/android/surfaceflinger_layers_config.proto create mode 100644 src/libtracing/protos/perfetto/config/android/surfaceflinger_transactions_config.proto create mode 100644 src/libtracing/protos/perfetto/config/chrome/chrome_config.proto create mode 100644 src/libtracing/protos/perfetto/config/chrome/scenario_config.proto create mode 100644 src/libtracing/protos/perfetto/config/chrome/v8_config.proto create mode 100644 src/libtracing/protos/perfetto/config/data_source_config.proto create mode 100644 src/libtracing/protos/perfetto/config/etw/etw_config.proto create mode 100644 src/libtracing/protos/perfetto/config/ftrace/ftrace_config.proto create mode 100644 src/libtracing/protos/perfetto/config/gpu/gpu_counter_config.proto create mode 100644 src/libtracing/protos/perfetto/config/gpu/vulkan_memory_config.proto create mode 100644 src/libtracing/protos/perfetto/config/inode_file/inode_file_config.proto create mode 100644 src/libtracing/protos/perfetto/config/interceptor_config.proto create mode 100644 src/libtracing/protos/perfetto/config/interceptors/console_config.proto create mode 100644 src/libtracing/protos/perfetto/config/perfetto_config.proto create mode 100644 src/libtracing/protos/perfetto/config/power/android_power_config.proto create mode 100644 src/libtracing/protos/perfetto/config/process_stats/process_stats_config.proto create mode 100644 src/libtracing/protos/perfetto/config/profiling/heapprofd_config.proto create mode 100644 src/libtracing/protos/perfetto/config/profiling/java_hprof_config.proto create mode 100644 src/libtracing/protos/perfetto/config/profiling/perf_event_config.proto create mode 100644 src/libtracing/protos/perfetto/config/statsd/atom_ids.proto create mode 100644 src/libtracing/protos/perfetto/config/statsd/statsd_tracing_config.proto create mode 100644 src/libtracing/protos/perfetto/config/stress_test_config.proto create mode 100644 src/libtracing/protos/perfetto/config/sys_stats/sys_stats_config.proto create mode 100644 src/libtracing/protos/perfetto/config/system_info/system_info.proto create mode 100644 src/libtracing/protos/perfetto/config/test_config.proto create mode 100644 src/libtracing/protos/perfetto/config/trace_config.proto create mode 100644 src/libtracing/protos/perfetto/config/track_event/track_event_config.proto create mode 100644 src/libtracing/protos/perfetto/ipc/OWNERS create mode 100644 src/libtracing/protos/perfetto/ipc/consumer_port.proto create mode 100644 src/libtracing/protos/perfetto/ipc/producer_port.proto create mode 100644 src/libtracing/protos/perfetto/ipc/relay_port.proto create mode 100644 src/libtracing/protos/perfetto/ipc/wire_protocol.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/OWNERS create mode 100644 src/libtracing/protos/perfetto/metrics/android/ad_services_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/android_blocking_call.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/android_blocking_calls_cuj_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/android_blocking_calls_unagg.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/android_boot.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/android_boot_unagg.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/android_frame_timeline_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/android_garbage_collection_unagg_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/android_sysui_notifications_blocking_calls_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/android_trusty_workqueues.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/anr_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/app_process_starts_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/batt_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/binder_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/camera_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/camera_unagg_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/codec_metrics.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/cpu_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/display_metrics.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/dma_heap_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/dvfs_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/fastrpc_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/g2d_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/gpu_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/hwcomposer.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/hwui_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/io_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/io_unagg_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/ion_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/irq_runtime_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/jank_cuj_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/java_heap_histogram.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/java_heap_stats.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/lmk_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/lmk_reason_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/mem_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/mem_unagg_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/monitor_contention_agg_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/monitor_contention_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/multiuser_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/network_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/other_traces.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/package_list.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/powrails_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/process_metadata.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/profiler_smaps.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/rt_runtime_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/simpleperf.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/startup_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/surfaceflinger.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/sysui_notif_shade_list_builder_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/sysui_slice_performance_statistical_data.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/sysui_update_notif_on_ui_mode_changed_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/task_names.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/thread_time_in_state_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/trace_quality.proto create mode 100644 src/libtracing/protos/perfetto/metrics/android/unsymbolized_frames.proto create mode 100644 src/libtracing/protos/perfetto/metrics/chrome/all_chrome_metrics.proto create mode 100644 src/libtracing/protos/perfetto/metrics/chrome/args_class_names.proto create mode 100644 src/libtracing/protos/perfetto/metrics/chrome/dropped_frames.proto create mode 100644 src/libtracing/protos/perfetto/metrics/chrome/frame_times.proto create mode 100644 src/libtracing/protos/perfetto/metrics/chrome/histogram_hashes.proto create mode 100644 src/libtracing/protos/perfetto/metrics/chrome/long_latency.proto create mode 100644 src/libtracing/protos/perfetto/metrics/chrome/media_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/chrome/performance_mark_hashes.proto create mode 100644 src/libtracing/protos/perfetto/metrics/chrome/reported_by_page.proto create mode 100644 src/libtracing/protos/perfetto/metrics/chrome/scroll_jank.proto create mode 100644 src/libtracing/protos/perfetto/metrics/chrome/scroll_jank_v3.proto create mode 100644 src/libtracing/protos/perfetto/metrics/chrome/slice_names.proto create mode 100644 src/libtracing/protos/perfetto/metrics/chrome/test_chrome_metric.proto create mode 100644 src/libtracing/protos/perfetto/metrics/chrome/touch_jank.proto create mode 100644 src/libtracing/protos/perfetto/metrics/chrome/unsymbolized_args.proto create mode 100644 src/libtracing/protos/perfetto/metrics/chrome/user_event_hashes.proto create mode 100644 src/libtracing/protos/perfetto/metrics/custom_options.proto create mode 100644 src/libtracing/protos/perfetto/metrics/metrics.proto create mode 100644 src/libtracing/protos/perfetto/metrics/perfetto_merged_metrics.proto create mode 100644 src/libtracing/protos/perfetto/metrics/webview/all_webview_metrics.proto create mode 100644 src/libtracing/protos/perfetto/metrics/webview/webview_jank_approximation.proto create mode 100644 src/libtracing/protos/perfetto/trace/android/android_game_intervention_list.proto create mode 100644 src/libtracing/protos/perfetto/trace/android/android_input_event.proto create mode 100644 src/libtracing/protos/perfetto/trace/android/android_log.proto create mode 100644 src/libtracing/protos/perfetto/trace/android/android_system_property.proto create mode 100644 src/libtracing/protos/perfetto/trace/android/camera_event.proto create mode 100644 src/libtracing/protos/perfetto/trace/android/frame_timeline_event.proto create mode 100644 src/libtracing/protos/perfetto/trace/android/gpu_mem_event.proto create mode 100644 src/libtracing/protos/perfetto/trace/android/graphics_frame_event.proto create mode 100644 src/libtracing/protos/perfetto/trace/android/initial_display_state.proto create mode 100644 src/libtracing/protos/perfetto/trace/android/network_trace.proto create mode 100644 src/libtracing/protos/perfetto/trace/android/packages_list.proto create mode 100644 src/libtracing/protos/perfetto/trace/android/protolog.proto create mode 100644 src/libtracing/protos/perfetto/trace/android/shell_transition.proto create mode 100644 src/libtracing/protos/perfetto/trace/android/surfaceflinger_common.proto create mode 100644 src/libtracing/protos/perfetto/trace/android/surfaceflinger_layers.proto create mode 100644 src/libtracing/protos/perfetto/trace/android/surfaceflinger_transactions.proto create mode 100644 src/libtracing/protos/perfetto/trace/android/winscope.proto create mode 100644 src/libtracing/protos/perfetto/trace/chrome/chrome_benchmark_metadata.proto create mode 100644 src/libtracing/protos/perfetto/trace/chrome/chrome_metadata.proto create mode 100644 src/libtracing/protos/perfetto/trace/chrome/chrome_trace_event.proto create mode 100644 src/libtracing/protos/perfetto/trace/chrome/chrome_trace_packet.proto create mode 100644 src/libtracing/protos/perfetto/trace/chrome/chrome_trigger.proto create mode 100644 src/libtracing/protos/perfetto/trace/chrome/v8.proto create mode 100644 src/libtracing/protos/perfetto/trace/clock_snapshot.proto create mode 100644 src/libtracing/protos/perfetto/trace/etw/all_protos.gni create mode 100644 src/libtracing/protos/perfetto/trace/etw/etw.proto create mode 100644 src/libtracing/protos/perfetto/trace/etw/etw_event.proto create mode 100644 src/libtracing/protos/perfetto/trace/etw/etw_event_bundle.proto create mode 100644 src/libtracing/protos/perfetto/trace/extension_descriptor.proto create mode 100644 src/libtracing/protos/perfetto/trace/filesystem/inode_file_map.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/all_protos.gni create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/android_fs.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/binder.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/block.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/cgroup.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/clk.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/cma.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/compaction.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/cpuhp.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/cros_ec.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/dma_fence.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/dmabuf_heap.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/dpu.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/drm.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/ext4.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/f2fs.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/fastrpc.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/fence.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/filemap.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/ftrace.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/ftrace_event.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/ftrace_event_bundle.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/ftrace_stats.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/g2d.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/generic.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/gpu_mem.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/gpu_scheduler.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/hyp.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/i2c.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/ion.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/ipi.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/irq.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/kfree.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/kmalloc.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/kmem.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/kvm.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/lowmemorykiller.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/lwis.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/mali.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/mdss.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/mm_event.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/net.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/oom.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/panel.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/perf_trace_counters.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/power.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/print.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/printk.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/raw_syscalls.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/regulator.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/rpm.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/samsung.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/sched.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/scm.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/sde.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/signal.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/skb.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/sock.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/sync.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/synthetic.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/systrace.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/task.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/tcp.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/test_bundle_wrapper.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/thermal.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/trusty.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/ufs.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/v4l2.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/virtio_gpu.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/virtio_video.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/vmscan.proto create mode 100644 src/libtracing/protos/perfetto/trace/ftrace/workqueue.proto create mode 100644 src/libtracing/protos/perfetto/trace/gpu/gpu_counter_event.proto create mode 100644 src/libtracing/protos/perfetto/trace/gpu/gpu_log.proto create mode 100644 src/libtracing/protos/perfetto/trace/gpu/gpu_render_stage_event.proto create mode 100644 src/libtracing/protos/perfetto/trace/gpu/vulkan_api_event.proto create mode 100644 src/libtracing/protos/perfetto/trace/gpu/vulkan_memory_event.proto create mode 100644 src/libtracing/protos/perfetto/trace/interned_data/interned_data.proto create mode 100644 src/libtracing/protos/perfetto/trace/memory_graph.proto create mode 100644 src/libtracing/protos/perfetto/trace/perfetto/perfetto_metatrace.proto create mode 100644 src/libtracing/protos/perfetto/trace/perfetto/tracing_service_event.proto create mode 100644 src/libtracing/protos/perfetto/trace/perfetto_trace.proto create mode 100644 src/libtracing/protos/perfetto/trace/power/android_energy_estimation_breakdown.proto create mode 100644 src/libtracing/protos/perfetto/trace/power/android_entity_state_residency.proto create mode 100644 src/libtracing/protos/perfetto/trace/power/battery_counters.proto create mode 100644 src/libtracing/protos/perfetto/trace/power/power_rails.proto create mode 100644 src/libtracing/protos/perfetto/trace/profiling/deobfuscation.proto create mode 100644 src/libtracing/protos/perfetto/trace/profiling/heap_graph.proto create mode 100644 src/libtracing/protos/perfetto/trace/profiling/profile_common.proto create mode 100644 src/libtracing/protos/perfetto/trace/profiling/profile_packet.proto create mode 100644 src/libtracing/protos/perfetto/trace/profiling/smaps.proto create mode 100644 src/libtracing/protos/perfetto/trace/ps/process_stats.proto create mode 100644 src/libtracing/protos/perfetto/trace/ps/process_tree.proto create mode 100644 src/libtracing/protos/perfetto/trace/remote_clock_sync.proto create mode 100644 src/libtracing/protos/perfetto/trace/statsd/statsd_atom.proto create mode 100644 src/libtracing/protos/perfetto/trace/sys_stats/sys_stats.proto create mode 100644 src/libtracing/protos/perfetto/trace/system_info.proto create mode 100644 src/libtracing/protos/perfetto/trace/system_info/cpu_info.proto create mode 100644 src/libtracing/protos/perfetto/trace/test_event.proto create mode 100644 src/libtracing/protos/perfetto/trace/test_extensions.proto create mode 100644 src/libtracing/protos/perfetto/trace/trace.proto create mode 100644 src/libtracing/protos/perfetto/trace/trace_packet.proto create mode 100644 src/libtracing/protos/perfetto/trace/trace_packet_defaults.proto create mode 100644 src/libtracing/protos/perfetto/trace/trace_uuid.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/chrome_active_processes.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/chrome_application_state_info.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/chrome_compositor_scheduler_state.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/chrome_content_settings_event_info.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/chrome_frame_reporter.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/chrome_histogram_sample.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/chrome_keyed_service.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/chrome_latency_info.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/chrome_legacy_ipc.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/chrome_message_pump.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/chrome_mojo_event_info.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/chrome_process_descriptor.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/chrome_renderer_scheduler_state.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/chrome_thread_descriptor.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/chrome_user_event.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/chrome_window_handle_event_info.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/counter_descriptor.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/debug_annotation.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/log_message.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/pixel_modem.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/process_descriptor.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/range_of_interest.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/screenshot.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/source_location.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/task_execution.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/thread_descriptor.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/track_descriptor.proto create mode 100644 src/libtracing/protos/perfetto/trace/track_event/track_event.proto create mode 100644 src/libtracing/protos/perfetto/trace/translation/translation_table.proto create mode 100644 src/libtracing/protos/perfetto/trace/trigger.proto create mode 100644 src/libtracing/protos/perfetto/trace/ui_state.proto create mode 100644 src/libtracing/protos/perfetto/trace_processor/metatrace_categories.proto create mode 100644 src/libtracing/protos/perfetto/trace_processor/metrics_impl.proto create mode 100644 src/libtracing/protos/perfetto/trace_processor/proto_files.gni create mode 100644 src/libtracing/protos/perfetto/trace_processor/serialization.proto create mode 100644 src/libtracing/protos/perfetto/trace_processor/stack.proto create mode 100644 src/libtracing/protos/perfetto/trace_processor/trace_processor.proto create mode 100644 src/libtracing/protos/third_party/CHROMIUM_OWNERS create mode 100644 src/libtracing/protos/third_party/OWNERS create mode 100644 src/libtracing/protos/third_party/chromium/chrome_track_event.proto create mode 100644 src/libtracing/protos/third_party/chromium/sources.gni create mode 100644 src/libtracing/protos/third_party/pprof/profile.proto create mode 100644 src/libtracing/protos/third_party/statsd/shell_config.proto create mode 100644 src/libtracing/protos/third_party/statsd/shell_data.proto create mode 100644 src/libtracing/protozero_src/copyable_ptr_unittest.cc create mode 100644 src/libtracing/protozero_src/field.cc create mode 100644 src/libtracing/protozero_src/filtering/filter_bytecode_common.h create mode 100644 src/libtracing/protozero_src/filtering/filter_bytecode_generator.cc create mode 100644 src/libtracing/protozero_src/filtering/filter_bytecode_generator.h create mode 100644 src/libtracing/protozero_src/filtering/filter_bytecode_generator_unittest.cc create mode 100644 src/libtracing/protozero_src/filtering/filter_bytecode_parser.cc create mode 100644 src/libtracing/protozero_src/filtering/filter_bytecode_parser.h create mode 100644 src/libtracing/protozero_src/filtering/filter_bytecode_parser_fuzzer.cc create mode 100644 src/libtracing/protozero_src/filtering/filter_bytecode_parser_unittest.cc create mode 100644 src/libtracing/protozero_src/filtering/filter_util.cc create mode 100644 src/libtracing/protozero_src/filtering/filter_util.h create mode 100644 src/libtracing/protozero_src/filtering/filter_util_unittest.cc create mode 100644 src/libtracing/protozero_src/filtering/message_filter.cc create mode 100644 src/libtracing/protozero_src/filtering/message_filter.h create mode 100644 src/libtracing/protozero_src/filtering/message_filter_benchmark.cc create mode 100644 src/libtracing/protozero_src/filtering/message_filter_fuzzer.cc create mode 100644 src/libtracing/protozero_src/filtering/message_filter_unittest.cc create mode 100644 src/libtracing/protozero_src/filtering/message_tokenizer.h create mode 100644 src/libtracing/protozero_src/filtering/message_tokenizer_unittest.cc create mode 100644 src/libtracing/protozero_src/filtering/string_filter.cc create mode 100644 src/libtracing/protozero_src/filtering/string_filter.h create mode 100644 src/libtracing/protozero_src/filtering/string_filter_benchmark.cc create mode 100644 src/libtracing/protozero_src/filtering/string_filter_unittest.cc create mode 100644 src/libtracing/protozero_src/gen_field_helpers.cc create mode 100644 src/libtracing/protozero_src/message.cc create mode 100644 src/libtracing/protozero_src/message_arena.cc create mode 100644 src/libtracing/protozero_src/message_arena_unittest.cc create mode 100644 src/libtracing/protozero_src/message_handle_unittest.cc create mode 100644 src/libtracing/protozero_src/message_unittest.cc create mode 100644 src/libtracing/protozero_src/packed_repeated_fields.cc create mode 100644 src/libtracing/protozero_src/proto_decoder.cc create mode 100644 src/libtracing/protozero_src/proto_decoder_fuzzer.cc create mode 100644 src/libtracing/protozero_src/proto_decoder_unittest.cc create mode 100644 src/libtracing/protozero_src/proto_ring_buffer.cc create mode 100644 src/libtracing/protozero_src/proto_ring_buffer_unittest.cc create mode 100644 src/libtracing/protozero_src/proto_utils_unittest.cc create mode 100644 src/libtracing/protozero_src/protoc_plugin/cppgen_plugin.cc create mode 100644 src/libtracing/protozero_src/protoc_plugin/protozero_c_plugin.cc create mode 100644 src/libtracing/protozero_src/protoc_plugin/protozero_plugin.cc create mode 100644 src/libtracing/protozero_src/scattered_heap_buffer.cc create mode 100644 src/libtracing/protozero_src/scattered_stream_null_delegate.cc create mode 100644 src/libtracing/protozero_src/scattered_stream_writer.cc create mode 100644 src/libtracing/protozero_src/scattered_stream_writer_unittest.cc create mode 100644 src/libtracing/protozero_src/static_buffer.cc create mode 100644 src/libtracing/protozero_src/test/cppgen_conformance_unittest.cc create mode 100644 src/libtracing/protozero_src/test/example_proto/extensions.proto create mode 100644 src/libtracing/protozero_src/test/example_proto/library.proto create mode 100644 src/libtracing/protozero_src/test/example_proto/library_internals/galaxies.proto create mode 100644 src/libtracing/protozero_src/test/example_proto/other_package/test_messages.proto create mode 100644 src/libtracing/protozero_src/test/example_proto/subpackage/test_messages.proto create mode 100644 src/libtracing/protozero_src/test/example_proto/test_messages.proto create mode 100644 src/libtracing/protozero_src/test/example_proto/upper_import.proto create mode 100644 src/libtracing/protozero_src/test/fake_scattered_buffer.cc create mode 100644 src/libtracing/protozero_src/test/fake_scattered_buffer.h create mode 100644 src/libtracing/protozero_src/test/proto_ring_buffer_benchmark.cc create mode 100644 src/libtracing/protozero_src/test/protozero_benchmark.cc create mode 100644 src/libtracing/protozero_src/test/protozero_conformance_unittest.cc create mode 100644 src/libtracing/protozero_src/virtual_destructors.cc diff --git a/src/libtracing/perfetto/base/BUILD.gn b/src/libtracing/perfetto/base/BUILD.gn new file mode 100644 index 000000000..357f89a0c --- /dev/null +++ b/src/libtracing/perfetto/base/BUILD.gn @@ -0,0 +1,33 @@ +# Copyright (C) 2017 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("../../../gn/perfetto.gni") + +source_set("base") { + sources = [ + "build_config.h", + "compiler.h", + "export.h", + "flat_set.h", + "logging.h", + "platform_handle.h", + "proc_utils.h", + "status.h", + "task_runner.h", + "template_util.h", + "thread_utils.h", + "time.h", + ] + public_deps = [ "../public:base" ] +} diff --git a/src/libtracing/perfetto/base/build_config.h b/src/libtracing/perfetto/base/build_config.h new file mode 100644 index 000000000..5f7a7bd96 --- /dev/null +++ b/src/libtracing/perfetto/base/build_config.h @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef INCLUDE_PERFETTO_BASE_BUILD_CONFIG_H_ +#define INCLUDE_PERFETTO_BASE_BUILD_CONFIG_H_ + +// Allows to define build flags that give a compiler error if the header that +// defined the flag is not included, instead of silently ignoring the #if block. +#define PERFETTO_BUILDFLAG_CAT_INDIRECT(a, b) a##b +#define PERFETTO_BUILDFLAG_CAT(a, b) PERFETTO_BUILDFLAG_CAT_INDIRECT(a, b) +#define PERFETTO_BUILDFLAG(flag) \ + (PERFETTO_BUILDFLAG_CAT(PERFETTO_BUILDFLAG_DEFINE_, flag)()) + +#if defined(__ANDROID__) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 1 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_IOS() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_NACL() 0 +#elif defined(__APPLE__) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 1 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_NACL() 0 +// Include TARGET_OS_IPHONE when on __APPLE__ systems. +#include +#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_IOS() 1 +#else +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 1 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_IOS() 0 +#endif +#elif defined(__linux__) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 1 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_IOS() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_NACL() 0 +#elif defined(_WIN32) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 1 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_IOS() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_NACL() 0 +#elif defined(__EMSCRIPTEN__) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_IOS() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 1 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_NACL() 0 +#elif defined(__Fuchsia__) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_IOS() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 1 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_NACL() 0 +#elif defined(__native_client__) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_IOS() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_NACL() 1 +#else +#error OS not supported (see build_config.h) +#endif + +#if defined(__clang__) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPILER_CLANG() 1 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPILER_GCC() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPILER_MSVC() 0 +#elif defined(__GNUC__) // Careful: Clang also defines this! +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPILER_CLANG() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPILER_GCC() 1 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPILER_MSVC() 0 +#elif defined(_MSC_VER) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPILER_CLANG() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPILER_GCC() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPILER_MSVC() 1 +#else +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPILER_CLANG() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPILER_GCC() 0 +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPILER_MSVC() 0 +#endif + +#if defined(PERFETTO_BUILD_WITH_ANDROID_USERDEBUG) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ANDROID_USERDEBUG_BUILD() 1 +#else +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ANDROID_USERDEBUG_BUILD() 0 +#endif + +// Processor architecture detection. For more info on what's defined, see: +// http://msdn.microsoft.com/en-us/library/b0084kay.aspx +// http://www.agner.org/optimize/calling_conventions.pdf +// or with gcc, run: "echo | gcc -E -dM -" +#if defined(__aarch64__) || defined(_M_ARM64) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ARCH_CPU_ARM64() 1 +#else +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ARCH_CPU_ARM64() 0 +#endif + +#if defined(__x86_64__) || defined(_M_X64) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ARCH_CPU_X86_64() 1 +#else +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ARCH_CPU_X86_64() 0 +#endif + +// perfetto_build_flags.h contains the tweakable build flags defined via GN. +// - In GN builds (e.g., standalone, chromium, v8) this file is generated at +// build time via the gen_rule //gn/gen_buildflags. +// - In Android in-tree builds, this file is generated by tools/gen_android_bp +// and checked in into include/perfetto/base/build_configs/android_tree/. The +// default cflags add this path to the default include path. +// - Similarly, in bazel builds, this file is generated by tools/gen_bazel and +// checked in into include/perfetto/base/build_configs/bazel/. +// - In amalgamated builds, this file is generated by tools/gen_amalgamated and +// added to the amalgamated headers. +#include "perfetto_build_flags.h" // no-include-violation-check + +#endif // INCLUDE_PERFETTO_BASE_BUILD_CONFIG_H_ diff --git a/src/libtracing/perfetto/base/build_configs/android_tree/perfetto_build_flags.h b/src/libtracing/perfetto/base/build_configs/android_tree/perfetto_build_flags.h new file mode 100644 index 000000000..c36d04b21 --- /dev/null +++ b/src/libtracing/perfetto/base/build_configs/android_tree/perfetto_build_flags.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by write_buildflag_header.py + +// fix_include_guards: off +#ifndef GEN_BUILD_CONFIG_PERFETTO_BUILD_FLAGS_H_ +#define GEN_BUILD_CONFIG_PERFETTO_BUILD_FLAGS_H_ + +// clang-format off +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ANDROID_BUILD() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_CHROMIUM_BUILD() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_STANDALONE_BUILD() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_START_DAEMONS() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_IPC() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_WATCHDOG() (PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() || PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX()) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPONENT_BUILD() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DLOG_ON() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DLOG_OFF() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DCHECK_ON() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DCHECK_OFF() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_VERBOSE_LOGS() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_VERSION_GEN() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_TP_PERCENTILE() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_TP_LINENOISE() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_TP_HTTPD() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_TP_JSON() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_LOCAL_SYMBOLIZER() (PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() || PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() ||PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN()) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ZLIB() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_TRACED_PERF() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_HEAPPROFD() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_STDERR_CRASH_DUMP() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_X64_CPU_OPT() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_LLVM_DEMANGLE() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_SYSTEM_CONSUMER() (1) + +// clang-format on +#endif // GEN_BUILD_CONFIG_PERFETTO_BUILD_FLAGS_H_ diff --git a/src/libtracing/perfetto/base/build_configs/bazel/perfetto_build_flags.h b/src/libtracing/perfetto/base/build_configs/bazel/perfetto_build_flags.h new file mode 100644 index 000000000..54fe273b6 --- /dev/null +++ b/src/libtracing/perfetto/base/build_configs/bazel/perfetto_build_flags.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Generated by write_buildflag_header.py + +// fix_include_guards: off +#ifndef GEN_BUILD_CONFIG_PERFETTO_BUILD_FLAGS_H_ +#define GEN_BUILD_CONFIG_PERFETTO_BUILD_FLAGS_H_ + +// clang-format off +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ANDROID_BUILD() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_CHROMIUM_BUILD() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_STANDALONE_BUILD() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_START_DAEMONS() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_IPC() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_WATCHDOG() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPONENT_BUILD() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DLOG_ON() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DLOG_OFF() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DCHECK_ON() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DCHECK_OFF() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_VERBOSE_LOGS() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_VERSION_GEN() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_TP_PERCENTILE() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_TP_LINENOISE() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_TP_HTTPD() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_TP_JSON() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_LOCAL_SYMBOLIZER() (PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() || PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() ||PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN()) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ZLIB() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_TRACED_PERF() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_HEAPPROFD() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_STDERR_CRASH_DUMP() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_X64_CPU_OPT() (0) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_LLVM_DEMANGLE() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_SYSTEM_CONSUMER() (1) + +// clang-format on +#endif // GEN_BUILD_CONFIG_PERFETTO_BUILD_FLAGS_H_ diff --git a/src/libtracing/perfetto/base/compiler.h b/src/libtracing/perfetto/base/compiler.h new file mode 100644 index 000000000..e4b6b0cae --- /dev/null +++ b/src/libtracing/perfetto/base/compiler.h @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef INCLUDE_PERFETTO_BASE_COMPILER_H_ +#define INCLUDE_PERFETTO_BASE_COMPILER_H_ + +#include +#include + +#include "perfetto/public/compiler.h" + +// __has_attribute is supported only by clang and recent versions of GCC. +// Add a layer to wrap the __has_attribute macro. +#if defined(__has_attribute) +#define PERFETTO_HAS_ATTRIBUTE(x) __has_attribute(x) +#else +#define PERFETTO_HAS_ATTRIBUTE(x) 0 +#endif + +#if defined(__GNUC__) || defined(__clang__) +#define PERFETTO_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) +#else +#define PERFETTO_WARN_UNUSED_RESULT +#endif + +#if defined(__GNUC__) || defined(__clang__) +#define PERFETTO_UNUSED __attribute__((unused)) +#else +#define PERFETTO_UNUSED +#endif + +#if defined(__clang__) +#define PERFETTO_ALWAYS_INLINE __attribute__((__always_inline__)) +#define PERFETTO_NO_INLINE __attribute__((__noinline__)) +#else +// GCC is too pedantic and often fails with the error: +// "always_inline function might not be inlinable" +#define PERFETTO_ALWAYS_INLINE +#define PERFETTO_NO_INLINE +#endif + +#if defined(__GNUC__) || defined(__clang__) +#define PERFETTO_NORETURN __attribute__((__noreturn__)) +#else +#define PERFETTO_NORETURN __declspec(noreturn) +#endif + +#if defined(__GNUC__) || defined(__clang__) +#define PERFETTO_DEBUG_FUNCTION_IDENTIFIER() __PRETTY_FUNCTION__ +#elif defined(_MSC_VER) +#define PERFETTO_DEBUG_FUNCTION_IDENTIFIER() __FUNCSIG__ +#else +#define PERFETTO_DEBUG_FUNCTION_IDENTIFIER() \ + static_assert(false, "Not implemented for this compiler") +#endif + +#if defined(__GNUC__) || defined(__clang__) +#define PERFETTO_PRINTF_FORMAT(x, y) \ + __attribute__((__format__(__printf__, x, y))) +#else +#define PERFETTO_PRINTF_FORMAT(x, y) +#endif + +#if defined(__GNUC__) || defined(__clang__) +#define PERFETTO_POPCOUNT(x) __builtin_popcountll(x) +#else +#include +#define PERFETTO_POPCOUNT(x) __popcnt64(x) +#endif + +#if defined(__clang__) +#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) +extern "C" void __asan_poison_memory_region(void const volatile*, size_t); +extern "C" void __asan_unpoison_memory_region(void const volatile*, size_t); +#define PERFETTO_ASAN_POISON(a, s) __asan_poison_memory_region((a), (s)) +#define PERFETTO_ASAN_UNPOISON(a, s) __asan_unpoison_memory_region((a), (s)) +#else +#define PERFETTO_ASAN_POISON(addr, size) +#define PERFETTO_ASAN_UNPOISON(addr, size) +#endif // __has_feature(address_sanitizer) +#else +#define PERFETTO_ASAN_POISON(addr, size) +#define PERFETTO_ASAN_UNPOISON(addr, size) +#endif // __clang__ + +#if defined(__GNUC__) || defined(__clang__) +#define PERFETTO_IS_LITTLE_ENDIAN() __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#else +// Assume all MSVC targets are little endian. +#define PERFETTO_IS_LITTLE_ENDIAN() 1 +#endif + +// This is used for exporting xxxMain() symbols (e.g., PerfettoCmdMain, +// ProbesMain) from libperfetto.so when the GN arg monolithic_binaries = false. +#if defined(__GNUC__) || defined(__clang__) +#define PERFETTO_EXPORT_ENTRYPOINT __attribute__((visibility("default"))) +#else +// TODO(primiano): on Windows this should be a pair of dllexport/dllimport. But +// that requires a -DXXX_IMPLEMENTATION depending on whether we are on the +// impl-site or call-site. Right now it's not worth the trouble as we +// force-export the xxxMain() symbols only on Android, where we pack all the +// code for N binaries into one .so to save binary size. On Windows we support +// only monolithic binaries, as they are easier to deal with. +#define PERFETTO_EXPORT_ENTRYPOINT +#endif + +// Disables thread safety analysis for functions where the compiler can't +// accurate figure out which locks are being held. +#if defined(__clang__) +#define PERFETTO_NO_THREAD_SAFETY_ANALYSIS \ + __attribute__((no_thread_safety_analysis)) +#else +#define PERFETTO_NO_THREAD_SAFETY_ANALYSIS +#endif + +// Disables undefined behavior analysis for a function. +#if defined(__clang__) +#define PERFETTO_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined"))) +#else +#define PERFETTO_NO_SANITIZE_UNDEFINED +#endif + +// Avoid calling the exit-time destructor on an object with static lifetime. +#if PERFETTO_HAS_ATTRIBUTE(no_destroy) +#define PERFETTO_HAS_NO_DESTROY() 1 +#define PERFETTO_NO_DESTROY __attribute__((no_destroy)) +#else +#define PERFETTO_HAS_NO_DESTROY() 0 +#define PERFETTO_NO_DESTROY +#endif + +// Macro for telling -Wimplicit-fallthrough that a fallthrough is intentional. +#define PERFETTO_FALLTHROUGH [[fallthrough]] + +namespace perfetto { +namespace base { + +template +inline void ignore_result(const T&...) {} + +} // namespace base +} // namespace perfetto + +#endif // INCLUDE_PERFETTO_BASE_COMPILER_H_ diff --git a/src/libtracing/perfetto/base/export.h b/src/libtracing/perfetto/base/export.h new file mode 100644 index 000000000..14044b37c --- /dev/null +++ b/src/libtracing/perfetto/base/export.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef INCLUDE_PERFETTO_BASE_EXPORT_H_ +#define INCLUDE_PERFETTO_BASE_EXPORT_H_ + +#include "perfetto/base/build_config.h" +#include "perfetto/public/abi/export.h" + +// PERFETTO_EXPORT_COMPONENT: Exports a symbol among C++ components when +// building with is_component = true (mostly used by chromium build). +#if PERFETTO_BUILDFLAG(PERFETTO_COMPONENT_BUILD) + +#if defined(PERFETTO_IMPLEMENTATION) +#define PERFETTO_EXPORT_COMPONENT PERFETTO_INTERNAL_DLL_EXPORT +#else +#define PERFETTO_EXPORT_COMPONENT PERFETTO_INTERNAL_DLL_IMPORT +#endif + +#else // !PERFETTO_BUILDFLAG(PERFETTO_COMPONENT_BUILD) + +#if !defined(PERFETTO_EXPORT_COMPONENT) +#define PERFETTO_EXPORT_COMPONENT +#endif // !defined(PERFETTO_EXPORT_COMPONENT) + +#endif // PERFETTO_BUILDFLAG(PERFETTO_COMPONENT_BUILD) + +#endif // INCLUDE_PERFETTO_BASE_EXPORT_H_ diff --git a/src/libtracing/perfetto/base/flat_set.h b/src/libtracing/perfetto/base/flat_set.h new file mode 100644 index 000000000..9390537b3 --- /dev/null +++ b/src/libtracing/perfetto/base/flat_set.h @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef INCLUDE_PERFETTO_BASE_FLAT_SET_H_ +#define INCLUDE_PERFETTO_BASE_FLAT_SET_H_ + +#include +#include + +// A vector-based set::set-like container. +// It's more cache friendly than std::*set and performs for cases where: +// 1. A high number of dupes is expected (e.g. pid tracking in ftrace). +// 2. The working set is small (hundreds of elements). + +// Performance characteristics (for uniformly random insertion order): +// - For smaller insertions (up to ~500), it outperforms both std::set and +// std::unordered_set by ~3x. +// - Up until 4k insertions, it is always faster than std::set. +// - unordered_set is faster with more than 2k insertions. +// - unordered_set, however, it's less memory efficient and has more caveats +// (see chromium's base/containers/README.md). +// +// See flat_set_benchmark.cc and the charts in go/perfetto-int-set-benchmark. + +namespace perfetto { +namespace base { + +template +class FlatSet { + public: + using value_type = T; + using const_pointer = const T*; + using iterator = typename std::vector::iterator; + using const_iterator = typename std::vector::const_iterator; + + FlatSet() = default; + + // Mainly for tests. Deliberately not marked as "explicit". + FlatSet(std::initializer_list initial) : entries_(initial) { + std::sort(entries_.begin(), entries_.end()); + entries_.erase(std::unique(entries_.begin(), entries_.end()), + entries_.end()); + } + + const_iterator find(T value) const { + auto entries_end = entries_.end(); + auto it = std::lower_bound(entries_.begin(), entries_end, value); + return (it != entries_end && *it == value) ? it : entries_end; + } + + size_t count(T value) const { return find(value) == entries_.end() ? 0 : 1; } + + std::pair insert(T value) { + auto entries_end = entries_.end(); + auto it = std::lower_bound(entries_.begin(), entries_end, value); + if (it != entries_end && *it == value) + return std::make_pair(it, false); + // If the value is not found |it| is either end() or the next item strictly + // greater than |value|. In both cases we want to insert just before that. + it = entries_.insert(it, std::move(value)); + return std::make_pair(it, true); + } + + size_t erase(T value) { + auto it = find(value); + if (it == entries_.end()) + return 0; + entries_.erase(it); + return 1; + } + + void clear() { entries_.clear(); } + + bool empty() const { return entries_.empty(); } + void reserve(size_t n) { entries_.reserve(n); } + size_t size() const { return entries_.size(); } + const_iterator begin() const { return entries_.begin(); } + const_iterator end() const { return entries_.end(); } + + private: + std::vector entries_; +}; + +} // namespace base +} // namespace perfetto + +#endif // INCLUDE_PERFETTO_BASE_FLAT_SET_H_ diff --git a/src/libtracing/perfetto/base/logging.h b/src/libtracing/perfetto/base/logging.h new file mode 100644 index 000000000..80420826f --- /dev/null +++ b/src/libtracing/perfetto/base/logging.h @@ -0,0 +1,248 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef INCLUDE_PERFETTO_BASE_LOGGING_H_ +#define INCLUDE_PERFETTO_BASE_LOGGING_H_ + +#include +#include // For strerror. + +#include "perfetto/base/build_config.h" +#include "perfetto/base/compiler.h" +#include "perfetto/base/export.h" + +#if defined(__GNUC__) || defined(__clang__) +// Ignore GCC warning about a missing argument for a variadic macro parameter. +#pragma GCC system_header +#endif + +#if PERFETTO_BUILDFLAG(PERFETTO_FORCE_DCHECK_ON) +#define PERFETTO_DCHECK_IS_ON() 1 +#elif PERFETTO_BUILDFLAG(PERFETTO_FORCE_DCHECK_OFF) +#define PERFETTO_DCHECK_IS_ON() 0 +#elif defined(DCHECK_ALWAYS_ON) || \ + (!defined(NDEBUG) && (PERFETTO_BUILDFLAG(PERFETTO_STANDALONE_BUILD) || \ + PERFETTO_BUILDFLAG(PERFETTO_CHROMIUM_BUILD) || \ + PERFETTO_BUILDFLAG(PERFETTO_ANDROID_BUILD))) +#define PERFETTO_DCHECK_IS_ON() 1 +#else +#define PERFETTO_DCHECK_IS_ON() 0 +#endif + +#if PERFETTO_BUILDFLAG(PERFETTO_FORCE_DLOG_ON) +#define PERFETTO_DLOG_IS_ON() 1 +#elif PERFETTO_BUILDFLAG(PERFETTO_FORCE_DLOG_OFF) +#define PERFETTO_DLOG_IS_ON() 0 +#else +#define PERFETTO_DLOG_IS_ON() PERFETTO_DCHECK_IS_ON() +#endif + +#if defined(PERFETTO_ANDROID_ASYNC_SAFE_LOG) +#if !PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \ + !PERFETTO_BUILDFLAG(PERFETTO_ANDROID_BUILD) +#error "Async-safe logging is limited to Android tree builds" +#endif +// For binaries which need a very lightweight logging implementation. +// Note that this header is incompatible with android/log.h. +#include +#elif PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) +// Normal android logging. +#include +#endif + +// Enable the "Print the most recent PERFETTO_LOG(s) before crashing" feature +// on Android in-tree builds and on standalone builds (mainly for testing). +// This is deliberately no PERFETTO_OS_ANDROID because we don't want this +// feature when perfetto is embedded in other Android projects (e.g. SDK). +// TODO(b/203795298): TFLite is using the client library in blaze builds and is +// targeting API 19. For now disable the feature based on API level. +#if defined(PERFETTO_ANDROID_ASYNC_SAFE_LOG) +#define PERFETTO_ENABLE_LOG_RING_BUFFER() 0 +#elif PERFETTO_BUILDFLAG(PERFETTO_ANDROID_BUILD) +#define PERFETTO_ENABLE_LOG_RING_BUFFER() 1 +#elif PERFETTO_BUILDFLAG(PERFETTO_STANDALONE_BUILD) && \ + (!PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \ + (defined(__ANDROID_API__) && __ANDROID_API__ >= 21)) +#define PERFETTO_ENABLE_LOG_RING_BUFFER() 0 +#else +#define PERFETTO_ENABLE_LOG_RING_BUFFER() 0 +#endif + +namespace perfetto { +namespace base { + +// Constexpr functions to extract basename(__FILE__), e.g.: ../foo/f.c -> f.c . +constexpr const char* StrEnd(const char* s) { + return *s ? StrEnd(s + 1) : s; +} + +constexpr const char* BasenameRecursive(const char* s, + const char* begin, + const char* end) { + return (*s == '/' && s < end) + ? (s + 1) + : ((s > begin) ? BasenameRecursive(s - 1, begin, end) : s); +} + +constexpr const char* Basename(const char* str) { + return BasenameRecursive(StrEnd(str), str, StrEnd(str)); +} + +enum LogLev { kLogDebug = 0, kLogInfo, kLogImportant, kLogError }; + +struct LogMessageCallbackArgs { + LogLev level; + int line; + const char* filename; + const char* message; +}; + +using LogMessageCallback = void (*)(LogMessageCallbackArgs); + +// This is not thread safe and must be called before using tracing from other +// threads. +PERFETTO_EXPORT_COMPONENT void SetLogMessageCallback( + LogMessageCallback callback); + +PERFETTO_EXPORT_COMPONENT void LogMessage(LogLev, + const char* fname, + int line, + const char* fmt, + ...) PERFETTO_PRINTF_FORMAT(4, 5); + +// This is defined in debug_crash_stack_trace.cc, but that is only linked in +// standalone && debug builds, see enable_perfetto_stderr_crash_dump in +// perfetto.gni. +PERFETTO_EXPORT_COMPONENT void EnableStacktraceOnCrashForDebug(); + +#if PERFETTO_ENABLE_LOG_RING_BUFFER() +// Gets a snapshot of the logs from the internal log ring buffer and: +// - On Android in-tree builds: Passes that to android_set_abort_message(). +// That will attach the logs to the crash report. +// - On standalone builds (all otther OSes) prints that on stderr. +// This function must called only once, right before inducing a crash (This is +// because android_set_abort_message() can only be called once). +PERFETTO_EXPORT_COMPONENT void MaybeSerializeLastLogsForCrashReporting(); +#else +inline void MaybeSerializeLastLogsForCrashReporting() {} +#endif + +#if defined(PERFETTO_ANDROID_ASYNC_SAFE_LOG) +#define PERFETTO_XLOG(level, fmt, ...) \ + do { \ + async_safe_format_log((ANDROID_LOG_DEBUG + level), "perfetto", \ + "%s:%d " fmt, ::perfetto::base::Basename(__FILE__), \ + __LINE__, ##__VA_ARGS__); \ + } while (0) +#elif defined(PERFETTO_DISABLE_LOG) +#define PERFETTO_XLOG(level, fmt, ...) ::perfetto::base::ignore_result(level, \ + fmt, ##__VA_ARGS__) +#else +#define PERFETTO_XLOG(level, fmt, ...) \ + ::perfetto::base::LogMessage(level, ::perfetto::base::Basename(__FILE__), \ + __LINE__, fmt, ##__VA_ARGS__) +#endif + +#if defined(_MSC_VER) +#define PERFETTO_IMMEDIATE_CRASH() \ + do { \ + ::perfetto::base::MaybeSerializeLastLogsForCrashReporting(); \ + __debugbreak(); \ + __assume(0); \ + } while (0) +#else +#define PERFETTO_IMMEDIATE_CRASH() \ + do { \ + ::perfetto::base::MaybeSerializeLastLogsForCrashReporting(); \ + __builtin_trap(); \ + __builtin_unreachable(); \ + } while (0) +#endif + +#if PERFETTO_BUILDFLAG(PERFETTO_VERBOSE_LOGS) +#define PERFETTO_LOG(fmt, ...) \ + PERFETTO_XLOG(::perfetto::base::kLogInfo, fmt, ##__VA_ARGS__) +#else // PERFETTO_BUILDFLAG(PERFETTO_VERBOSE_LOGS) +#define PERFETTO_LOG(...) ::perfetto::base::ignore_result(__VA_ARGS__) +#endif // PERFETTO_BUILDFLAG(PERFETTO_VERBOSE_LOGS) + +#define PERFETTO_ILOG(fmt, ...) \ + PERFETTO_XLOG(::perfetto::base::kLogImportant, fmt, ##__VA_ARGS__) +#define PERFETTO_ELOG(fmt, ...) \ + PERFETTO_XLOG(::perfetto::base::kLogError, fmt, ##__VA_ARGS__) +#define PERFETTO_FATAL(fmt, ...) \ + do { \ + PERFETTO_PLOG(fmt, ##__VA_ARGS__); \ + PERFETTO_IMMEDIATE_CRASH(); \ + } while (0) + +#if defined(__GNUC__) || defined(__clang__) +#define PERFETTO_PLOG(x, ...) \ + PERFETTO_ELOG(x " (errno: %d, %s)", ##__VA_ARGS__, errno, strerror(errno)) +#else +// MSVC expands __VA_ARGS__ in a different order. Give up, not worth it. +#define PERFETTO_PLOG PERFETTO_ELOG +#endif + +#define PERFETTO_CHECK(x) \ + do { \ + if (PERFETTO_UNLIKELY(!(x))) { \ + PERFETTO_PLOG("%s", "PERFETTO_CHECK(" #x ")"); \ + PERFETTO_IMMEDIATE_CRASH(); \ + } \ + } while (0) + +#if PERFETTO_DLOG_IS_ON() + +#define PERFETTO_DLOG(fmt, ...) \ + PERFETTO_XLOG(::perfetto::base::kLogDebug, fmt, ##__VA_ARGS__) + +#if defined(__GNUC__) || defined(__clang__) +#define PERFETTO_DPLOG(x, ...) \ + PERFETTO_DLOG(x " (errno: %d, %s)", ##__VA_ARGS__, errno, strerror(errno)) +#else +// MSVC expands __VA_ARGS__ in a different order. Give up, not worth it. +#define PERFETTO_DPLOG PERFETTO_DLOG +#endif + +#else // PERFETTO_DLOG_IS_ON() + +#define PERFETTO_DLOG(...) ::perfetto::base::ignore_result(__VA_ARGS__) +#define PERFETTO_DPLOG(...) ::perfetto::base::ignore_result(__VA_ARGS__) + +#endif // PERFETTO_DLOG_IS_ON() + +#if PERFETTO_DCHECK_IS_ON() + +#define PERFETTO_DCHECK(x) PERFETTO_CHECK(x) +#define PERFETTO_DFATAL(...) PERFETTO_FATAL(__VA_ARGS__) +#define PERFETTO_DFATAL_OR_ELOG(...) PERFETTO_DFATAL(__VA_ARGS__) + +#else // PERFETTO_DCHECK_IS_ON() + +#define PERFETTO_DCHECK(x) \ + do { \ + } while (false && (x)) + +#define PERFETTO_DFATAL(...) ::perfetto::base::ignore_result(__VA_ARGS__) +#define PERFETTO_DFATAL_OR_ELOG(...) PERFETTO_ELOG(__VA_ARGS__) + +#endif // PERFETTO_DCHECK_IS_ON() + +} // namespace base +} // namespace perfetto + +#endif // INCLUDE_PERFETTO_BASE_LOGGING_H_ diff --git a/src/libtracing/perfetto/base/platform_handle.h b/src/libtracing/perfetto/base/platform_handle.h new file mode 100644 index 000000000..88f6d5966 --- /dev/null +++ b/src/libtracing/perfetto/base/platform_handle.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef INCLUDE_PERFETTO_BASE_PLATFORM_HANDLE_H_ +#define INCLUDE_PERFETTO_BASE_PLATFORM_HANDLE_H_ + +#include + +#include "perfetto/base/build_config.h" + +namespace perfetto { +namespace base { + +// PlatformHandle should be used only for types that are HANDLE(s) in Windows. +// It should NOT be used to blanket-replace "int fd" in the codebase. +// Windows has two types of "handles", which, in UNIX-land, both map to int: +// 1. File handles returned by the posix-compatibility API like _open(). +// These are just int(s) and should stay such, because all the posix-like API +// in Windows.h take an int, not a HANDLE. +// 2. Handles returned by old-school WINAPI like CreateFile, CreateEvent etc. +// These are proper HANDLE(s). PlatformHandle should be used here. +// +// On Windows, sockets have their own type (SOCKET) which is neither a HANDLE +// nor an int. However Windows SOCKET(s) can have an event HANDLE attached +// to them (which in Perfetto is a PlatformHandle), and that can be used in +// WaitForMultipleObjects, hence in base::TaskRunner.AddFileDescriptorWatch(). +// On POSIX OSes, a SocketHandle is really just an int (a file descriptor). +#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) +// Windows.h typedefs HANDLE to void*, and SOCKET to uintptr_t. We use their +// types to avoid leaking Windows.h through our headers. +using PlatformHandle = void*; +using SocketHandle = uintptr_t; + +// On Windows both nullptr and 0xffff... (INVALID_HANDLE_VALUE) are invalid. +struct PlatformHandleChecker { + static inline bool IsValid(PlatformHandle h) { + return h && h != reinterpret_cast(-1); + } +}; +#else +using PlatformHandle = int; +using SocketHandle = int; +struct PlatformHandleChecker { + static inline bool IsValid(PlatformHandle h) { return h >= 0; } +}; +#endif + +// The definition of this lives in base/file_utils.cc (to avoid creating an +// extra build edge for a one liner). This is really an alias for close() (UNIX) +// CloseHandle() (Windows). THe indirection layer is just to avoid leaking +// system headers like Windows.h through perfetto headers. +// Thre return value is always UNIX-style: 0 on success, -1 on failure. +int ClosePlatformHandle(PlatformHandle); + +} // namespace base +} // namespace perfetto + +#endif // INCLUDE_PERFETTO_BASE_PLATFORM_HANDLE_H_ diff --git a/src/libtracing/perfetto/base/proc_utils.h b/src/libtracing/perfetto/base/proc_utils.h new file mode 100644 index 000000000..cb8e13a58 --- /dev/null +++ b/src/libtracing/perfetto/base/proc_utils.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef INCLUDE_PERFETTO_BASE_PROC_UTILS_H_ +#define INCLUDE_PERFETTO_BASE_PROC_UTILS_H_ + +#include + +#include "perfetto/base/build_config.h" + +#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) +extern "C" { +// Prototype extracted from the Windows SDK to avoid including windows.h. +__declspec(dllimport) unsigned long __stdcall GetCurrentProcessId(); +} +#elif PERFETTO_BUILDFLAG(PERFETTO_OS_FUCHSIA) +#include +#include +#else +#include +#endif + +namespace perfetto { +namespace base { + +#if PERFETTO_BUILDFLAG(PERFETTO_OS_FUCHSIA) +using PlatformProcessId = zx_handle_t; +inline PlatformProcessId GetProcessId() { + return zx_process_self(); +} +#elif PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) +using PlatformProcessId = uint64_t; +inline PlatformProcessId GetProcessId() { + return static_cast(GetCurrentProcessId()); +} +#else +using PlatformProcessId = pid_t; +inline PlatformProcessId GetProcessId() { + return getpid(); +} +#endif + +} // namespace base +} // namespace perfetto + +#endif // INCLUDE_PERFETTO_BASE_PROC_UTILS_H_ diff --git a/src/libtracing/perfetto/base/status.h b/src/libtracing/perfetto/base/status.h new file mode 100644 index 000000000..506bb6e61 --- /dev/null +++ b/src/libtracing/perfetto/base/status.h @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef INCLUDE_PERFETTO_BASE_STATUS_H_ +#define INCLUDE_PERFETTO_BASE_STATUS_H_ + +#include +#include +#include +#include + +#include "perfetto/base/compiler.h" +#include "perfetto/base/export.h" +#include "perfetto/base/logging.h" + +namespace perfetto { +namespace base { + +// Represents either the success or the failure message of a function. +// This can used as the return type of functions which would usually return an +// bool for success or int for errno but also wants to add some string context +// (ususally for logging). +// +// Similar to absl::Status, an optional "payload" can also be included with more +// context about the error. This allows passing additional metadata about the +// error (e.g. location of errors, potential mitigations etc). +class PERFETTO_EXPORT_COMPONENT Status { + public: + Status() : ok_(true) {} + explicit Status(std::string msg) : ok_(false), message_(std::move(msg)) { + PERFETTO_CHECK(!message_.empty()); + } + + // Copy operations. + Status(const Status&) = default; + Status& operator=(const Status&) = default; + + // Move operations. The moved-from state is valid but unspecified. + Status(Status&&) noexcept = default; + Status& operator=(Status&&) = default; + + bool ok() const { return ok_; } + + // When ok() is false this returns the error message. Returns the empty string + // otherwise. + const std::string& message() const { return message_; } + const char* c_message() const { return message_.c_str(); } + + ////////////////////////////////////////////////////////////////////////////// + // Payload Management APIs + ////////////////////////////////////////////////////////////////////////////// + + // Payloads can be attached to error statuses to provide additional context. + // + // Payloads are (key, value) pairs, where the key is a string acting as a + // unique "type URL" and the value is an opaque string. The "type URL" should + // be unique, follow the format of a URL and, ideally, documentation on how to + // interpret its associated data should be available. + // + // To attach a payload to a status object, call `Status::SetPayload()`. + // Similarly, to extract the payload from a status, call + // `Status::GetPayload()`. + // + // Note: the payload APIs are only meaningful to call when the status is an + // error. Otherwise, all methods are noops. + + // Gets the payload for the given |type_url| if one exists. + // + // Will always return std::nullopt if |ok()|. + std::optional GetPayload(std::string_view type_url) const; + + // Sets the payload for the given key. The key should + // + // Will always do nothing if |ok()|. + void SetPayload(std::string_view type_url, std::string value); + + // Erases the payload for the given string and returns true if the payload + // existed and was erased. + // + // Will always do nothing if |ok()|. + bool ErasePayload(std::string_view type_url); + + private: + struct Payload { + std::string type_url; + std::string payload; + }; + + bool ok_ = false; + std::string message_; + std::vector payloads_; +}; + +// Returns a status object which represents the Ok status. +inline Status OkStatus() { + return Status(); +} + +PERFETTO_PRINTF_FORMAT(1, 2) Status ErrStatus(const char* format, ...); + +} // namespace base +} // namespace perfetto + +#endif // INCLUDE_PERFETTO_BASE_STATUS_H_ diff --git a/src/libtracing/perfetto/base/task_runner.h b/src/libtracing/perfetto/base/task_runner.h new file mode 100644 index 000000000..653b0e655 --- /dev/null +++ b/src/libtracing/perfetto/base/task_runner.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef INCLUDE_PERFETTO_BASE_TASK_RUNNER_H_ +#define INCLUDE_PERFETTO_BASE_TASK_RUNNER_H_ + +#include + +#include + +#include "perfetto/base/export.h" +#include "perfetto/base/platform_handle.h" + +namespace perfetto { +namespace base { + +// A generic interface to allow the library clients to interleave the execution +// of the tracing internals in their runtime environment. +// The expectation is that all tasks, which are queued either via PostTask() or +// AddFileDescriptorWatch(), are executed on the same sequence (either on the +// same thread, or on a thread pool that gives sequencing guarantees). +// +// Tasks are never executed synchronously inside PostTask and there is a full +// memory barrier between tasks. +// +// All methods of this interface can be called from any thread. +class PERFETTO_EXPORT_COMPONENT TaskRunner { + public: + virtual ~TaskRunner(); + + // Schedule a task for immediate execution. Immediate tasks are always + // executed in the order they are posted. Can be called from any thread. + virtual void PostTask(std::function) = 0; + + // Schedule a task for execution after |delay_ms|. Note that there is no + // strict ordering guarantee between immediate and delayed tasks. Can be + // called from any thread. + virtual void PostDelayedTask(std::function, uint32_t delay_ms) = 0; + + // Schedule a task to run when the handle becomes readable. The same handle + // can only be monitored by one function. Note that this function only needs + // to be implemented on platforms where the built-in ipc framework is used. + // Can be called from any thread. + // TODO(skyostil): Refactor this out of the shared interface. + virtual void AddFileDescriptorWatch(PlatformHandle, + std::function) = 0; + + // Remove a previously scheduled watch for the handle. If this is run on the + // target thread of this TaskRunner, guarantees that the task registered to + // this handle will not be executed after this function call. + // Can be called from any thread. + virtual void RemoveFileDescriptorWatch(PlatformHandle) = 0; + + // Checks if the current thread is the same thread where the TaskRunner's task + // run. This allows single threaded task runners (like the ones used in + // perfetto) to inform the caller that anything posted will run on the same + // thread/sequence. This can allow some callers to skip PostTask and instead + // directly execute the code. Can be called from any thread. + virtual bool RunsTasksOnCurrentThread() const = 0; +}; + +} // namespace base +} // namespace perfetto + +#endif // INCLUDE_PERFETTO_BASE_TASK_RUNNER_H_ diff --git a/src/libtracing/perfetto/base/template_util.h b/src/libtracing/perfetto/base/template_util.h new file mode 100644 index 000000000..4a5359c20 --- /dev/null +++ b/src/libtracing/perfetto/base/template_util.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2021 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef INCLUDE_PERFETTO_BASE_TEMPLATE_UTIL_H_ +#define INCLUDE_PERFETTO_BASE_TEMPLATE_UTIL_H_ + +#include +#include + +namespace perfetto { +namespace base { + +// Helper to express preferences in an overload set. If more than one overload +// is available for a given set of parameters the overload with the higher +// priority will be chosen. +template +struct priority_tag : priority_tag {}; + +template <> +struct priority_tag<0> {}; + +// enable_if_t is an implementation of std::enable_if_t from C++14. +// +// Specification: +// https://en.cppreference.com/w/cpp/types/enable_if +template +using enable_if_t = typename std::enable_if::type; + +// decay_t is an implementation of std::decay_t from C++14. +// +// Specification: +// https://en.cppreference.com/w/cpp/types/decay +template +using decay_t = typename std::decay::type; + +// remove_cvref is an implementation of std::remove_cvref from +// C++20. +// +// Specification: +// https://en.cppreference.com/w/cpp/types/remove_cvref + +template +struct remove_cvref { + using type = typename std::remove_cv::type>::type>::type; +}; +template +using remove_cvref_t = typename remove_cvref::type; + +// Check if a given type is a specialization of a given template: +// is_specialization::value. + +template class Template> +struct is_specialization : std::false_type {}; + +template