From 4b949d66a6a7b09c56c3d870a5a7b3e615169ce6 Mon Sep 17 00:00:00 2001 From: Lalit Maganti Date: Mon, 3 Aug 2026 11:04:56 +0100 Subject: [PATCH 1/2] Fix --- Android.bp | 431 ----------------- BUILD | 345 -------------- BUILD.gn | 22 +- gn/perfetto_integrationtests.gni | 2 + include/perfetto/ext/traceconv/BUILD.gn | 17 - include/perfetto/ext/traceconv/traceconv.h | 28 -- infra/luci/recipes/perfetto.py | 3 - python/tools/cpu_profile.py | 47 +- python/tools/heap_profile.py | 55 +-- src/trace_processor/shell/BUILD.gn | 17 + .../shell/bundle_integrationtest.cc} | 23 +- src/traceconv/BUILD.gn | 43 +- src/traceconv/main.cc | 21 - src/traceconv/traceconv.cc | 445 ------------------ src/traceconv/wasm_main.cc | 263 +++++++++++ tools/cpu_profile | 131 +++--- tools/gen_android_bp | 6 +- tools/gen_bazel | 1 - tools/heap_profile | 139 +++--- .../release/package-github-release-artifacts | 3 - 20 files changed, 492 insertions(+), 1550 deletions(-) delete mode 100644 include/perfetto/ext/traceconv/BUILD.gn delete mode 100644 include/perfetto/ext/traceconv/traceconv.h rename src/{traceconv/traceconv_bundle_integrationtest.cc => trace_processor/shell/bundle_integrationtest.cc} (94%) delete mode 100644 src/traceconv/main.cc delete mode 100644 src/traceconv/traceconv.cc create mode 100644 src/traceconv/wasm_main.cc diff --git a/Android.bp b/Android.bp index 61295740cfe..ac1057aa773 100644 --- a/Android.bp +++ b/Android.bp @@ -2733,11 +2733,6 @@ filegroup { name: "perfetto_include_perfetto_ext_trace_processor_trace_processor_shell", } -// GN: //include/perfetto/ext/traceconv:traceconv -filegroup { - name: "perfetto_include_perfetto_ext_traceconv_traceconv", -} - // GN: //include/perfetto/ext/traced:sys_stats_counters filegroup { name: "perfetto_include_perfetto_ext_traced_sys_stats_counters", @@ -21908,14 +21903,6 @@ filegroup { ], } -// GN: //src/traceconv:main -filegroup { - name: "perfetto_src_traceconv_main", - srcs: [ - "src/traceconv/main.cc", - ], -} - // GN: //src/traceconv:pprofbuilder filegroup { name: "perfetto_src_traceconv_pprofbuilder", @@ -21924,14 +21911,6 @@ filegroup { ], } -// GN: //src/traceconv:traceconv_lib -filegroup { - name: "perfetto_src_traceconv_traceconv_lib", - srcs: [ - "src/traceconv/traceconv.cc", - ], -} - // GN: //src/traceconv:utils filegroup { name: "perfetto_src_traceconv_utils", @@ -25626,416 +25605,6 @@ cc_binary { min_sdk_version: "35", } -// GN: //src/traceconv:traceconv -cc_binary_host { - name: "traceconv", - srcs: [ - ":perfetto_base_default_platform", - ":perfetto_include_perfetto_base_base", - ":perfetto_include_perfetto_ext_base_base", - ":perfetto_include_perfetto_ext_base_regex", - ":perfetto_include_perfetto_ext_base_version", - ":perfetto_include_perfetto_ext_protozero_protozero", - ":perfetto_include_perfetto_ext_trace_processor_demangle", - ":perfetto_include_perfetto_ext_trace_processor_export_json", - ":perfetto_include_perfetto_ext_trace_processor_importers_memory_tracker_memory_tracker", - ":perfetto_include_perfetto_ext_traceconv_traceconv", - ":perfetto_include_perfetto_ext_traced_sys_stats_counters", - ":perfetto_include_perfetto_profiling_pprof_builder", - ":perfetto_include_perfetto_protozero_protozero", - ":perfetto_include_perfetto_public_abi_base", - ":perfetto_include_perfetto_public_base", - ":perfetto_include_perfetto_public_protozero", - ":perfetto_include_perfetto_trace_processor_basic_types", - ":perfetto_include_perfetto_trace_processor_io", - ":perfetto_include_perfetto_trace_processor_storage", - ":perfetto_include_perfetto_trace_processor_trace_processor", - ":perfetto_include_perfetto_trace_processor_util", - ":perfetto_protos_perfetto_common_cpp_gen", - ":perfetto_protos_perfetto_common_semantic_type_zero_gen", - ":perfetto_protos_perfetto_common_zero_gen", - ":perfetto_protos_perfetto_config_android_zero_gen", - ":perfetto_protos_perfetto_config_ftrace_zero_gen", - ":perfetto_protos_perfetto_config_gpu_zero_gen", - ":perfetto_protos_perfetto_config_inode_file_zero_gen", - ":perfetto_protos_perfetto_config_interceptors_zero_gen", - ":perfetto_protos_perfetto_config_linux_zero_gen", - ":perfetto_protos_perfetto_config_power_zero_gen", - ":perfetto_protos_perfetto_config_priority_boost_zero_gen", - ":perfetto_protos_perfetto_config_process_stats_zero_gen", - ":perfetto_protos_perfetto_config_profiling_zero_gen", - ":perfetto_protos_perfetto_config_protovm_zero_gen", - ":perfetto_protos_perfetto_config_qnx_zero_gen", - ":perfetto_protos_perfetto_config_statsd_zero_gen", - ":perfetto_protos_perfetto_config_sys_stats_zero_gen", - ":perfetto_protos_perfetto_config_system_info_zero_gen", - ":perfetto_protos_perfetto_config_track_event_zero_gen", - ":perfetto_protos_perfetto_config_zero_gen", - ":perfetto_protos_perfetto_perfetto_sql_zero_gen", - ":perfetto_protos_perfetto_protovm_cpp_gen", - ":perfetto_protos_perfetto_protovm_zero_gen", - ":perfetto_protos_perfetto_trace_android_zero_gen", - ":perfetto_protos_perfetto_trace_chrome_zero_gen", - ":perfetto_protos_perfetto_trace_etw_zero_gen", - ":perfetto_protos_perfetto_trace_field_options_zero_gen", - ":perfetto_protos_perfetto_trace_filesystem_zero_gen", - ":perfetto_protos_perfetto_trace_ftrace_zero_gen", - ":perfetto_protos_perfetto_trace_generic_kernel_zero_gen", - ":perfetto_protos_perfetto_trace_gpu_gpu_interned_data_zero_gen", - ":perfetto_protos_perfetto_trace_gpu_gpu_track_event_zero_gen", - ":perfetto_protos_perfetto_trace_gpu_zero_gen", - ":perfetto_protos_perfetto_trace_interned_data_zero_gen", - ":perfetto_protos_perfetto_trace_linux_zero_gen", - ":perfetto_protos_perfetto_trace_minimal_zero_gen", - ":perfetto_protos_perfetto_trace_non_minimal_zero_gen", - ":perfetto_protos_perfetto_trace_perfetto_zero_gen", - ":perfetto_protos_perfetto_trace_power_zero_gen", - ":perfetto_protos_perfetto_trace_processor_metrics_impl_zero_gen", - ":perfetto_protos_perfetto_trace_processor_zero_gen", - ":perfetto_protos_perfetto_trace_profiling_inline_callstack_zero_gen", - ":perfetto_protos_perfetto_trace_profiling_zero_gen", - ":perfetto_protos_perfetto_trace_ps_zero_gen", - ":perfetto_protos_perfetto_trace_statsd_zero_gen", - ":perfetto_protos_perfetto_trace_summary_zero_gen", - ":perfetto_protos_perfetto_trace_sys_stats_zero_gen", - ":perfetto_protos_perfetto_trace_system_info_zero_gen", - ":perfetto_protos_perfetto_trace_track_event_zero_gen", - ":perfetto_protos_perfetto_trace_translation_zero_gen", - ":perfetto_protos_third_party_android_art_art_heap_graph_zero_gen", - ":perfetto_protos_third_party_android_connectivity_connectivity_network_trace_zero_gen", - ":perfetto_protos_third_party_android_frameworks_base_proto_tracing_frameworks_base_interned_data_zero_gen", - ":perfetto_protos_third_party_android_frameworks_base_proto_tracing_frameworks_base_trace_packet_zero_gen", - ":perfetto_protos_third_party_android_frameworks_base_proto_tracing_frameworks_base_track_event_zero_gen", - ":perfetto_protos_third_party_android_frameworks_native_tracing_frameworks_native_interned_data_zero_gen", - ":perfetto_protos_third_party_android_frameworks_native_tracing_frameworks_native_trace_packet_zero_gen", - ":perfetto_protos_third_party_android_frameworks_native_tracing_winscope_winscope_extensions_zero_gen", - ":perfetto_protos_third_party_android_frameworks_native_tracing_winscope_winscope_regular_zero_gen", - ":perfetto_protos_third_party_android_packages_modules_bluetooth_tracing_bluetooth_tracing_zero_gen", - ":perfetto_protos_third_party_chromium_zero_gen", - ":perfetto_protos_third_party_pprof_zero_gen", - ":perfetto_protos_third_party_primes_cpp_gen", - ":perfetto_protos_third_party_primes_zero_gen", - ":perfetto_protos_third_party_simpleperf_zero_gen", - ":perfetto_src_base_base", - ":perfetto_src_base_check_cpu_optimizations", - ":perfetto_src_base_clock_snapshots", - ":perfetto_src_base_regex_regex", - ":perfetto_src_base_version", - ":perfetto_src_kernel_utils_kernel_wakelock_errors", - ":perfetto_src_kernel_utils_syscall_table", - ":perfetto_src_protovm_protovm", - ":perfetto_src_protozero_proto_ring_buffer", - ":perfetto_src_protozero_protozero", - ":perfetto_src_protozero_text_to_proto_text_to_proto", - ":perfetto_src_trace_processor_containers_containers", - ":perfetto_src_trace_processor_core_common_common", - ":perfetto_src_trace_processor_core_dataframe_dataframe", - ":perfetto_src_trace_processor_core_interpreter_interpreter", - ":perfetto_src_trace_processor_core_plugin_plugin", - ":perfetto_src_trace_processor_core_tree_tree", - ":perfetto_src_trace_processor_core_util_util", - ":perfetto_src_trace_processor_export_json", - ":perfetto_src_trace_processor_importers_android_bugreport_android_bugreport", - ":perfetto_src_trace_processor_importers_android_bugreport_android_dumpstate_event", - ":perfetto_src_trace_processor_importers_android_bugreport_android_log_event", - ":perfetto_src_trace_processor_importers_archive_archive", - ":perfetto_src_trace_processor_importers_art_hprof_art_hprof", - ":perfetto_src_trace_processor_importers_art_method_art_method", - ":perfetto_src_trace_processor_importers_art_method_art_method_event", - ":perfetto_src_trace_processor_importers_collapsed_stack_collapsed_stack", - ":perfetto_src_trace_processor_importers_common_common", - ":perfetto_src_trace_processor_importers_common_parser_types", - ":perfetto_src_trace_processor_importers_common_stats_tracker", - ":perfetto_src_trace_processor_importers_common_synthetic_tid_hdr", - ":perfetto_src_trace_processor_importers_common_v8_profile_parser", - ":perfetto_src_trace_processor_importers_etw_full", - ":perfetto_src_trace_processor_importers_etw_minimal", - ":perfetto_src_trace_processor_importers_ftrace_ftrace_descriptors", - ":perfetto_src_trace_processor_importers_ftrace_full", - ":perfetto_src_trace_processor_importers_ftrace_minimal", - ":perfetto_src_trace_processor_importers_fuchsia_fuchsia_record", - ":perfetto_src_trace_processor_importers_fuchsia_full", - ":perfetto_src_trace_processor_importers_fuchsia_minimal", - ":perfetto_src_trace_processor_importers_gecko_gecko", - ":perfetto_src_trace_processor_importers_gecko_gecko_event", - ":perfetto_src_trace_processor_importers_generic_kernel_full", - ":perfetto_src_trace_processor_importers_i2c_full", - ":perfetto_src_trace_processor_importers_json_json", - ":perfetto_src_trace_processor_importers_memory_tracker_graph_processor", - ":perfetto_src_trace_processor_importers_ninja_ninja", - ":perfetto_src_trace_processor_importers_perf_perf", - ":perfetto_src_trace_processor_importers_perf_record", - ":perfetto_src_trace_processor_importers_pprof_pprof", - ":perfetto_src_trace_processor_importers_primes_primes", - ":perfetto_src_trace_processor_importers_proto_full", - ":perfetto_src_trace_processor_importers_proto_minimal", - ":perfetto_src_trace_processor_importers_proto_packet_sequence_state_generation_hdr", - ":perfetto_src_trace_processor_importers_proto_proto_importer_module", - ":perfetto_src_trace_processor_importers_simpleperf_proto_simpleperf_proto", - ":perfetto_src_trace_processor_importers_syscalls_full", - ":perfetto_src_trace_processor_importers_systrace_full", - ":perfetto_src_trace_processor_importers_systrace_systrace_line", - ":perfetto_src_trace_processor_importers_systrace_systrace_parser", - ":perfetto_src_trace_processor_io", - ":perfetto_src_trace_processor_lib", - ":perfetto_src_trace_processor_metatrace", - ":perfetto_src_trace_processor_metrics_metrics", - ":perfetto_src_trace_processor_perfetto_sql_engine_engine", - ":perfetto_src_trace_processor_perfetto_sql_generator_generator", - ":perfetto_src_trace_processor_perfetto_sql_intrinsics_types_types", - ":perfetto_src_trace_processor_perfetto_sql_parser_intrinsic_macro_expansion", - ":perfetto_src_trace_processor_perfetto_sql_parser_parser", - ":perfetto_src_trace_processor_perfetto_sql_syntaqlite_syntaqlite", - ":perfetto_src_trace_processor_perfetto_sql_tokenizer_tokenizer", - ":perfetto_src_trace_processor_plugins_ancestor_ancestor", - ":perfetto_src_trace_processor_plugins_android_framework_track_event_android_framework_track_event", - ":perfetto_src_trace_processor_plugins_args_args", - ":perfetto_src_trace_processor_plugins_art_heap_graph_functions_art_heap_graph_functions", - ":perfetto_src_trace_processor_plugins_art_process_metadata_importer_art_process_metadata_importer", - ":perfetto_src_trace_processor_plugins_base64_functions_base64_functions", - ":perfetto_src_trace_processor_plugins_connected_flow_connected_flow", - ":perfetto_src_trace_processor_plugins_core_functions_core_functions", - ":perfetto_src_trace_processor_plugins_counter_intervals_counter_intervals", - ":perfetto_src_trace_processor_plugins_counter_mipmap_operator_counter_mipmap_operator", - ":perfetto_src_trace_processor_plugins_create_function_create_function", - ":perfetto_src_trace_processor_plugins_create_intervals_create_intervals", - ":perfetto_src_trace_processor_plugins_create_view_function_create_view_function", - ":perfetto_src_trace_processor_plugins_critical_path_critical_path", - ":perfetto_src_trace_processor_plugins_descendant_descendant", - ":perfetto_src_trace_processor_plugins_developer_functions_developer_functions", - ":perfetto_src_trace_processor_plugins_dfs_weight_bounded_dfs_weight_bounded", - ":perfetto_src_trace_processor_plugins_dominator_tree_dominator_tree", - ":perfetto_src_trace_processor_plugins_etm_decode_chunk_etm_decode_chunk", - ":perfetto_src_trace_processor_plugins_etm_iterate_range_etm_iterate_range", - ":perfetto_src_trace_processor_plugins_experimental_annotated_stack_experimental_annotated_stack", - ":perfetto_src_trace_processor_plugins_experimental_flamegraph_experimental_flamegraph", - ":perfetto_src_trace_processor_plugins_experimental_flat_slice_experimental_flat_slice", - ":perfetto_src_trace_processor_plugins_experimental_slice_layout_experimental_slice_layout", - ":perfetto_src_trace_processor_plugins_graph_scan_graph_scan", - ":perfetto_src_trace_processor_plugins_graph_traversal_graph_traversal", - ":perfetto_src_trace_processor_plugins_import_import", - ":perfetto_src_trace_processor_plugins_interval_intersect_interval_intersect", - ":perfetto_src_trace_processor_plugins_layout_functions_layout_functions", - ":perfetto_src_trace_processor_plugins_math_functions_math_functions", - ":perfetto_src_trace_processor_plugins_metadata_metadata", - ":perfetto_src_trace_processor_plugins_package_lookup_package_lookup", - ":perfetto_src_trace_processor_plugins_perf_counter_perf_counter", - ":perfetto_src_trace_processor_plugins_perf_text_perf_text", - ":perfetto_src_trace_processor_plugins_perfetto_manifest_perfetto_manifest", - ":perfetto_src_trace_processor_plugins_pprof_functions_pprof_functions", - ":perfetto_src_trace_processor_plugins_slice_mipmap_operator_slice_mipmap_operator", - ":perfetto_src_trace_processor_plugins_span_join_operator_span_join_operator", - ":perfetto_src_trace_processor_plugins_sql_stats_table_sql_stats_table", - ":perfetto_src_trace_processor_plugins_stack_functions_stack_functions", - ":perfetto_src_trace_processor_plugins_stack_sample_importer_stack_sample_importer", - ":perfetto_src_trace_processor_plugins_stdlib_docs_stdlib_docs", - ":perfetto_src_trace_processor_plugins_storage_tables_storage_tables", - ":perfetto_src_trace_processor_plugins_strace_strace", - ":perfetto_src_trace_processor_plugins_string_functions_string_functions", - ":perfetto_src_trace_processor_plugins_structural_tree_partition_structural_tree_partition", - ":perfetto_src_trace_processor_plugins_symbolize_symbolize", - ":perfetto_src_trace_processor_plugins_table_info_table_info", - ":perfetto_src_trace_processor_plugins_table_pointer_module_table_pointer_module", - ":perfetto_src_trace_processor_plugins_time_functions_time_functions", - ":perfetto_src_trace_processor_plugins_to_ftrace_to_ftrace", - ":perfetto_src_trace_processor_plugins_trace_export_trace_export", - ":perfetto_src_trace_processor_plugins_tree_functions_tree_functions", - ":perfetto_src_trace_processor_plugins_type_builder_functions_type_builder_functions", - ":perfetto_src_trace_processor_plugins_utils_functions_utils_functions", - ":perfetto_src_trace_processor_plugins_video_frame_importer_video_frame_importer", - ":perfetto_src_trace_processor_plugins_wattson_wattson", - ":perfetto_src_trace_processor_plugins_window_operator_window_operator", - ":perfetto_src_trace_processor_plugins_winscope_importer_winscope_importer", - ":perfetto_src_trace_processor_plugins_winscope_proto_to_args_with_defaults_winscope_proto_to_args_with_defaults", - ":perfetto_src_trace_processor_plugins_winscope_surfaceflinger_hierarchy_paths_winscope_surfaceflinger_hierarchy_paths", - ":perfetto_src_trace_processor_plugins_zstd_functions_zstd_functions", - ":perfetto_src_trace_processor_sorter_sorter", - ":perfetto_src_trace_processor_sqlite_bindings_bindings", - ":perfetto_src_trace_processor_sqlite_sqlite", - ":perfetto_src_trace_processor_storage_minimal", - ":perfetto_src_trace_processor_storage_storage", - ":perfetto_src_trace_processor_tables_tables", - ":perfetto_src_trace_processor_trace_summary_trace_summary", - ":perfetto_src_trace_processor_types_types", - ":perfetto_src_trace_processor_util_args_utils", - ":perfetto_src_trace_processor_util_blob", - ":perfetto_src_trace_processor_util_build_id", - ":perfetto_src_trace_processor_util_bump_allocator", - ":perfetto_src_trace_processor_util_clock", - ":perfetto_src_trace_processor_util_compressor", - ":perfetto_src_trace_processor_util_decompressor", - ":perfetto_src_trace_processor_util_deobfuscation_deobfuscator", - ":perfetto_src_trace_processor_util_descriptors", - ":perfetto_src_trace_processor_util_elf_elf", - ":perfetto_src_trace_processor_util_flatbuffer_reader", - ":perfetto_src_trace_processor_util_flatbuffer_writer", - ":perfetto_src_trace_processor_util_galloping_search", - ":perfetto_src_trace_processor_util_glob", - ":perfetto_src_trace_processor_util_interned_message_view", - ":perfetto_src_trace_processor_util_json_args", - ":perfetto_src_trace_processor_util_json_parser", - ":perfetto_src_trace_processor_util_json_serializer", - ":perfetto_src_trace_processor_util_json_value", - ":perfetto_src_trace_processor_util_owned_sql_value", - ":perfetto_src_trace_processor_util_profile_builder", - ":perfetto_src_trace_processor_util_profiler_util", - ":perfetto_src_trace_processor_util_proto_profiler", - ":perfetto_src_trace_processor_util_proto_to_args_parser", - ":perfetto_src_trace_processor_util_protozero_to_json", - ":perfetto_src_trace_processor_util_protozero_to_text", - ":perfetto_src_trace_processor_util_simple_json_parser", - ":perfetto_src_trace_processor_util_simple_json_serializer", - ":perfetto_src_trace_processor_util_sql_argument", - ":perfetto_src_trace_processor_util_sql_bundle", - ":perfetto_src_trace_processor_util_sql_module_doc_parser", - ":perfetto_src_trace_processor_util_stdlib", - ":perfetto_src_trace_processor_util_symbolizer_symbolize_database", - ":perfetto_src_trace_processor_util_symbolizer_symbolizer", - ":perfetto_src_trace_processor_util_tar_writer", - ":perfetto_src_trace_processor_util_trace_blob_view_reader", - ":perfetto_src_trace_processor_util_trace_enrichment_trace_enrichment", - ":perfetto_src_trace_processor_util_trace_type", - ":perfetto_src_trace_processor_util_zip_reader", - ":perfetto_src_traceconv_lib", - ":perfetto_src_traceconv_main", - ":perfetto_src_traceconv_pprofbuilder", - ":perfetto_src_traceconv_traceconv_lib", - ":perfetto_src_traceconv_utils", - ], - static_libs: [ - "libpcre2", - "libsqlite_static_noicu", - "libz", - "libzstd", - "perfetto_src_trace_processor_demangle", - "sqlite_ext_percentile", - ], - generated_headers: [ - "perfetto_protos_perfetto_common_cpp_gen_headers", - "perfetto_protos_perfetto_common_semantic_type_zero_gen_headers", - "perfetto_protos_perfetto_common_zero_gen_headers", - "perfetto_protos_perfetto_config_android_zero_gen_headers", - "perfetto_protos_perfetto_config_ftrace_zero_gen_headers", - "perfetto_protos_perfetto_config_gpu_zero_gen_headers", - "perfetto_protos_perfetto_config_inode_file_zero_gen_headers", - "perfetto_protos_perfetto_config_interceptors_zero_gen_headers", - "perfetto_protos_perfetto_config_linux_zero_gen_headers", - "perfetto_protos_perfetto_config_power_zero_gen_headers", - "perfetto_protos_perfetto_config_priority_boost_zero_gen_headers", - "perfetto_protos_perfetto_config_process_stats_zero_gen_headers", - "perfetto_protos_perfetto_config_profiling_zero_gen_headers", - "perfetto_protos_perfetto_config_protovm_zero_gen_headers", - "perfetto_protos_perfetto_config_qnx_zero_gen_headers", - "perfetto_protos_perfetto_config_statsd_zero_gen_headers", - "perfetto_protos_perfetto_config_sys_stats_zero_gen_headers", - "perfetto_protos_perfetto_config_system_info_zero_gen_headers", - "perfetto_protos_perfetto_config_track_event_zero_gen_headers", - "perfetto_protos_perfetto_config_zero_gen_headers", - "perfetto_protos_perfetto_perfetto_sql_zero_gen_headers", - "perfetto_protos_perfetto_protovm_cpp_gen_headers", - "perfetto_protos_perfetto_protovm_zero_gen_headers", - "perfetto_protos_perfetto_trace_android_zero_gen_headers", - "perfetto_protos_perfetto_trace_chrome_zero_gen_headers", - "perfetto_protos_perfetto_trace_etw_zero_gen_headers", - "perfetto_protos_perfetto_trace_field_options_zero_gen_headers", - "perfetto_protos_perfetto_trace_filesystem_zero_gen_headers", - "perfetto_protos_perfetto_trace_ftrace_zero_gen_headers", - "perfetto_protos_perfetto_trace_generic_kernel_zero_gen_headers", - "perfetto_protos_perfetto_trace_gpu_gpu_interned_data_zero_gen_headers", - "perfetto_protos_perfetto_trace_gpu_gpu_track_event_zero_gen_headers", - "perfetto_protos_perfetto_trace_gpu_zero_gen_headers", - "perfetto_protos_perfetto_trace_interned_data_zero_gen_headers", - "perfetto_protos_perfetto_trace_linux_zero_gen_headers", - "perfetto_protos_perfetto_trace_minimal_zero_gen_headers", - "perfetto_protos_perfetto_trace_non_minimal_zero_gen_headers", - "perfetto_protos_perfetto_trace_perfetto_zero_gen_headers", - "perfetto_protos_perfetto_trace_power_zero_gen_headers", - "perfetto_protos_perfetto_trace_processor_metrics_impl_zero_gen_headers", - "perfetto_protos_perfetto_trace_processor_zero_gen_headers", - "perfetto_protos_perfetto_trace_profiling_inline_callstack_zero_gen_headers", - "perfetto_protos_perfetto_trace_profiling_zero_gen_headers", - "perfetto_protos_perfetto_trace_ps_zero_gen_headers", - "perfetto_protos_perfetto_trace_statsd_zero_gen_headers", - "perfetto_protos_perfetto_trace_summary_zero_gen_headers", - "perfetto_protos_perfetto_trace_sys_stats_zero_gen_headers", - "perfetto_protos_perfetto_trace_system_info_zero_gen_headers", - "perfetto_protos_perfetto_trace_track_event_zero_gen_headers", - "perfetto_protos_perfetto_trace_translation_zero_gen_headers", - "perfetto_protos_third_party_android_art_art_heap_graph_zero_gen_headers", - "perfetto_protos_third_party_android_connectivity_connectivity_network_trace_zero_gen_headers", - "perfetto_protos_third_party_android_frameworks_base_proto_tracing_frameworks_base_interned_data_zero_gen_headers", - "perfetto_protos_third_party_android_frameworks_base_proto_tracing_frameworks_base_trace_packet_zero_gen_headers", - "perfetto_protos_third_party_android_frameworks_base_proto_tracing_frameworks_base_track_event_zero_gen_headers", - "perfetto_protos_third_party_android_frameworks_native_tracing_frameworks_native_interned_data_zero_gen_headers", - "perfetto_protos_third_party_android_frameworks_native_tracing_frameworks_native_trace_packet_zero_gen_headers", - "perfetto_protos_third_party_android_frameworks_native_tracing_winscope_winscope_extensions_zero_gen_headers", - "perfetto_protos_third_party_android_frameworks_native_tracing_winscope_winscope_regular_zero_gen_headers", - "perfetto_protos_third_party_android_packages_modules_bluetooth_tracing_bluetooth_tracing_zero_gen_headers", - "perfetto_protos_third_party_chromium_zero_gen_headers", - "perfetto_protos_third_party_pprof_zero_gen_headers", - "perfetto_protos_third_party_primes_cpp_gen_headers", - "perfetto_protos_third_party_primes_zero_gen_headers", - "perfetto_protos_third_party_simpleperf_zero_gen_headers", - "perfetto_src_base_version_gen_h", - "perfetto_src_trace_processor_importers_proto_gen_cc_android_extension_descriptor", - "perfetto_src_trace_processor_importers_proto_gen_cc_chrome_track_event_descriptor", - "perfetto_src_trace_processor_importers_proto_gen_cc_gpu_interned_data_descriptor", - "perfetto_src_trace_processor_importers_proto_gen_cc_gpu_track_event_descriptor", - "perfetto_src_trace_processor_importers_proto_gen_cc_statsd_atoms_descriptor", - "perfetto_src_trace_processor_importers_proto_gen_cc_trace_descriptor", - "perfetto_src_trace_processor_importers_proto_gen_cc_track_event_descriptor", - "perfetto_src_trace_processor_metrics_gen_cc_all_chrome_metrics_descriptor", - "perfetto_src_trace_processor_metrics_gen_cc_all_webview_metrics_descriptor", - "perfetto_src_trace_processor_metrics_gen_cc_metrics_descriptor", - "perfetto_src_trace_processor_metrics_sql_gen_amalgamated_sql_metrics", - "perfetto_src_trace_processor_perfetto_sql_stdlib_stdlib", - "perfetto_src_trace_processor_plugins_ancestor_tables", - "perfetto_src_trace_processor_plugins_android_framework_track_event_tables", - "perfetto_src_trace_processor_plugins_connected_flow_tables", - "perfetto_src_trace_processor_plugins_critical_path_tables", - "perfetto_src_trace_processor_plugins_developer_functions_tables", - "perfetto_src_trace_processor_plugins_dfs_weight_bounded_tables", - "perfetto_src_trace_processor_plugins_dominator_tree_tables", - "perfetto_src_trace_processor_plugins_experimental_annotated_stack_tables", - "perfetto_src_trace_processor_plugins_experimental_flat_slice_tables", - "perfetto_src_trace_processor_plugins_experimental_slice_layout_tables", - "perfetto_src_trace_processor_plugins_graph_traversal_tables", - "perfetto_src_trace_processor_plugins_stdlib_docs_tables", - "perfetto_src_trace_processor_plugins_structural_tree_partition_tables", - "perfetto_src_trace_processor_plugins_table_info_tables", - "perfetto_src_trace_processor_plugins_video_frame_importer_tables", - "perfetto_src_trace_processor_plugins_wattson_gen_cpu_1d_curves", - "perfetto_src_trace_processor_plugins_wattson_gen_cpu_2d_curves", - "perfetto_src_trace_processor_plugins_wattson_gen_gpu_curves", - "perfetto_src_trace_processor_plugins_wattson_gen_l3_curves", - "perfetto_src_trace_processor_plugins_wattson_gen_tpu_curves", - "perfetto_src_trace_processor_plugins_winscope_proto_to_args_with_defaults_tables", - "perfetto_src_trace_processor_plugins_winscope_surfaceflinger_hierarchy_paths_tables", - "perfetto_src_trace_processor_tables_tables_python", - "perfetto_src_trace_processor_trace_summary_gen_cc_trace_summary_descriptor", - "perfetto_src_traceconv_gen_cc_android_extension_descriptor", - "perfetto_src_traceconv_gen_cc_trace_descriptor", - ], - defaults: [ - "perfetto_defaults", - ], - cflags: [ - "-DZLIB_IMPLEMENTATION", - ], - target: { - android: { - static_libs: [ - "perfetto_flags_c_lib", - ], - }, - musl: { - static_libs: [ - "libfts", - ], - }, - }, -} - // GN: //src/traced/service:traced cc_binary { name: "traced", diff --git a/BUILD b/BUILD index 39854f42a97..5418349e773 100644 --- a/BUILD +++ b/BUILD @@ -1528,14 +1528,6 @@ perfetto_filegroup( ], ) -# GN target: //include/perfetto/ext/traceconv:traceconv -perfetto_filegroup( - name = "include_perfetto_ext_traceconv_traceconv", - srcs = [ - "include/perfetto/ext/traceconv/traceconv.h", - ], -) - # GN target: //include/perfetto/ext/traced:sys_stats_counters perfetto_filegroup( name = "include_perfetto_ext_traced_sys_stats_counters", @@ -6319,14 +6311,6 @@ perfetto_filegroup( ], ) -# GN target: //src/traceconv:main -perfetto_filegroup( - name = "src_traceconv_main", - srcs = [ - "src/traceconv/main.cc", - ], -) - # GN target: //src/traceconv:pprofbuilder perfetto_filegroup( name = "src_traceconv_pprofbuilder", @@ -6335,14 +6319,6 @@ perfetto_filegroup( ], ) -# GN target: //src/traceconv:traceconv_lib -perfetto_filegroup( - name = "src_traceconv_traceconv_lib", - srcs = [ - "src/traceconv/traceconv.cc", - ], -) - # GN target: //src/traceconv:utils perfetto_filegroup( name = "src_traceconv_utils", @@ -11805,327 +11781,6 @@ perfetto_cc_binary( ], ) -# GN target: //src/traceconv:traceconv -perfetto_cc_binary( - name = "traceconv", - srcs = [ - ":include_perfetto_base_base", - ":include_perfetto_ext_base_base", - ":include_perfetto_ext_protozero_protozero", - ":include_perfetto_ext_trace_processor_demangle", - ":include_perfetto_ext_trace_processor_export_json", - ":include_perfetto_ext_trace_processor_importers_memory_tracker_memory_tracker", - ":include_perfetto_ext_traceconv_traceconv", - ":include_perfetto_ext_traced_sys_stats_counters", - ":include_perfetto_profiling_pprof_builder", - ":include_perfetto_protozero_protozero", - ":include_perfetto_public_abi_base", - ":include_perfetto_public_base", - ":include_perfetto_public_protozero", - ":include_perfetto_trace_processor_basic_types", - ":include_perfetto_trace_processor_io", - ":include_perfetto_trace_processor_storage", - ":include_perfetto_trace_processor_trace_processor", - ":include_perfetto_trace_processor_util", - ":src_kernel_utils_kernel_wakelock_errors", - ":src_kernel_utils_syscall_table", - ":src_protozero_proto_ring_buffer", - ":src_protozero_text_to_proto_text_to_proto", - ":src_trace_processor_core_common_common", - ":src_trace_processor_core_dataframe_dataframe", - ":src_trace_processor_core_interpreter_interpreter", - ":src_trace_processor_core_plugin_plugin", - ":src_trace_processor_core_tree_tree", - ":src_trace_processor_core_util_util", - ":src_trace_processor_export_json", - ":src_trace_processor_importers_android_bugreport_android_bugreport", - ":src_trace_processor_importers_android_bugreport_android_dumpstate_event", - ":src_trace_processor_importers_android_bugreport_android_log_event", - ":src_trace_processor_importers_archive_archive", - ":src_trace_processor_importers_art_hprof_art_hprof", - ":src_trace_processor_importers_art_method_art_method", - ":src_trace_processor_importers_art_method_art_method_event", - ":src_trace_processor_importers_collapsed_stack_collapsed_stack", - ":src_trace_processor_importers_common_common", - ":src_trace_processor_importers_common_parser_types", - ":src_trace_processor_importers_common_stats_tracker", - ":src_trace_processor_importers_common_synthetic_tid_hdr", - ":src_trace_processor_importers_common_v8_profile_parser", - ":src_trace_processor_importers_etw_full", - ":src_trace_processor_importers_etw_minimal", - ":src_trace_processor_importers_ftrace_ftrace_descriptors", - ":src_trace_processor_importers_ftrace_full", - ":src_trace_processor_importers_ftrace_minimal", - ":src_trace_processor_importers_fuchsia_fuchsia_record", - ":src_trace_processor_importers_fuchsia_full", - ":src_trace_processor_importers_fuchsia_minimal", - ":src_trace_processor_importers_gecko_gecko", - ":src_trace_processor_importers_gecko_gecko_event", - ":src_trace_processor_importers_generic_kernel_full", - ":src_trace_processor_importers_i2c_full", - ":src_trace_processor_importers_json_json", - ":src_trace_processor_importers_memory_tracker_graph_processor", - ":src_trace_processor_importers_ninja_ninja", - ":src_trace_processor_importers_perf_perf", - ":src_trace_processor_importers_perf_record", - ":src_trace_processor_importers_pprof_pprof", - ":src_trace_processor_importers_primes_primes", - ":src_trace_processor_importers_proto_full", - ":src_trace_processor_importers_proto_minimal", - ":src_trace_processor_importers_proto_packet_sequence_state_generation_hdr", - ":src_trace_processor_importers_proto_proto_importer_module", - ":src_trace_processor_importers_simpleperf_proto_simpleperf_proto", - ":src_trace_processor_importers_syscalls_full", - ":src_trace_processor_importers_systrace_full", - ":src_trace_processor_importers_systrace_systrace_line", - ":src_trace_processor_importers_systrace_systrace_parser", - ":src_trace_processor_io", - ":src_trace_processor_lib", - ":src_trace_processor_metatrace", - ":src_trace_processor_metrics_metrics", - ":src_trace_processor_perfetto_sql_engine_engine", - ":src_trace_processor_perfetto_sql_generator_generator", - ":src_trace_processor_perfetto_sql_intrinsics_types_types", - ":src_trace_processor_perfetto_sql_parser_intrinsic_macro_expansion", - ":src_trace_processor_perfetto_sql_parser_parser", - ":src_trace_processor_perfetto_sql_syntaqlite_syntaqlite", - ":src_trace_processor_perfetto_sql_tokenizer_tokenizer", - ":src_trace_processor_plugins_ancestor_ancestor", - ":src_trace_processor_plugins_ancestor_tables", - ":src_trace_processor_plugins_android_framework_track_event_android_framework_track_event", - ":src_trace_processor_plugins_android_framework_track_event_tables", - ":src_trace_processor_plugins_args_args", - ":src_trace_processor_plugins_art_heap_graph_functions_art_heap_graph_functions", - ":src_trace_processor_plugins_art_process_metadata_importer_art_process_metadata_importer", - ":src_trace_processor_plugins_base64_functions_base64_functions", - ":src_trace_processor_plugins_connected_flow_connected_flow", - ":src_trace_processor_plugins_connected_flow_tables", - ":src_trace_processor_plugins_core_functions_core_functions", - ":src_trace_processor_plugins_counter_intervals_counter_intervals", - ":src_trace_processor_plugins_counter_mipmap_operator_counter_mipmap_operator", - ":src_trace_processor_plugins_create_function_create_function", - ":src_trace_processor_plugins_create_intervals_create_intervals", - ":src_trace_processor_plugins_create_view_function_create_view_function", - ":src_trace_processor_plugins_critical_path_critical_path", - ":src_trace_processor_plugins_critical_path_tables", - ":src_trace_processor_plugins_descendant_descendant", - ":src_trace_processor_plugins_developer_functions_developer_functions", - ":src_trace_processor_plugins_developer_functions_tables", - ":src_trace_processor_plugins_dfs_weight_bounded_dfs_weight_bounded", - ":src_trace_processor_plugins_dfs_weight_bounded_tables", - ":src_trace_processor_plugins_dominator_tree_dominator_tree", - ":src_trace_processor_plugins_dominator_tree_tables", - ":src_trace_processor_plugins_etm_decode_chunk_etm_decode_chunk", - ":src_trace_processor_plugins_etm_iterate_range_etm_iterate_range", - ":src_trace_processor_plugins_experimental_annotated_stack_experimental_annotated_stack", - ":src_trace_processor_plugins_experimental_annotated_stack_tables", - ":src_trace_processor_plugins_experimental_flamegraph_experimental_flamegraph", - ":src_trace_processor_plugins_experimental_flat_slice_experimental_flat_slice", - ":src_trace_processor_plugins_experimental_flat_slice_tables", - ":src_trace_processor_plugins_experimental_slice_layout_experimental_slice_layout", - ":src_trace_processor_plugins_experimental_slice_layout_tables", - ":src_trace_processor_plugins_graph_scan_graph_scan", - ":src_trace_processor_plugins_graph_traversal_graph_traversal", - ":src_trace_processor_plugins_graph_traversal_tables", - ":src_trace_processor_plugins_import_import", - ":src_trace_processor_plugins_interval_intersect_interval_intersect", - ":src_trace_processor_plugins_layout_functions_layout_functions", - ":src_trace_processor_plugins_math_functions_math_functions", - ":src_trace_processor_plugins_metadata_metadata", - ":src_trace_processor_plugins_package_lookup_package_lookup", - ":src_trace_processor_plugins_perf_counter_perf_counter", - ":src_trace_processor_plugins_perf_text_perf_text", - ":src_trace_processor_plugins_perfetto_manifest_perfetto_manifest", - ":src_trace_processor_plugins_pprof_functions_pprof_functions", - ":src_trace_processor_plugins_slice_mipmap_operator_slice_mipmap_operator", - ":src_trace_processor_plugins_span_join_operator_span_join_operator", - ":src_trace_processor_plugins_sql_stats_table_sql_stats_table", - ":src_trace_processor_plugins_stack_functions_stack_functions", - ":src_trace_processor_plugins_stack_sample_importer_stack_sample_importer", - ":src_trace_processor_plugins_stdlib_docs_stdlib_docs", - ":src_trace_processor_plugins_stdlib_docs_tables", - ":src_trace_processor_plugins_storage_tables_storage_tables", - ":src_trace_processor_plugins_strace_strace", - ":src_trace_processor_plugins_string_functions_string_functions", - ":src_trace_processor_plugins_structural_tree_partition_structural_tree_partition", - ":src_trace_processor_plugins_structural_tree_partition_tables", - ":src_trace_processor_plugins_symbolize_symbolize", - ":src_trace_processor_plugins_table_info_table_info", - ":src_trace_processor_plugins_table_info_tables", - ":src_trace_processor_plugins_table_pointer_module_table_pointer_module", - ":src_trace_processor_plugins_time_functions_time_functions", - ":src_trace_processor_plugins_to_ftrace_to_ftrace", - ":src_trace_processor_plugins_trace_export_trace_export", - ":src_trace_processor_plugins_tree_functions_tree_functions", - ":src_trace_processor_plugins_type_builder_functions_type_builder_functions", - ":src_trace_processor_plugins_utils_functions_utils_functions", - ":src_trace_processor_plugins_video_frame_importer_tables", - ":src_trace_processor_plugins_video_frame_importer_video_frame_importer", - ":src_trace_processor_plugins_wattson_wattson", - ":src_trace_processor_plugins_window_operator_window_operator", - ":src_trace_processor_plugins_winscope_importer_winscope_importer", - ":src_trace_processor_plugins_winscope_proto_to_args_with_defaults_tables", - ":src_trace_processor_plugins_winscope_proto_to_args_with_defaults_winscope_proto_to_args_with_defaults", - ":src_trace_processor_plugins_winscope_surfaceflinger_hierarchy_paths_tables", - ":src_trace_processor_plugins_winscope_surfaceflinger_hierarchy_paths_winscope_surfaceflinger_hierarchy_paths", - ":src_trace_processor_plugins_zstd_functions_zstd_functions", - ":src_trace_processor_sorter_sorter", - ":src_trace_processor_sqlite_bindings_bindings", - ":src_trace_processor_sqlite_sqlite", - ":src_trace_processor_storage_minimal", - ":src_trace_processor_storage_storage", - ":src_trace_processor_tables_tables", - ":src_trace_processor_tables_tables_python", - ":src_trace_processor_trace_summary_trace_summary", - ":src_trace_processor_types_types", - ":src_trace_processor_util_args_utils", - ":src_trace_processor_util_blob", - ":src_trace_processor_util_bump_allocator", - ":src_trace_processor_util_clock", - ":src_trace_processor_util_compressor", - ":src_trace_processor_util_decompressor", - ":src_trace_processor_util_descriptors", - ":src_trace_processor_util_elf_elf", - ":src_trace_processor_util_flatbuffer_reader", - ":src_trace_processor_util_flatbuffer_writer", - ":src_trace_processor_util_galloping_search", - ":src_trace_processor_util_glob", - ":src_trace_processor_util_interned_message_view", - ":src_trace_processor_util_json_args", - ":src_trace_processor_util_json_parser", - ":src_trace_processor_util_json_serializer", - ":src_trace_processor_util_json_value", - ":src_trace_processor_util_owned_sql_value", - ":src_trace_processor_util_profile_builder", - ":src_trace_processor_util_profiler_util", - ":src_trace_processor_util_proto_profiler", - ":src_trace_processor_util_proto_to_args_parser", - ":src_trace_processor_util_protozero_to_json", - ":src_trace_processor_util_protozero_to_text", - ":src_trace_processor_util_simple_json_parser", - ":src_trace_processor_util_simple_json_serializer", - ":src_trace_processor_util_sql_argument", - ":src_trace_processor_util_sql_bundle", - ":src_trace_processor_util_sql_module_doc_parser", - ":src_trace_processor_util_stdlib", - ":src_trace_processor_util_tar_writer", - ":src_trace_processor_util_trace_blob_view_reader", - ":src_trace_processor_util_trace_enrichment_trace_enrichment", - ":src_trace_processor_util_trace_type", - ":src_trace_processor_util_zip_reader", - ":src_traceconv_lib", - ":src_traceconv_main", - ":src_traceconv_pprofbuilder", - ":src_traceconv_traceconv_lib", - ":src_traceconv_utils", - ], - visibility = [ - "//visibility:public", - ], - deps = [ - ":protos_perfetto_common_cpp", - ":protos_perfetto_common_semantic_type_zero", - ":protos_perfetto_common_zero", - ":protos_perfetto_config_android_zero", - ":protos_perfetto_config_ftrace_zero", - ":protos_perfetto_config_gpu_zero", - ":protos_perfetto_config_inode_file_zero", - ":protos_perfetto_config_interceptors_zero", - ":protos_perfetto_config_linux_zero", - ":protos_perfetto_config_power_zero", - ":protos_perfetto_config_priority_boost_zero", - ":protos_perfetto_config_process_stats_zero", - ":protos_perfetto_config_profiling_zero", - ":protos_perfetto_config_protovm_zero", - ":protos_perfetto_config_qnx_zero", - ":protos_perfetto_config_statsd_zero", - ":protos_perfetto_config_sys_stats_zero", - ":protos_perfetto_config_system_info_zero", - ":protos_perfetto_config_track_event_zero", - ":protos_perfetto_config_zero", - ":protos_perfetto_perfetto_sql_zero", - ":protos_perfetto_protovm_cpp", - ":protos_perfetto_protovm_zero", - ":protos_perfetto_trace_android_zero", - ":protos_perfetto_trace_chrome_zero", - ":protos_perfetto_trace_etw_zero", - ":protos_perfetto_trace_field_options_zero", - ":protos_perfetto_trace_filesystem_zero", - ":protos_perfetto_trace_ftrace_zero", - ":protos_perfetto_trace_generic_kernel_zero", - ":protos_perfetto_trace_gpu_gpu_interned_data_zero", - ":protos_perfetto_trace_gpu_gpu_track_event_zero", - ":protos_perfetto_trace_gpu_zero", - ":protos_perfetto_trace_interned_data_zero", - ":protos_perfetto_trace_linux_zero", - ":protos_perfetto_trace_minimal_zero", - ":protos_perfetto_trace_non_minimal_zero", - ":protos_perfetto_trace_perfetto_zero", - ":protos_perfetto_trace_power_zero", - ":protos_perfetto_trace_processor_metrics_impl_zero", - ":protos_perfetto_trace_processor_zero", - ":protos_perfetto_trace_profiling_inline_callstack_zero", - ":protos_perfetto_trace_profiling_zero", - ":protos_perfetto_trace_ps_zero", - ":protos_perfetto_trace_statsd_zero", - ":protos_perfetto_trace_summary_zero", - ":protos_perfetto_trace_sys_stats_zero", - ":protos_perfetto_trace_system_info_zero", - ":protos_perfetto_trace_track_event_zero", - ":protos_perfetto_trace_translation_zero", - ":protos_third_party_android_art_art_heap_graph_zero", - ":protos_third_party_android_connectivity_connectivity_network_trace_zero", - ":protos_third_party_android_frameworks_base_proto_tracing_frameworks_base_interned_data_zero", - ":protos_third_party_android_frameworks_base_proto_tracing_frameworks_base_trace_packet_zero", - ":protos_third_party_android_frameworks_base_proto_tracing_frameworks_base_track_event_zero", - ":protos_third_party_android_frameworks_native_tracing_frameworks_native_interned_data_zero", - ":protos_third_party_android_frameworks_native_tracing_frameworks_native_trace_packet_zero", - ":protos_third_party_android_frameworks_native_tracing_winscope_winscope_extensions_zero", - ":protos_third_party_android_frameworks_native_tracing_winscope_winscope_regular_zero", - ":protos_third_party_android_packages_modules_bluetooth_tracing_bluetooth_tracing_zero", - ":protos_third_party_chromium_zero", - ":protos_third_party_pprof_zero", - ":protos_third_party_primes_cpp", - ":protos_third_party_primes_zero", - ":protos_third_party_simpleperf_zero", - ":protozero", - ":src_base_base", - ":src_base_clock_snapshots", - ":src_base_regex_regex", - ":src_base_version", - ":src_protovm_protovm", - ":src_trace_processor_containers_containers", - ":src_trace_processor_importers_proto_gen_cc_android_extension_descriptor", - ":src_trace_processor_importers_proto_gen_cc_chrome_track_event_descriptor", - ":src_trace_processor_importers_proto_gen_cc_gpu_interned_data_descriptor", - ":src_trace_processor_importers_proto_gen_cc_gpu_track_event_descriptor", - ":src_trace_processor_importers_proto_gen_cc_statsd_atoms_descriptor", - ":src_trace_processor_importers_proto_gen_cc_trace_descriptor", - ":src_trace_processor_importers_proto_gen_cc_track_event_descriptor", - ":src_trace_processor_metrics_gen_cc_all_chrome_metrics_descriptor", - ":src_trace_processor_metrics_gen_cc_all_webview_metrics_descriptor", - ":src_trace_processor_metrics_gen_cc_metrics_descriptor", - ":src_trace_processor_metrics_sql_gen_amalgamated_sql_metrics", - ":src_trace_processor_perfetto_sql_stdlib_stdlib", - ":src_trace_processor_plugins_wattson_gen_cpu_1d_curves", - ":src_trace_processor_plugins_wattson_gen_cpu_2d_curves", - ":src_trace_processor_plugins_wattson_gen_gpu_curves", - ":src_trace_processor_plugins_wattson_gen_l3_curves", - ":src_trace_processor_plugins_wattson_gen_tpu_curves", - ":src_trace_processor_trace_summary_gen_cc_trace_summary_descriptor", - ":src_trace_processor_util_build_id", - ":src_trace_processor_util_deobfuscation_deobfuscator", - ":src_trace_processor_util_symbolizer_symbolize_database", - ":src_trace_processor_util_symbolizer_symbolizer", - ":src_traceconv_gen_cc_android_extension_descriptor", - ":src_traceconv_gen_cc_trace_descriptor", - ] + PERFETTO_CONFIG.deps.sqlite + - PERFETTO_CONFIG.deps.sqlite_ext_percentile + - PERFETTO_CONFIG.deps.zlib + - PERFETTO_CONFIG.deps.zstd + - PERFETTO_CONFIG.deps.demangle_wrapper, -) - # GN target: //src/traced/probes:traced_probes perfetto_cc_binary( name = "traced_probes", diff --git a/BUILD.gn b/BUILD.gn index 8d548fa7556..2cf5f7535ab 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -60,22 +60,14 @@ if (enable_perfetto_trace_processor) { } if (enable_perfetto_traceconv) { - all_targets += [ - "src/traceconv", - "src/proto_utils", - ] + # The standalone traceconv host binary has been folded into + # trace_processor_shell (the convert/bundle/util subcommands), so it is no + # longer built here. The src/traceconv:lib conversion code is pulled in + # directly by the shell, and the UI's traceconv WASM module is built via + # ui/BUILD.gn. + all_targets += [ "src/proto_utils" ] if (is_cross_compiling) { - # In many cross-compilation scenarios (typically Android) developers expect - # the host version of traceconv to be available somewhere in out/, so - # they can convert Android traces on their dev machine. Also - # tools/gen_android_bp explicitly depends on the host version for the - # cc_binary_host("traceconv") target in Android.bp. - # Note that when cross-compiling the host executable will be available in - # out/xxx/gcc_like_host/traceconv NOT just out/xxx/traceconv. - all_targets += [ - "src/traceconv($host_toolchain)", - "src/proto_utils($host_toolchain)", - ] + all_targets += [ "src/proto_utils($host_toolchain)" ] } } diff --git a/gn/perfetto_integrationtests.gni b/gn/perfetto_integrationtests.gni index 7352db5fd6b..07dc0b7b944 100644 --- a/gn/perfetto_integrationtests.gni +++ b/gn/perfetto_integrationtests.gni @@ -49,6 +49,8 @@ if (enable_perfetto_trace_processor && perfetto_build_standalone && !is_android) { perfetto_integrationtests_targets += [ "src/trace_processor:integrationtests" ] + perfetto_integrationtests_targets += + [ "src/trace_processor/shell:integrationtests" ] perfetto_integrationtests_targets += [ "src/traceconv:integrationtests" ] perfetto_integrationtests_data_targets += [ "protos/perfetto/trace:test_extensions_slim_descriptor" ] diff --git a/include/perfetto/ext/traceconv/BUILD.gn b/include/perfetto/ext/traceconv/BUILD.gn deleted file mode 100644 index b946081a60a..00000000000 --- a/include/perfetto/ext/traceconv/BUILD.gn +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2024 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. - -source_set("traceconv") { - sources = [ "traceconv.h" ] -} diff --git a/include/perfetto/ext/traceconv/traceconv.h b/include/perfetto/ext/traceconv/traceconv.h deleted file mode 100644 index 73e6f86750d..00000000000 --- a/include/perfetto/ext/traceconv/traceconv.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2024 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_EXT_TRACECONV_TRACECONV_H_ -#define INCLUDE_PERFETTO_EXT_TRACECONV_TRACECONV_H_ - -#include "perfetto/base/export.h" - -namespace perfetto::traceconv { - -int PERFETTO_EXPORT_COMPONENT TraceconvMain(int argc, char** argv); - -} // namespace perfetto::traceconv - -#endif // INCLUDE_PERFETTO_EXT_TRACECONV_TRACECONV_H_ diff --git a/infra/luci/recipes/perfetto.py b/infra/luci/recipes/perfetto.py index 0c6170344a5..cce86e4f3f6 100644 --- a/infra/luci/recipes/perfetto.py +++ b/infra/luci/recipes/perfetto.py @@ -43,9 +43,6 @@ { 'name': 'trace_processor_shell' }, - { - 'name': 'traceconv', - }, { 'name': 'tracebox', 'exclude_platforms': ['windows-amd64'] diff --git a/python/tools/cpu_profile.py b/python/tools/cpu_profile.py index c3bda91d55c..3723ecfeaa4 100644 --- a/python/tools/cpu_profile.py +++ b/python/tools/cpu_profile.py @@ -31,7 +31,7 @@ import time import uuid -from perfetto.prebuilts.manifests.trace_processor_shell import * +from perfetto.prebuilts.manifests.traceconv import * from perfetto.prebuilts.perfetto_prebuilts import * # Used for creating directories, etc. @@ -394,18 +394,17 @@ def record_trace(config, profile_target): adb_check_output(['adb', 'shell', 'rm', profile_device_path]) -def get_trace_processor(): - """Sets up and returns the path to `trace_processor`.""" +def get_traceconv(): + """Sets up and returns the path to `traceconv`.""" try: - trace_processor = get_perfetto_prebuilt( - TRACE_PROCESSOR_SHELL_MANIFEST, soft_fail=True) + traceconv = get_perfetto_prebuilt(TRACECONV_MANIFEST, soft_fail=True) except Exception as error: exit_with_bug_report(error) - if trace_processor is None: + if traceconv is None: exit_with_bug_report( - "Unable to download `trace_processor` for symbolizing profiles.") + "Unable to download `traceconv` for symbolizing profiles.") - return trace_processor + return traceconv def concatenate_files(files_to_concatenate, output_file): @@ -421,13 +420,12 @@ def concatenate_files(files_to_concatenate, output_file): shutil.copyfileobj(input, output) -def symbolize_trace(trace_processor, profile_target): +def symbolize_trace(traceconv, profile_target): """Attempts symbolization of the recorded trace/profile, if symbols are available. Args: - trace_processor: The path to the `trace_processor` binary used for - symbolization. + traceconv: The path to the `traceconv` binary used for symbolization. profile_target: The directory where the recorded trace was output. Returns: @@ -441,10 +439,11 @@ def symbolize_trace(trace_processor, profile_target): if binary_path is not None: try: with open(os.path.join(profile_target, 'symbols'), 'w') as symbols_file: - return_code = subprocess.call( - [trace_processor, 'util', 'symbolize', trace_file], - env=dict(os.environ, PERFETTO_BINARY_PATH=binary_path), - stdout=symbols_file) + return_code = subprocess.call([traceconv, 'symbolize', trace_file], + env=dict( + os.environ, + PERFETTO_BINARY_PATH=binary_path), + stdout=symbols_file) except IOError as error: sys.exit("Unable to write symbols to disk: {}".format(error)) if return_code == 0: @@ -462,27 +461,26 @@ def symbolize_trace(trace_processor, profile_target): return trace_file -def generate_pprof_profiles(trace_processor, trace_file, args): +def generate_pprof_profiles(traceconv, trace_file, args): """Generates pprof profiles from the recorded trace. Args: - trace_processor: The path to the `trace_processor` binary used for - generating profiles. + traceconv: The path to the `traceconv` binary used for generating profiles. trace_file: The oath to the recorded and potentially symbolized trace file. Returns: The directory where pprof profiles are output. """ try: - conversion_args = [trace_processor, 'convert', 'profile', '--perf'] + ( + conversion_args = [traceconv, 'profile', '--perf'] + ( ['--no-annotations'] if args.no_annotations else []) + [trace_file] - trace_processor_output = subprocess.check_output(conversion_args) + traceconv_output = subprocess.check_output(conversion_args) except Exception as error: exit_with_bug_report( "Unable to extract profiles from trace: {}".format(error)) profiles_output_directory = None - for word in trace_processor_output.decode('utf-8').split(): + for word in traceconv_output.decode('utf-8').split(): if 'perf_profile-' in word: profiles_output_directory = word if profiles_output_directory is None: @@ -513,11 +511,10 @@ def main(argv): print(trace_config) return 0 record_trace(trace_config, profile_target) - trace_processor = get_trace_processor() - trace_file = symbolize_trace(trace_processor, profile_target) + traceconv = get_traceconv() + trace_file = symbolize_trace(traceconv, profile_target) copy_profiles_to_destination( - profile_target, generate_pprof_profiles(trace_processor, trace_file, - args)) + profile_target, generate_pprof_profiles(traceconv, trace_file, args)) return 0 diff --git a/python/tools/heap_profile.py b/python/tools/heap_profile.py index 6e8243ecc19..9eacbabc32e 100644 --- a/python/tools/heap_profile.py +++ b/python/tools/heap_profile.py @@ -30,7 +30,7 @@ from perfetto.prebuilts.manifests.heapprofd_glibc_preload import * from perfetto.prebuilts.manifests.tracebox import * -from perfetto.prebuilts.manifests.trace_processor_shell import * +from perfetto.prebuilts.manifests.traceconv import * from perfetto.prebuilts.perfetto_prebuilts import * NULL = open(os.devnull) @@ -147,10 +147,10 @@ def arg_order(action): return result, action.option_strings[0].strip('-') -def process_trace(trace_file, profile_target, trace_processor_binary, args, +def process_trace(trace_file, profile_target, traceconv_binary, args, android_mode): - """Convert a raw trace to pprof via trace_processor. Returns an exit code.""" - if trace_processor_binary is None: + """Convert a raw trace to pprof via traceconv. Returns an exit code.""" + if traceconv_binary is None: print('Wrote profile to {}'.format(trace_file)) print( 'This file can be opened using the Perfetto UI, https://ui.perfetto.dev' @@ -171,10 +171,10 @@ def process_trace(trace_file, profile_target, trace_processor_binary, args, if binary_path is not None: symbols_path = os.path.join(profile_target, 'symbols') with open(symbols_path, 'w') as fd: - ret = subprocess.call( - [trace_processor_binary, 'util', 'symbolize', trace_file], - env=dict(os.environ, PERFETTO_BINARY_PATH=binary_path), - stdout=fd) + ret = subprocess.call([traceconv_binary, 'symbolize', trace_file], + env=dict( + os.environ, PERFETTO_BINARY_PATH=binary_path), + stdout=fd) if ret == 0: concat_files.append(symbols_path) else: @@ -185,10 +185,11 @@ def process_trace(trace_file, profile_target, trace_processor_binary, args, if proguard_map is not None: deobf_path = os.path.join(profile_target, 'deobfuscation-packets') with open(deobf_path, 'w') as fd: - ret = subprocess.call( - [trace_processor_binary, 'util', 'deobfuscate', trace_file], - env=dict(os.environ, PERFETTO_PROGUARD_MAP=proguard_map), - stdout=fd) + ret = subprocess.call([traceconv_binary, 'deobfuscate', trace_file], + env=dict( + os.environ, + PERFETTO_PROGUARD_MAP=proguard_map), + stdout=fd) if ret == 0: concat_files.append(deobf_path) else: @@ -208,12 +209,12 @@ def process_trace(trace_file, profile_target, trace_processor_binary, args, out.write(buf) trace_file = symbolized_path - conversion_args = [trace_processor_binary, 'convert', 'profile'] + ( + conversion_args = [traceconv_binary, 'profile'] + ( ['--no-annotations'] if args.no_annotations else []) + [trace_file] - trace_processor_output = subprocess.check_output( + traceconv_output = subprocess.check_output( conversion_args, stderr=subprocess.STDOUT) profile_path = None - for word in trace_processor_output.decode('utf-8').split(): + for word in traceconv_output.decode('utf-8').split(): if 'heap_profile-' in word: profile_path = word if profile_path is None: @@ -250,7 +251,7 @@ def process_trace(trace_file, profile_target, trace_processor_binary, args, return 0 -def linux_main(args, cfg, cmd, trace_processor_binary): +def linux_main(args, cfg, cmd, traceconv_binary): """Run a local heap profile session on Linux using LD_PRELOAD.""" tracebox_binary = args.tracebox_binary if tracebox_binary is None: @@ -329,11 +330,7 @@ def linux_main(args, cfg, cmd, trace_processor_binary): perfetto_proc.wait() return process_trace( - trace_output, - profile_target, - trace_processor_binary, - args, - android_mode=False) + trace_output, profile_target, traceconv_binary, args, android_mode=False) def print_options(parser): @@ -464,8 +461,7 @@ def main(argv): help="Get simpleperf profile of heapprofd. This is " "only for heapprofd development.") common.add_argument( - "--trace-processor-binary", - help="Path to local trace_processor. For debugging.") + "--traceconv-binary", help="Path to local trace to text. For debugging.") common.add_argument( "--no-annotations", help="Do not suffix the pprof function names with Android ART mode " @@ -607,7 +603,7 @@ def main(argv): parser.print_help() return 1 - trace_processor_binary = args.trace_processor_binary + traceconv_binary = args.traceconv_binary if args.continuous_dump: target_cfg += CONTINUOUS_DUMP.format(dump_interval=args.continuous_dump) @@ -624,14 +620,13 @@ def main(argv): print(cfg) return 0 - # Do this AFTER print_config so we do not download trace_processor only to + # Do this AFTER print_config so we do not download traceconv only to # print out the config. - if trace_processor_binary is None: - trace_processor_binary = get_perfetto_prebuilt( - TRACE_PROCESSOR_SHELL_MANIFEST, soft_fail=True) + if traceconv_binary is None: + traceconv_binary = get_perfetto_prebuilt(TRACECONV_MANIFEST, soft_fail=True) if args.subcommand == 'host': - return linux_main(args, cfg, cmd, trace_processor_binary) + return linux_main(args, cfg, cmd, traceconv_binary) # --- Android path --- @@ -736,7 +731,7 @@ def main(argv): return process_trace( profile_host_path, profile_target, - trace_processor_binary, + traceconv_binary, args, android_mode=True) diff --git a/src/trace_processor/shell/BUILD.gn b/src/trace_processor/shell/BUILD.gn index 14afe3d4aa0..ba06f7e654c 100644 --- a/src/trace_processor/shell/BUILD.gn +++ b/src/trace_processor/shell/BUILD.gn @@ -126,3 +126,20 @@ source_set("unittests") { "../../base", ] } + +if (enable_perfetto_integration_tests) { + source_set("integrationtests") { + testonly = true + sources = [ "bundle_integrationtest.cc" ] + deps = [ + "..:trace_processor_shell_lib", + "../../../gn:default_deps", + "../../../gn:gtest_and_gmock", + "../../../include/perfetto/ext/base", + "../../../include/perfetto/ext/trace_processor:trace_processor_shell", + "../../../protos/perfetto/trace:cpp", + "../../../protos/perfetto/trace/profiling:cpp", + "../../base:test_support", + ] + } +} diff --git a/src/traceconv/traceconv_bundle_integrationtest.cc b/src/trace_processor/shell/bundle_integrationtest.cc similarity index 94% rename from src/traceconv/traceconv_bundle_integrationtest.cc rename to src/trace_processor/shell/bundle_integrationtest.cc index 9b8d18a9ec6..427e86497c9 100644 --- a/src/traceconv/traceconv_bundle_integrationtest.cc +++ b/src/trace_processor/shell/bundle_integrationtest.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "perfetto/ext/traceconv/traceconv.h" +#include "perfetto/ext/trace_processor/trace_processor_shell.h" #include #include @@ -31,12 +31,13 @@ #include "src/base/test/utils.h" #include "test/gtest_and_gmock.h" -namespace perfetto::traceconv { +namespace perfetto::trace_processor { namespace { using testing::UnorderedElementsAre; -// Helper: builds an argv from owned strings and invokes TraceconvMain. +// Helper: builds an argv from owned strings and invokes the shell's `bundle` +// subcommand via TraceProcessorShellMain. class ArgvInvoker { public: void Add(const std::string& arg) { args_.push_back(arg); } @@ -45,7 +46,7 @@ class ArgvInvoker { for (auto& s : args_) { argv.push_back(s.data()); } - return TraceconvMain(static_cast(argv.size()), argv.data()); + return TraceProcessorShellMain(static_cast(argv.size()), argv.data()); } private: @@ -131,7 +132,7 @@ TEST_F(TraceconvBundleTest, BundleWithProguardMap) { " void bar() -> b\n"); ArgvInvoker invoker; - invoker.Add("traceconv"); + invoker.Add("trace_processor_shell"); invoker.Add("bundle"); invoker.Add("--no-auto-symbol-paths"); invoker.Add("--proguard-map"); @@ -176,7 +177,7 @@ TEST_F(TraceconvBundleTest, BundleWithRepeatedProguardMaps) { base::TempFile map2 = WriteTempFile("com.example.Bar -> b.b:\n"); ArgvInvoker invoker; - invoker.Add("traceconv"); + invoker.Add("trace_processor_shell"); invoker.Add("bundle"); invoker.Add("--no-auto-symbol-paths"); invoker.Add("--proguard-map"); @@ -200,7 +201,7 @@ TEST_F(TraceconvBundleTest, BundleWithProguardMapNoPackage) { base::TempFile mapping = WriteTempFile("com.example.Foo -> a.a:\n"); ArgvInvoker invoker; - invoker.Add("traceconv"); + invoker.Add("trace_processor_shell"); invoker.Add("bundle"); invoker.Add("--no-auto-symbol-paths"); invoker.Add("--proguard-map"); @@ -224,7 +225,7 @@ TEST_F(TraceconvBundleTest, BundleWithProguardMapNoPackage) { // Explicit --proguard-map pointing at a missing file must fail the command. TEST_F(TraceconvBundleTest, BundleWithMissingProguardMapFails) { ArgvInvoker invoker; - invoker.Add("traceconv"); + invoker.Add("trace_processor_shell"); invoker.Add("bundle"); invoker.Add("--no-auto-symbol-paths"); invoker.Add("--proguard-map"); @@ -238,7 +239,7 @@ TEST_F(TraceconvBundleTest, BundleWithMissingProguardMapFails) { // --proguard-map with no following argument is a usage error. TEST_F(TraceconvBundleTest, BundleProguardMapMissingArgFails) { ArgvInvoker invoker; - invoker.Add("traceconv"); + invoker.Add("trace_processor_shell"); invoker.Add("bundle"); invoker.Add("--proguard-map"); @@ -253,7 +254,7 @@ TEST_F(TraceconvBundleTest, BundleNoAutoProguardMapsWithExplicit) { base::TempFile mapping = WriteTempFile("com.example.Foo -> a.a:\n"); ArgvInvoker invoker; - invoker.Add("traceconv"); + invoker.Add("trace_processor_shell"); invoker.Add("bundle"); invoker.Add("--no-auto-symbol-paths"); invoker.Add("--no-auto-proguard-maps"); @@ -271,4 +272,4 @@ TEST_F(TraceconvBundleTest, BundleNoAutoProguardMapsWithExplicit) { } } // namespace -} // namespace perfetto::traceconv +} // namespace perfetto::trace_processor diff --git a/src/traceconv/BUILD.gn b/src/traceconv/BUILD.gn index 56b31a18285..c0b62875cca 100644 --- a/src/traceconv/BUILD.gn +++ b/src/traceconv/BUILD.gn @@ -18,13 +18,11 @@ import("../../gn/perfetto_host_executable.gni") import("../../gn/test.gni") import("../../gn/wasm.gni") -executable("traceconv") { - testonly = true - deps = [ - ":main", - "../../gn:default_deps", - ] -} +# NOTE: there is no longer a standalone "traceconv" executable. The host CLI is +# now trace_processor_shell (the convert/bundle/util subcommands, plus +# traceconv-name compatibility), and the conversion implementation below +# (":lib") is linked directly by the shell. The only artifact still built from +# this directory is the UI's "traceconv" WASM module (wasm_lib below). source_set("utils") { deps = [ @@ -119,28 +117,6 @@ source_set("lib") { ] } -source_set("main") { - deps = [ - ":traceconv_lib", - "../../gn:default_deps", - ] - sources = [ "main.cc" ] -} - -source_set("traceconv_lib") { - deps = [ - ":gen_cc_android_extension_descriptor", - ":gen_cc_trace_descriptor", - ":lib", - "../../gn:default_deps", - "../../include/perfetto/ext/base:base", - "../base:version", - "../protozero/text_to_proto", - ] - public_deps = [ "../../include/perfetto/ext/traceconv:traceconv" ] - sources = [ "traceconv.cc" ] -} - if (enable_perfetto_ui) { wasm_lib("traceconv_wasm") { name = "traceconv" @@ -149,9 +125,14 @@ if (enable_perfetto_ui) { enable_web_environment = true enable_filesystem = true deps = [ - ":main", + ":gen_cc_android_extension_descriptor", + ":gen_cc_trace_descriptor", + ":lib", "../../gn:default_deps", + "../../include/perfetto/ext/base:base", + "../protozero/text_to_proto", ] + sources = [ "wasm_main.cc" ] } } @@ -170,7 +151,6 @@ if (enable_perfetto_integration_tests) { testonly = true deps = [ ":lib", - ":traceconv_lib", "../../gn:default_deps", "../../gn:gtest_and_gmock", "../../include/perfetto/base", @@ -186,7 +166,6 @@ if (enable_perfetto_integration_tests) { "pprof_reader.h", "trace_to_pprof_integrationtest.cc", "trace_to_text_integrationtest.cc", - "traceconv_bundle_integrationtest.cc", ] } } diff --git a/src/traceconv/main.cc b/src/traceconv/main.cc deleted file mode 100644 index e710999bbe2..00000000000 --- a/src/traceconv/main.cc +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -#include "perfetto/ext/traceconv/traceconv.h" - -int main(int argc, char** argv) { - return perfetto::traceconv::TraceconvMain(argc, argv); -} diff --git a/src/traceconv/traceconv.cc b/src/traceconv/traceconv.cc deleted file mode 100644 index 31bb5279fda..00000000000 --- a/src/traceconv/traceconv.cc +++ /dev/null @@ -1,445 +0,0 @@ -/* - * 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. - */ - -#include "perfetto/ext/traceconv/traceconv.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "perfetto/base/build_config.h" -#include "perfetto/base/logging.h" -#include "perfetto/ext/base/file_utils.h" -#include "perfetto/ext/base/string_utils.h" -#include "perfetto/ext/base/utils.h" -#include "perfetto/ext/base/version.h" -#include "perfetto/profiling/pprof_builder.h" -#include "src/protozero/text_to_proto/text_to_proto.h" -#include "src/traceconv/android_extension.descriptor.h" -#include "src/traceconv/deobfuscate_profile.h" -#include "src/traceconv/symbolize_profile.h" -#include "src/traceconv/trace.descriptor.h" -#include "src/traceconv/trace_to_bundle.h" -#include "src/traceconv/trace_to_firefox.h" -#include "src/traceconv/trace_to_json.h" -#include "src/traceconv/trace_to_profile.h" -#include "src/traceconv/trace_to_systrace.h" -#include "src/traceconv/trace_to_text.h" -#include "src/traceconv/trace_unpack.h" - -#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) -#include -#include -#endif - -namespace perfetto::traceconv { -namespace { - -int Usage(const char* argv0) { - fprintf(stderr, R"( -Trace format conversion tool. -Usage: %s MODE [OPTIONS] [input_file] [output_file] - -CONVERSION MODES AND THEIR SUPPORTED OPTIONS: - - systrace Converts to systrace HTML format - --truncate [start|end] Truncates trace to keep start or end - --full-sort Forces full trace sorting - - json Converts to Chrome JSON format - --truncate [start|end] Truncates trace to keep start or end - --full-sort Forces full trace sorting - - ctrace Converts to compressed systrace format - --truncate [start|end] Truncates trace to keep start or end - --full-sort Forces full trace sorting - - text Converts to human-readable text format - --skip-unknown Skip unknown fields when converting to text - - profile Converts profile data to pprof format - (default: auto-detect profile type) - --alloc Convert only the allocator profile - --perf Convert only the perf profile - --java-heap Convert only the heap graph profile - --no-annotations Don't add derived annotations to frames - --timestamps T1,T2,... Generate profiles for specific timestamps - --pid PID Generate profiles for specific process - --output-dir DIR Output directory for profiles (default: random tmp) - - java_heap_profile Legacy alias for "profile --java-heap" - - symbolize Symbolizes addresses in profiles - (no additional options) - - deobfuscate Deobfuscates obfuscated profiles - (no additional options) - - firefox Converts to Firefox profiler format - (no additional options) - - decompress_packets Decompresses compressed trace packets - (no additional options) - - bundle Creates bundle with trace + debug data - (outputs TAR with symbols/deobfuscation mappings) - Requires input and output file paths (no stdin/stdout) - --symbol-paths PATH1,PATH2,... Additional paths to search for symbols - (beyond automatic discovery) - --no-auto-symbol-paths Disable automatic symbol path discovery - --proguard-map [pkg=]PATH ProGuard/R8 mapping.txt for Java/Kotlin - deobfuscation (may be repeated). - pkg= prefix scopes the map to a package. - --no-auto-proguard-maps Disable automatic ProGuard/R8 mapping - discovery (e.g. Gradle project layout) - --verbose Print more detailed output - - binary Converts text proto to binary format - (no additional options) - -NOTES: - - If no input file is specified, reads from stdin - - If no output file is specified, writes to stdout - - Input/output files can be '-' to explicitly use stdin/stdout -)", - argv0); - return 1; -} - -uint64_t StringToUint64OrDie(const char* str) { - char* end; - uint64_t number = static_cast(strtoll(str, &end, 10)); - if (*end != '\0') { - PERFETTO_ELOG("Invalid %s. Expected decimal integer.", str); - exit(1); - } - return number; -} - -int TextToTrace(std::istream* input, std::ostream* output) { - std::string trace_text(std::istreambuf_iterator{*input}, - std::istreambuf_iterator{}); - std::vector descriptors; - descriptors.reserve(kTraceDescriptor.size() + - kAndroidExtensionDescriptor.size()); - descriptors.insert(descriptors.end(), kTraceDescriptor.begin(), - kTraceDescriptor.end()); - descriptors.insert(descriptors.end(), kAndroidExtensionDescriptor.begin(), - kAndroidExtensionDescriptor.end()); - auto proto_status = - protozero::TextToProto(descriptors.data(), descriptors.size(), - ".perfetto.protos.Trace", "trace", trace_text); - if (!proto_status.ok()) { - PERFETTO_ELOG("Failed to parse trace: %s", - proto_status.status().c_message()); - return 1; - } - const std::vector& trace_proto = proto_status.value(); - output->write(reinterpret_cast(trace_proto.data()), - static_cast(trace_proto.size())); - return 0; -} - -int Main(int argc, char** argv) { - std::vector positional_args; - trace_to_text::Keep truncate_keep = trace_to_text::Keep::kAll; - uint64_t pid = 0; - std::vector timestamps; - bool full_sort = false; - std::optional profile_type; - bool profile_no_annotations = false; - std::vector symbol_paths; - std::vector proguard_maps; - bool no_auto_symbol_paths = false; - bool no_auto_proguard_maps = false; - bool verbose = false; - bool skip_unknown_fields = false; - std::string output_dir; - for (int i = 1; i < argc; i++) { - if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0) { - printf("%s\n", base::GetVersionString()); - return 0; - } - if (strcmp(argv[i], "-t") == 0 || strcmp(argv[i], "--truncate") == 0) { - i++; - if (i <= argc && strcmp(argv[i], "start") == 0) { - truncate_keep = trace_to_text::Keep::kStart; - } else if (i <= argc && strcmp(argv[i], "end") == 0) { - truncate_keep = trace_to_text::Keep::kEnd; - } else { - PERFETTO_ELOG( - "--truncate must specify whether to keep the end or the " - "start of the trace."); - return Usage(argv[0]); - } - } else if (i <= argc && strcmp(argv[i], "--pid") == 0) { - i++; - pid = StringToUint64OrDie(argv[i]); - } else if (i <= argc && strcmp(argv[i], "--timestamps") == 0) { - i++; - std::vector ts_strings = base::SplitString(argv[i], ","); - for (const std::string& ts : ts_strings) { - timestamps.emplace_back(StringToUint64OrDie(ts.c_str())); - } - } else if (strcmp(argv[i], "--alloc") == 0) { - profile_type = trace_to_text::ConversionMode::kHeapProfile; - } else if (strcmp(argv[i], "--perf") == 0) { - profile_type = trace_to_text::ConversionMode::kPerfProfile; - } else if (strcmp(argv[i], "--java-heap") == 0) { - profile_type = trace_to_text::ConversionMode::kJavaHeapProfile; - } else if (strcmp(argv[i], "--no-annotations") == 0) { - profile_no_annotations = true; - } else if (strcmp(argv[i], "--full-sort") == 0) { - full_sort = true; - } else if (i < argc && strcmp(argv[i], "--symbol-paths") == 0) { - i++; - symbol_paths = base::SplitString(argv[i], ","); - } else if (strcmp(argv[i], "--no-auto-symbol-paths") == 0) { - no_auto_symbol_paths = true; - } else if (strcmp(argv[i], "--no-auto-proguard-maps") == 0) { - no_auto_proguard_maps = true; - } else if (i < argc && strcmp(argv[i], "--proguard-map") == 0) { - i++; - if (i >= argc) { - PERFETTO_ELOG("--proguard-map requires an argument."); - return Usage(argv[0]); - } - std::string arg = argv[i]; - size_t eq = arg.find('='); - trace_to_text::ProguardMapSpec spec; - if (eq == std::string::npos) { - spec.path = std::move(arg); - } else { - spec.package = arg.substr(0, eq); - spec.path = arg.substr(eq + 1); - } - proguard_maps.push_back(std::move(spec)); - } else if (strcmp(argv[i], "--verbose") == 0) { - verbose = true; - } else if (i < argc && strcmp(argv[i], "--output-dir") == 0) { - i++; - if (i >= argc) { - PERFETTO_ELOG("--output-dir requires an argument."); - return Usage(argv[0]); - } - output_dir = argv[i]; - } else if (strcmp(argv[i], "--skip-unknown") == 0) { - skip_unknown_fields = true; - } else { - positional_args.push_back(argv[i]); - } - } - - if (positional_args.empty()) - return Usage(argv[0]); - - std::istream* input_stream; - std::ifstream file_istream; - if (positional_args.size() > 1) { - const char* file_path = positional_args[1]; - file_istream.open(file_path, std::ios_base::in | std::ios_base::binary); - if (!file_istream.is_open()) - PERFETTO_FATAL("Could not open %s", file_path); - input_stream = &file_istream; - } else { - if (base::IsTty(stdin)) { - PERFETTO_ELOG("Reading from stdin but it's connected to a TTY"); - PERFETTO_LOG("It is unlikely that you want to type in some binary."); - PERFETTO_LOG("Either pass a file path to the cmdline or pipe stdin"); - return Usage(argv[0]); - } - input_stream = &std::cin; - } - -#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) - // We don't want the runtime to replace "\n" with "\r\n" on `std::cout`. - _setmode(_fileno(stdout), _O_BINARY); -#endif - - std::string format(positional_args[0]); - - std::ostream* output_stream; - std::ofstream file_ostream; - if (positional_args.size() > 2) { - const char* file_path = positional_args[2]; - file_ostream.open(file_path, std::ios_base::out | std::ios_base::trunc | - std::ios_base::binary); - if (!file_ostream.is_open()) - PERFETTO_FATAL("Could not open %s", file_path); - output_stream = &file_ostream; - } else { - // Binary formats would corrupt an interactive terminal if printed on it. - if ((format == "binary" || format == "ctrace" || - format == "decompress_packets" || format == "symbolize" || - format == "deobfuscate") && - base::IsTty(stdout)) { - PERFETTO_ELOG( - "Refusing to write binary output to a terminal. Pass an output " - "file path or redirect stdout."); - return 1; - } - output_stream = &std::cout; - } - - if ((format != "profile" && format != "java_heap_profile") && - (pid != 0 || !timestamps.empty())) { - PERFETTO_ELOG( - "--pid and --timestamps are supported only for profile " - "and java_heap_profile formats."); - return 1; - } - - if ((format != "profile" && format != "java_heap_profile") && - !output_dir.empty()) { - PERFETTO_ELOG( - "--output-dir is supported only for profile and java_heap_profile " - "formats."); - return 1; - } - - if (format == "binary") { - return TextToTrace(input_stream, output_stream); - } - - if (format == "json") - return trace_to_text::TraceToJson(input_stream, output_stream, - /*compress=*/false, truncate_keep, - full_sort); - - if (format == "systrace") - return trace_to_text::TraceToSystrace(input_stream, output_stream, - /*ctrace=*/false, truncate_keep, - full_sort); - - if (format == "ctrace") - return trace_to_text::TraceToSystrace(input_stream, output_stream, - /*ctrace=*/true, truncate_keep, - full_sort); - - if (truncate_keep != trace_to_text::Keep::kAll) { - PERFETTO_ELOG( - "--truncate is unsupported for " - "text|profile|symbolize|decompress_packets format."); - return 1; - } - - if (full_sort) { - PERFETTO_ELOG( - "--full-sort is unsupported for " - "text|profile|symbolize|decompress_packets format."); - return 1; - } - - if (format == "text") { - trace_to_text::TraceToTextOptions options; - options.skip_unknown_fields = skip_unknown_fields; - return trace_to_text::TraceToText(input_stream, output_stream, options) ? 0 - : 1; - } - - if (format == "profile") { - if (positional_args.size() > 2) { - PERFETTO_ELOG( - "output file is not supported for \"profile\", use --output-dir " - "instead"); - return Usage(argv[0]); - } - return trace_to_text::TraceToProfile(input_stream, pid, timestamps, - !profile_no_annotations, output_dir, - profile_type, verbose); - } - - if (format == "java_heap_profile") { - // legacy alias for "profile --java-heap" - return trace_to_text::TraceToProfile( - input_stream, pid, timestamps, !profile_no_annotations, output_dir, - trace_to_text::ConversionMode::kJavaHeapProfile, verbose); - } - - if (format == "symbolize") - return trace_to_text::SymbolizeProfile(input_stream, output_stream, - verbose); - - if (format == "deobfuscate") - return trace_to_text::DeobfuscateProfile(input_stream, output_stream); - - if (format == "firefox") - return trace_to_text::TraceToFirefoxProfile(input_stream, output_stream); - - if (format == "decompress_packets") - return trace_to_text::UnpackCompressedPackets(input_stream, output_stream); - - if (format == "bundle") { - // Bundle mode requires both input and output file paths - if (positional_args.size() < 3) { - PERFETTO_ELOG("Bundle mode requires both input and output file paths"); - return Usage(argv[0]); - } - - const char* input_file = positional_args[1]; - const char* output_file = positional_args[2]; - - // Validate that stdin/stdout are not used for bundle mode - if (strcmp(input_file, "-") == 0) { - PERFETTO_ELOG( - "Bundle mode does not support stdin input, provide file path"); - return 1; - } - if (strcmp(output_file, "-") == 0) { - PERFETTO_ELOG( - "Bundle mode does not support stdout output, provide file path"); - return 1; - } - - // Validate input file exists and is readable - if (!base::FileExists(input_file)) { - PERFETTO_ELOG("Input file does not exist: %s", input_file); - return 1; - } - - trace_to_text::BundleContext context; - context.symbol_paths = symbol_paths; - context.proguard_maps = std::move(proguard_maps); - context.no_auto_symbol_paths = no_auto_symbol_paths; - context.no_auto_proguard_maps = no_auto_proguard_maps; - context.verbose = verbose; - if (const char* val = getenv("ANDROID_PRODUCT_OUT")) { - context.android_product_out = val; - } - if (const char* val = getenv("HOME")) { - context.home_dir = val; - } - context.root_dir = "/"; - return trace_to_text::TraceToBundle(input_file, output_file, context); - } - - return Usage(argv[0]); -} - -} // namespace - -int TraceconvMain(int argc, char** argv) { - return Main(argc, argv); -} - -} // namespace perfetto::traceconv diff --git a/src/traceconv/wasm_main.cc b/src/traceconv/wasm_main.cc new file mode 100644 index 00000000000..b2657140401 --- /dev/null +++ b/src/traceconv/wasm_main.cc @@ -0,0 +1,263 @@ +/* + * Copyright (C) 2026 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. + */ + +// Thin conversion-only entry point for the trace_processor "traceconv" WASM +// module used by the Perfetto UI (see ui/src/traceconv/index.ts). It exposes a +// trimmed traceconv-style CLI -- ` [input] [output]` -- covering only +// the format conversions the UI needs (json/systrace/profile and friends). The +// symbolize/deobfuscate/bundle modes are intentionally excluded: they are +// host-only and not invoked from the browser. The full host CLI lives in +// trace_processor_shell (the `convert`/`bundle`/`util` subcommands); this file +// is deliberately standalone so the WASM links only the lightweight +// src/traceconv:lib conversion code and not the rpc/httpd-heavy shell. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "perfetto/base/build_config.h" +#include "perfetto/base/logging.h" +#include "perfetto/ext/base/string_utils.h" +#include "src/protozero/text_to_proto/text_to_proto.h" +#include "src/traceconv/android_extension.descriptor.h" +#include "src/traceconv/trace.descriptor.h" +#include "src/traceconv/trace_to_firefox.h" +#include "src/traceconv/trace_to_json.h" +#include "src/traceconv/trace_to_profile.h" +#include "src/traceconv/trace_to_systrace.h" +#include "src/traceconv/trace_to_text.h" +#include "src/traceconv/trace_unpack.h" + +#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) +#include +#include +#else +#include +#endif + +namespace perfetto::traceconv { +namespace { + +int Usage(const char* argv0) { + fprintf(stderr, + "Usage: %s MODE [OPTIONS] [input_file] [output_file]\n" + "MODE is one of: json, systrace, ctrace, text, profile, " + "java_heap_profile, firefox, decompress_packets, binary.\n", + argv0); + return 1; +} + +uint64_t StringToUint64OrDie(const char* str) { + std::optional n = base::CStringToUInt64(str); + if (!n) { + PERFETTO_ELOG("Invalid %s. Expected decimal integer.", str); + exit(1); + } + return *n; +} + +int TextToTrace(std::istream* input, std::ostream* output) { + std::string trace_text(std::istreambuf_iterator{*input}, + std::istreambuf_iterator{}); + std::vector descriptors; + descriptors.reserve(kTraceDescriptor.size() + + kAndroidExtensionDescriptor.size()); + descriptors.insert(descriptors.end(), kTraceDescriptor.begin(), + kTraceDescriptor.end()); + descriptors.insert(descriptors.end(), kAndroidExtensionDescriptor.begin(), + kAndroidExtensionDescriptor.end()); + auto proto_status = + protozero::TextToProto(descriptors.data(), descriptors.size(), + ".perfetto.protos.Trace", "trace", trace_text); + if (!proto_status.ok()) { + PERFETTO_ELOG("Failed to parse trace: %s", + proto_status.status().c_message()); + return 1; + } + const std::vector& trace_proto = proto_status.value(); + output->write(reinterpret_cast(trace_proto.data()), + static_cast(trace_proto.size())); + return 0; +} + +int Main(int argc, char** argv) { + std::vector positional_args; + trace_to_text::Keep truncate_keep = trace_to_text::Keep::kAll; + uint64_t pid = 0; + std::vector timestamps; + bool full_sort = false; + std::optional profile_type; + bool profile_no_annotations = false; + bool verbose = false; + bool skip_unknown_fields = false; + std::string output_dir; + for (int i = 1; i < argc; i++) { + if (strcmp(argv[i], "-t") == 0 || strcmp(argv[i], "--truncate") == 0) { + i++; + if (i < argc && strcmp(argv[i], "start") == 0) { + truncate_keep = trace_to_text::Keep::kStart; + } else if (i < argc && strcmp(argv[i], "end") == 0) { + truncate_keep = trace_to_text::Keep::kEnd; + } else { + PERFETTO_ELOG( + "--truncate must specify whether to keep 'start' or 'end'."); + return Usage(argv[0]); + } + } else if (i < argc && strcmp(argv[i], "--pid") == 0) { + pid = StringToUint64OrDie(argv[++i]); + } else if (i < argc && strcmp(argv[i], "--timestamps") == 0) { + for (const std::string& ts : base::SplitString(argv[++i], ",")) { + timestamps.emplace_back(StringToUint64OrDie(ts.c_str())); + } + } else if (strcmp(argv[i], "--alloc") == 0) { + profile_type = trace_to_text::ConversionMode::kHeapProfile; + } else if (strcmp(argv[i], "--perf") == 0) { + profile_type = trace_to_text::ConversionMode::kPerfProfile; + } else if (strcmp(argv[i], "--java-heap") == 0) { + profile_type = trace_to_text::ConversionMode::kJavaHeapProfile; + } else if (strcmp(argv[i], "--no-annotations") == 0) { + profile_no_annotations = true; + } else if (strcmp(argv[i], "--full-sort") == 0) { + full_sort = true; + } else if (strcmp(argv[i], "--verbose") == 0) { + verbose = true; + } else if (i < argc && strcmp(argv[i], "--output-dir") == 0) { + output_dir = argv[++i]; + } else if (strcmp(argv[i], "--skip-unknown") == 0) { + skip_unknown_fields = true; + } else { + positional_args.push_back(argv[i]); + } + } + + if (positional_args.empty()) + return Usage(argv[0]); + + std::istream* input_stream; + std::ifstream file_istream; + if (positional_args.size() > 1) { + const char* file_path = positional_args[1]; + file_istream.open(file_path, std::ios_base::in | std::ios_base::binary); + if (!file_istream.is_open()) + PERFETTO_FATAL("Could not open %s", file_path); + input_stream = &file_istream; + } else { + input_stream = &std::cin; + } + +#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) + _setmode(_fileno(stdout), _O_BINARY); +#endif + + std::ostream* output_stream; + std::ofstream file_ostream; + if (positional_args.size() > 2) { + const char* file_path = positional_args[2]; + file_ostream.open(file_path, std::ios_base::out | std::ios_base::trunc | + std::ios_base::binary); + if (!file_ostream.is_open()) + PERFETTO_FATAL("Could not open %s", file_path); + output_stream = &file_ostream; + } else { + output_stream = &std::cout; + } + + std::string format(positional_args[0]); + + if ((format != "profile" && format != "java_heap_profile") && + (pid != 0 || !timestamps.empty())) { + PERFETTO_ELOG( + "--pid and --timestamps are supported only for profile formats."); + return 1; + } + if ((format != "profile" && format != "java_heap_profile") && + !output_dir.empty()) { + PERFETTO_ELOG("--output-dir is supported only for profile formats."); + return 1; + } + + if (format == "binary") + return TextToTrace(input_stream, output_stream); + + if (format == "json") + return trace_to_text::TraceToJson(input_stream, output_stream, + /*compress=*/false, truncate_keep, + full_sort); + + if (format == "systrace") + return trace_to_text::TraceToSystrace(input_stream, output_stream, + /*ctrace=*/false, truncate_keep, + full_sort); + + if (format == "ctrace") + return trace_to_text::TraceToSystrace(input_stream, output_stream, + /*ctrace=*/true, truncate_keep, + full_sort); + + if (truncate_keep != trace_to_text::Keep::kAll) { + PERFETTO_ELOG("--truncate is unsupported for the '%s' format.", + format.c_str()); + return 1; + } + if (full_sort) { + PERFETTO_ELOG("--full-sort is unsupported for the '%s' format.", + format.c_str()); + return 1; + } + + if (format == "text") { + trace_to_text::TraceToTextOptions options; + options.skip_unknown_fields = skip_unknown_fields; + return trace_to_text::TraceToText(input_stream, output_stream, options) ? 0 + : 1; + } + + if (format == "profile") + return trace_to_text::TraceToProfile(input_stream, pid, timestamps, + !profile_no_annotations, output_dir, + profile_type, verbose); + + if (format == "java_heap_profile") + return trace_to_text::TraceToProfile( + input_stream, pid, timestamps, !profile_no_annotations, output_dir, + trace_to_text::ConversionMode::kJavaHeapProfile, verbose); + + if (format == "firefox") + return trace_to_text::TraceToFirefoxProfile(input_stream, output_stream) + ? 0 + : 1; + + if (format == "decompress_packets") + return trace_to_text::UnpackCompressedPackets(input_stream, output_stream) + ? 0 + : 1; + + return Usage(argv[0]); +} + +} // namespace +} // namespace perfetto::traceconv + +int main(int argc, char** argv) { + return perfetto::traceconv::Main(argc, argv); +} diff --git a/tools/cpu_profile b/tools/cpu_profile index fc8b838df8a..1bd3430b3b6 100755 --- a/tools/cpu_profile +++ b/tools/cpu_profile @@ -35,19 +35,19 @@ import textwrap import time import uuid -# ----- Amalgamator: begin of python/perfetto/prebuilts/manifests/trace_processor_shell.py +# ----- Amalgamator: begin of python/perfetto/prebuilts/manifests/traceconv.py # This file has been generated by: tools/release/roll-prebuilts v57.2 -TRACE_PROCESSOR_SHELL_MANIFEST = [{ +TRACECONV_MANIFEST = [{ 'arch': 'mac-amd64', 'file_name': - 'trace_processor_shell', + 'traceconv', 'file_size': - 13787208, + 12119576, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/mac-amd64/trace_processor_shell', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/mac-amd64/traceconv', 'sha256': - 'c0f61397901da47cbe1bb9a0843624f7c2038ac92176ce15e3736ce9aa0afef0', + '2a97ff6d78190b4b87928c0ca4abefaa2162fd2f97aaac4278cdf28337472104', 'platform': 'darwin', 'machine': ['x86_64'] @@ -55,13 +55,13 @@ TRACE_PROCESSOR_SHELL_MANIFEST = [{ 'arch': 'mac-arm64', 'file_name': - 'trace_processor_shell', + 'traceconv', 'file_size': - 12704456, + 11175288, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/mac-arm64/trace_processor_shell', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/mac-arm64/traceconv', 'sha256': - '98a41b80e9f60da0373d64aff6455681f8c26b7c391ae5736324a5b11e3dacc2', + '2a4692f355fb48ad481d523a9f0b13d61f3693f233cba0b9fed25d639f74f892', 'platform': 'darwin', 'machine': ['arm64'] @@ -69,13 +69,13 @@ TRACE_PROCESSOR_SHELL_MANIFEST = [{ 'arch': 'linux-amd64', 'file_name': - 'trace_processor_shell', + 'traceconv', 'file_size': - 14008280, + 12291856, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-amd64/trace_processor_shell', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-amd64/traceconv', 'sha256': - '55ba613fc6d4f71df81eee2dbfc293020063655c241b3e314bff75345b802684', + '9fabfcc1e289770e0ebe74b0ce28d78e008c4a21e16256af46a67628f5d6a500', 'platform': 'linux', 'machine': ['x86_64'] @@ -83,13 +83,13 @@ TRACE_PROCESSOR_SHELL_MANIFEST = [{ 'arch': 'linux-arm', 'file_name': - 'trace_processor_shell', + 'traceconv', 'file_size': - 10321532, + 9257196, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-arm/trace_processor_shell', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-arm/traceconv', 'sha256': - '0f3221a1fb6dbe584c4bdc4a7541bcf15e6e5c5dde5e4910744dfb8913ee62c5', + '1a74626cac342214e711af6061cf4abe622eda48f13f55b2d300cc0f71ab2dc8', 'platform': 'linux', 'machine': ['armv6l', 'armv7l', 'armv8l'] @@ -97,13 +97,13 @@ TRACE_PROCESSOR_SHELL_MANIFEST = [{ 'arch': 'linux-arm64', 'file_name': - 'trace_processor_shell', + 'traceconv', 'file_size': - 13297064, + 11634904, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-arm64/trace_processor_shell', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-arm64/traceconv', 'sha256': - '1dcc1d9aaff2eb92e8bc58f1957e4e445600294bd61dbc09345c1018c5ff0868', + '54d58327671804790c91a6d98483b4e2f7e1d1b0fe4d2617b4a5a74ed6d8d602', 'platform': 'linux', 'machine': ['aarch64'] @@ -111,63 +111,63 @@ TRACE_PROCESSOR_SHELL_MANIFEST = [{ 'arch': 'android-arm', 'file_name': - 'trace_processor_shell', + 'traceconv', 'file_size': - 10293452, + 9238156, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-arm/trace_processor_shell', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-arm/traceconv', 'sha256': - 'a92d4138966a494bbf017d054fd9c859bf1a3deeca56dc6f84715292d87b6073' + '02c56f0ba2f412dacdf400a361b6004046b37452d0955b949f9635763a86a997' }, { 'arch': 'android-arm64', 'file_name': - 'trace_processor_shell', + 'traceconv', 'file_size': - 13098064, + 11491816, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-arm64/trace_processor_shell', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-arm64/traceconv', 'sha256': - '05e95758a26cf57fb8d552d3c1d532486681a6ecc4ee705a484a8deb4d092d09' + 'd7f44b723d2097d06de372995cfcbdb805e63bc8e95b54efd73745bb738fccf6' }, { 'arch': 'android-x86', 'file_name': - 'trace_processor_shell', + 'traceconv', 'file_size': - 14811628, + 12885868, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-x86/trace_processor_shell', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-x86/traceconv', 'sha256': - '21b72f5f2821f8e6c050ee3788df9043af1b83b5e90726c343405b4f3c9837a3' + '71eb7cb43d2156215c1f01ab227a049a46912e5d3186fb79dee549caf71de73f' }, { 'arch': 'android-x64', 'file_name': - 'trace_processor_shell', + 'traceconv', 'file_size': - 13724184, + 12060912, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-x64/trace_processor_shell', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-x64/traceconv', 'sha256': - '0e3fe6d80fc00891035e09b7dbf7fa6b2e9752282ac4b8f1ebe792377877f7d8' + '7d26485eda0a97f5926cc97ef861444b7ded9e1394c83c641a8bfc94663b7e0d' }, { 'arch': 'windows-amd64', 'file_name': - 'trace_processor_shell.exe', + 'traceconv.exe', 'file_size': - 13617152, + 11972096, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/windows-amd64/trace_processor_shell.exe', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/windows-amd64/traceconv.exe', 'sha256': - '100334b6091596fbc97f872556849a5747bf47a7f7190c485ba8cea8d2409c7b', + '11e83c6f8e9d9ec02ba88e7d84a7844d58014519ec1e6897787882ebebe00336', 'platform': 'win32', 'machine': ['amd64'] }] -# ----- Amalgamator: end of python/perfetto/prebuilts/manifests/trace_processor_shell.py +# ----- Amalgamator: end of python/perfetto/prebuilts/manifests/traceconv.py # ----- Amalgamator: begin of python/perfetto/prebuilts/perfetto_prebuilts.py # Copyright (C) 2021 The Android Open Source Project @@ -671,18 +671,17 @@ def record_trace(config, profile_target): adb_check_output(['adb', 'shell', 'rm', profile_device_path]) -def get_trace_processor(): - """Sets up and returns the path to `trace_processor`.""" +def get_traceconv(): + """Sets up and returns the path to `traceconv`.""" try: - trace_processor = get_perfetto_prebuilt( - TRACE_PROCESSOR_SHELL_MANIFEST, soft_fail=True) + traceconv = get_perfetto_prebuilt(TRACECONV_MANIFEST, soft_fail=True) except Exception as error: exit_with_bug_report(error) - if trace_processor is None: + if traceconv is None: exit_with_bug_report( - "Unable to download `trace_processor` for symbolizing profiles.") + "Unable to download `traceconv` for symbolizing profiles.") - return trace_processor + return traceconv def concatenate_files(files_to_concatenate, output_file): @@ -698,13 +697,12 @@ def concatenate_files(files_to_concatenate, output_file): shutil.copyfileobj(input, output) -def symbolize_trace(trace_processor, profile_target): +def symbolize_trace(traceconv, profile_target): """Attempts symbolization of the recorded trace/profile, if symbols are available. Args: - trace_processor: The path to the `trace_processor` binary used for - symbolization. + traceconv: The path to the `traceconv` binary used for symbolization. profile_target: The directory where the recorded trace was output. Returns: @@ -718,10 +716,11 @@ def symbolize_trace(trace_processor, profile_target): if binary_path is not None: try: with open(os.path.join(profile_target, 'symbols'), 'w') as symbols_file: - return_code = subprocess.call( - [trace_processor, 'util', 'symbolize', trace_file], - env=dict(os.environ, PERFETTO_BINARY_PATH=binary_path), - stdout=symbols_file) + return_code = subprocess.call([traceconv, 'symbolize', trace_file], + env=dict( + os.environ, + PERFETTO_BINARY_PATH=binary_path), + stdout=symbols_file) except IOError as error: sys.exit("Unable to write symbols to disk: {}".format(error)) if return_code == 0: @@ -739,27 +738,26 @@ def symbolize_trace(trace_processor, profile_target): return trace_file -def generate_pprof_profiles(trace_processor, trace_file, args): +def generate_pprof_profiles(traceconv, trace_file, args): """Generates pprof profiles from the recorded trace. Args: - trace_processor: The path to the `trace_processor` binary used for - generating profiles. + traceconv: The path to the `traceconv` binary used for generating profiles. trace_file: The oath to the recorded and potentially symbolized trace file. Returns: The directory where pprof profiles are output. """ try: - conversion_args = [trace_processor, 'convert', 'profile', '--perf'] + ( + conversion_args = [traceconv, 'profile', '--perf'] + ( ['--no-annotations'] if args.no_annotations else []) + [trace_file] - trace_processor_output = subprocess.check_output(conversion_args) + traceconv_output = subprocess.check_output(conversion_args) except Exception as error: exit_with_bug_report( "Unable to extract profiles from trace: {}".format(error)) profiles_output_directory = None - for word in trace_processor_output.decode('utf-8').split(): + for word in traceconv_output.decode('utf-8').split(): if 'perf_profile-' in word: profiles_output_directory = word if profiles_output_directory is None: @@ -790,11 +788,10 @@ def main(argv): print(trace_config) return 0 record_trace(trace_config, profile_target) - trace_processor = get_trace_processor() - trace_file = symbolize_trace(trace_processor, profile_target) + traceconv = get_traceconv() + trace_file = symbolize_trace(traceconv, profile_target) copy_profiles_to_destination( - profile_target, generate_pprof_profiles(trace_processor, trace_file, - args)) + profile_target, generate_pprof_profiles(traceconv, trace_file, args)) return 0 diff --git a/tools/gen_android_bp b/tools/gen_android_bp index 42d49076af0..134e2e39138 100755 --- a/tools/gen_android_bp +++ b/tools/gen_android_bp @@ -101,7 +101,6 @@ protozero_descriptor_diff_target = '//src/protozero/descriptor_diff:protozero_de gn_utils.HOST_TOOLCHAIN) default_targets += [ - '//src/traceconv:traceconv(%s)' % gn_utils.HOST_TOOLCHAIN, '//src/tools:tracing_proto_extensions(%s)' % gn_utils.HOST_TOOLCHAIN, '//src/protovm/compiler:protovm_compiler(%s)' % gn_utils.HOST_TOOLCHAIN, protozero_plugin, @@ -202,7 +201,6 @@ transitive_proto_filegroups = { needs_libfts = [ '//:perfetto_unittests', '//src/trace_processor:trace_processor_shell_lib', - '//src/traceconv:traceconv', ] # All module names are prefixed with this string to avoid collisions. @@ -935,8 +933,8 @@ class Blueprint(object): def label_to_module_name(label: str): """Turn a GN label (e.g., //:perfetto_tests) into a module name.""" # If the label is explicibly listed in the default target list, don't prefix - # its name and return just the target name. This is so tools like - # "traceconv" stay as such in the Android tree. + # its name and return just the target name. This is so host tools keep their + # bare name in the Android tree. label_without_toolchain = gn_utils.label_without_toolchain(label) if label in default_targets or label_without_toolchain in default_targets: return label_without_toolchain.split(':')[-1] diff --git a/tools/gen_bazel b/tools/gen_bazel index 1ad9bc7a435..76be68f34b1 100755 --- a/tools/gen_bazel +++ b/tools/gen_bazel @@ -97,7 +97,6 @@ public_targets = [ '//src/traced/service:traced', '//src/trace_processor:trace_processor_shell', '//src/trace_processor:trace_processor', - '//src/traceconv:traceconv', ] # These targets will be exported with visibility only to our allowlist. diff --git a/tools/heap_profile b/tools/heap_profile index a1ea17b7963..b0c2466da43 100755 --- a/tools/heap_profile +++ b/tools/heap_profile @@ -200,19 +200,19 @@ TRACEBOX_MANIFEST = [{ # ----- Amalgamator: end of python/perfetto/prebuilts/manifests/tracebox.py -# ----- Amalgamator: begin of python/perfetto/prebuilts/manifests/trace_processor_shell.py +# ----- Amalgamator: begin of python/perfetto/prebuilts/manifests/traceconv.py # This file has been generated by: tools/release/roll-prebuilts v57.2 -TRACE_PROCESSOR_SHELL_MANIFEST = [{ +TRACECONV_MANIFEST = [{ 'arch': 'mac-amd64', 'file_name': - 'trace_processor_shell', + 'traceconv', 'file_size': - 13787208, + 12119576, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/mac-amd64/trace_processor_shell', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/mac-amd64/traceconv', 'sha256': - 'c0f61397901da47cbe1bb9a0843624f7c2038ac92176ce15e3736ce9aa0afef0', + '2a97ff6d78190b4b87928c0ca4abefaa2162fd2f97aaac4278cdf28337472104', 'platform': 'darwin', 'machine': ['x86_64'] @@ -220,13 +220,13 @@ TRACE_PROCESSOR_SHELL_MANIFEST = [{ 'arch': 'mac-arm64', 'file_name': - 'trace_processor_shell', + 'traceconv', 'file_size': - 12704456, + 11175288, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/mac-arm64/trace_processor_shell', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/mac-arm64/traceconv', 'sha256': - '98a41b80e9f60da0373d64aff6455681f8c26b7c391ae5736324a5b11e3dacc2', + '2a4692f355fb48ad481d523a9f0b13d61f3693f233cba0b9fed25d639f74f892', 'platform': 'darwin', 'machine': ['arm64'] @@ -234,13 +234,13 @@ TRACE_PROCESSOR_SHELL_MANIFEST = [{ 'arch': 'linux-amd64', 'file_name': - 'trace_processor_shell', + 'traceconv', 'file_size': - 14008280, + 12291856, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-amd64/trace_processor_shell', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-amd64/traceconv', 'sha256': - '55ba613fc6d4f71df81eee2dbfc293020063655c241b3e314bff75345b802684', + '9fabfcc1e289770e0ebe74b0ce28d78e008c4a21e16256af46a67628f5d6a500', 'platform': 'linux', 'machine': ['x86_64'] @@ -248,13 +248,13 @@ TRACE_PROCESSOR_SHELL_MANIFEST = [{ 'arch': 'linux-arm', 'file_name': - 'trace_processor_shell', + 'traceconv', 'file_size': - 10321532, + 9257196, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-arm/trace_processor_shell', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-arm/traceconv', 'sha256': - '0f3221a1fb6dbe584c4bdc4a7541bcf15e6e5c5dde5e4910744dfb8913ee62c5', + '1a74626cac342214e711af6061cf4abe622eda48f13f55b2d300cc0f71ab2dc8', 'platform': 'linux', 'machine': ['armv6l', 'armv7l', 'armv8l'] @@ -262,13 +262,13 @@ TRACE_PROCESSOR_SHELL_MANIFEST = [{ 'arch': 'linux-arm64', 'file_name': - 'trace_processor_shell', + 'traceconv', 'file_size': - 13297064, + 11634904, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-arm64/trace_processor_shell', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-arm64/traceconv', 'sha256': - '1dcc1d9aaff2eb92e8bc58f1957e4e445600294bd61dbc09345c1018c5ff0868', + '54d58327671804790c91a6d98483b4e2f7e1d1b0fe4d2617b4a5a74ed6d8d602', 'platform': 'linux', 'machine': ['aarch64'] @@ -276,63 +276,63 @@ TRACE_PROCESSOR_SHELL_MANIFEST = [{ 'arch': 'android-arm', 'file_name': - 'trace_processor_shell', + 'traceconv', 'file_size': - 10293452, + 9238156, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-arm/trace_processor_shell', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-arm/traceconv', 'sha256': - 'a92d4138966a494bbf017d054fd9c859bf1a3deeca56dc6f84715292d87b6073' + '02c56f0ba2f412dacdf400a361b6004046b37452d0955b949f9635763a86a997' }, { 'arch': 'android-arm64', 'file_name': - 'trace_processor_shell', + 'traceconv', 'file_size': - 13098064, + 11491816, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-arm64/trace_processor_shell', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-arm64/traceconv', 'sha256': - '05e95758a26cf57fb8d552d3c1d532486681a6ecc4ee705a484a8deb4d092d09' + 'd7f44b723d2097d06de372995cfcbdb805e63bc8e95b54efd73745bb738fccf6' }, { 'arch': 'android-x86', 'file_name': - 'trace_processor_shell', + 'traceconv', 'file_size': - 14811628, + 12885868, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-x86/trace_processor_shell', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-x86/traceconv', 'sha256': - '21b72f5f2821f8e6c050ee3788df9043af1b83b5e90726c343405b4f3c9837a3' + '71eb7cb43d2156215c1f01ab227a049a46912e5d3186fb79dee549caf71de73f' }, { 'arch': 'android-x64', 'file_name': - 'trace_processor_shell', + 'traceconv', 'file_size': - 13724184, + 12060912, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-x64/trace_processor_shell', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-x64/traceconv', 'sha256': - '0e3fe6d80fc00891035e09b7dbf7fa6b2e9752282ac4b8f1ebe792377877f7d8' + '7d26485eda0a97f5926cc97ef861444b7ded9e1394c83c641a8bfc94663b7e0d' }, { 'arch': 'windows-amd64', 'file_name': - 'trace_processor_shell.exe', + 'traceconv.exe', 'file_size': - 13617152, + 11972096, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/windows-amd64/trace_processor_shell.exe', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/windows-amd64/traceconv.exe', 'sha256': - '100334b6091596fbc97f872556849a5747bf47a7f7190c485ba8cea8d2409c7b', + '11e83c6f8e9d9ec02ba88e7d84a7844d58014519ec1e6897787882ebebe00336', 'platform': 'win32', 'machine': ['amd64'] }] -# ----- Amalgamator: end of python/perfetto/prebuilts/manifests/trace_processor_shell.py +# ----- Amalgamator: end of python/perfetto/prebuilts/manifests/traceconv.py # ----- Amalgamator: begin of python/perfetto/prebuilts/perfetto_prebuilts.py # Copyright (C) 2021 The Android Open Source Project @@ -590,10 +590,10 @@ def arg_order(action): return result, action.option_strings[0].strip('-') -def process_trace(trace_file, profile_target, trace_processor_binary, args, +def process_trace(trace_file, profile_target, traceconv_binary, args, android_mode): - """Convert a raw trace to pprof via trace_processor. Returns an exit code.""" - if trace_processor_binary is None: + """Convert a raw trace to pprof via traceconv. Returns an exit code.""" + if traceconv_binary is None: print('Wrote profile to {}'.format(trace_file)) print( 'This file can be opened using the Perfetto UI, https://ui.perfetto.dev' @@ -614,10 +614,10 @@ def process_trace(trace_file, profile_target, trace_processor_binary, args, if binary_path is not None: symbols_path = os.path.join(profile_target, 'symbols') with open(symbols_path, 'w') as fd: - ret = subprocess.call( - [trace_processor_binary, 'util', 'symbolize', trace_file], - env=dict(os.environ, PERFETTO_BINARY_PATH=binary_path), - stdout=fd) + ret = subprocess.call([traceconv_binary, 'symbolize', trace_file], + env=dict( + os.environ, PERFETTO_BINARY_PATH=binary_path), + stdout=fd) if ret == 0: concat_files.append(symbols_path) else: @@ -628,10 +628,11 @@ def process_trace(trace_file, profile_target, trace_processor_binary, args, if proguard_map is not None: deobf_path = os.path.join(profile_target, 'deobfuscation-packets') with open(deobf_path, 'w') as fd: - ret = subprocess.call( - [trace_processor_binary, 'util', 'deobfuscate', trace_file], - env=dict(os.environ, PERFETTO_PROGUARD_MAP=proguard_map), - stdout=fd) + ret = subprocess.call([traceconv_binary, 'deobfuscate', trace_file], + env=dict( + os.environ, + PERFETTO_PROGUARD_MAP=proguard_map), + stdout=fd) if ret == 0: concat_files.append(deobf_path) else: @@ -651,12 +652,12 @@ def process_trace(trace_file, profile_target, trace_processor_binary, args, out.write(buf) trace_file = symbolized_path - conversion_args = [trace_processor_binary, 'convert', 'profile'] + ( + conversion_args = [traceconv_binary, 'profile'] + ( ['--no-annotations'] if args.no_annotations else []) + [trace_file] - trace_processor_output = subprocess.check_output( + traceconv_output = subprocess.check_output( conversion_args, stderr=subprocess.STDOUT) profile_path = None - for word in trace_processor_output.decode('utf-8').split(): + for word in traceconv_output.decode('utf-8').split(): if 'heap_profile-' in word: profile_path = word if profile_path is None: @@ -693,7 +694,7 @@ def process_trace(trace_file, profile_target, trace_processor_binary, args, return 0 -def linux_main(args, cfg, cmd, trace_processor_binary): +def linux_main(args, cfg, cmd, traceconv_binary): """Run a local heap profile session on Linux using LD_PRELOAD.""" tracebox_binary = args.tracebox_binary if tracebox_binary is None: @@ -772,11 +773,7 @@ def linux_main(args, cfg, cmd, trace_processor_binary): perfetto_proc.wait() return process_trace( - trace_output, - profile_target, - trace_processor_binary, - args, - android_mode=False) + trace_output, profile_target, traceconv_binary, args, android_mode=False) def print_options(parser): @@ -907,8 +904,7 @@ def main(argv): help="Get simpleperf profile of heapprofd. This is " "only for heapprofd development.") common.add_argument( - "--trace-processor-binary", - help="Path to local trace_processor. For debugging.") + "--traceconv-binary", help="Path to local trace to text. For debugging.") common.add_argument( "--no-annotations", help="Do not suffix the pprof function names with Android ART mode " @@ -1050,7 +1046,7 @@ def main(argv): parser.print_help() return 1 - trace_processor_binary = args.trace_processor_binary + traceconv_binary = args.traceconv_binary if args.continuous_dump: target_cfg += CONTINUOUS_DUMP.format(dump_interval=args.continuous_dump) @@ -1067,14 +1063,13 @@ def main(argv): print(cfg) return 0 - # Do this AFTER print_config so we do not download trace_processor only to + # Do this AFTER print_config so we do not download traceconv only to # print out the config. - if trace_processor_binary is None: - trace_processor_binary = get_perfetto_prebuilt( - TRACE_PROCESSOR_SHELL_MANIFEST, soft_fail=True) + if traceconv_binary is None: + traceconv_binary = get_perfetto_prebuilt(TRACECONV_MANIFEST, soft_fail=True) if args.subcommand == 'host': - return linux_main(args, cfg, cmd, trace_processor_binary) + return linux_main(args, cfg, cmd, traceconv_binary) # --- Android path --- @@ -1179,7 +1174,7 @@ def main(argv): return process_trace( profile_host_path, profile_target, - trace_processor_binary, + traceconv_binary, args, android_mode=True) diff --git a/tools/release/package-github-release-artifacts b/tools/release/package-github-release-artifacts index 5f0baedb91b..932346443c4 100755 --- a/tools/release/package-github-release-artifacts +++ b/tools/release/package-github-release-artifacts @@ -44,9 +44,6 @@ _ARTIFACTS = [ { 'name': 'trace_processor_shell' }, - { - 'name': 'traceconv' - }, { 'name': 'tracebox', 'exclude_platforms': ['windows-amd64'], From 52888f79049dac325a7828ad935521f10fa4057e Mon Sep 17 00:00:00 2001 From: Lalit Maganti Date: Mon, 3 Aug 2026 11:13:49 +0100 Subject: [PATCH 2/2] perfetto: point profile scripts at trace_processor_shell cpu_profile and heap_profile were migrated off the standalone traceconv binary alongside #6417, but had to be reverted in #6410: the scripts pin the v57.2 prebuilt, and v57.2's trace_processor_shell predates the util symbolize / util deobfuscate subcommands they need. The v57.2 traceconv prebuilt keeps them working in the meantime. Re-apply the migration so it is ready to land once the v58 prebuilts are released and rolled. DO NOT MERGE until the v58 prebuilt roll has landed. After the roll, re-run tools/gen_amalgamated_python_tools so the amalgamated scripts pick up the v58 manifests. --- python/tools/cpu_profile.py | 47 ++++++------ python/tools/heap_profile.py | 55 +++++++------- tools/cpu_profile | 131 +++++++++++++++++---------------- tools/heap_profile | 139 ++++++++++++++++++----------------- 4 files changed, 194 insertions(+), 178 deletions(-) diff --git a/python/tools/cpu_profile.py b/python/tools/cpu_profile.py index 3723ecfeaa4..c3bda91d55c 100644 --- a/python/tools/cpu_profile.py +++ b/python/tools/cpu_profile.py @@ -31,7 +31,7 @@ import time import uuid -from perfetto.prebuilts.manifests.traceconv import * +from perfetto.prebuilts.manifests.trace_processor_shell import * from perfetto.prebuilts.perfetto_prebuilts import * # Used for creating directories, etc. @@ -394,17 +394,18 @@ def record_trace(config, profile_target): adb_check_output(['adb', 'shell', 'rm', profile_device_path]) -def get_traceconv(): - """Sets up and returns the path to `traceconv`.""" +def get_trace_processor(): + """Sets up and returns the path to `trace_processor`.""" try: - traceconv = get_perfetto_prebuilt(TRACECONV_MANIFEST, soft_fail=True) + trace_processor = get_perfetto_prebuilt( + TRACE_PROCESSOR_SHELL_MANIFEST, soft_fail=True) except Exception as error: exit_with_bug_report(error) - if traceconv is None: + if trace_processor is None: exit_with_bug_report( - "Unable to download `traceconv` for symbolizing profiles.") + "Unable to download `trace_processor` for symbolizing profiles.") - return traceconv + return trace_processor def concatenate_files(files_to_concatenate, output_file): @@ -420,12 +421,13 @@ def concatenate_files(files_to_concatenate, output_file): shutil.copyfileobj(input, output) -def symbolize_trace(traceconv, profile_target): +def symbolize_trace(trace_processor, profile_target): """Attempts symbolization of the recorded trace/profile, if symbols are available. Args: - traceconv: The path to the `traceconv` binary used for symbolization. + trace_processor: The path to the `trace_processor` binary used for + symbolization. profile_target: The directory where the recorded trace was output. Returns: @@ -439,11 +441,10 @@ def symbolize_trace(traceconv, profile_target): if binary_path is not None: try: with open(os.path.join(profile_target, 'symbols'), 'w') as symbols_file: - return_code = subprocess.call([traceconv, 'symbolize', trace_file], - env=dict( - os.environ, - PERFETTO_BINARY_PATH=binary_path), - stdout=symbols_file) + return_code = subprocess.call( + [trace_processor, 'util', 'symbolize', trace_file], + env=dict(os.environ, PERFETTO_BINARY_PATH=binary_path), + stdout=symbols_file) except IOError as error: sys.exit("Unable to write symbols to disk: {}".format(error)) if return_code == 0: @@ -461,26 +462,27 @@ def symbolize_trace(traceconv, profile_target): return trace_file -def generate_pprof_profiles(traceconv, trace_file, args): +def generate_pprof_profiles(trace_processor, trace_file, args): """Generates pprof profiles from the recorded trace. Args: - traceconv: The path to the `traceconv` binary used for generating profiles. + trace_processor: The path to the `trace_processor` binary used for + generating profiles. trace_file: The oath to the recorded and potentially symbolized trace file. Returns: The directory where pprof profiles are output. """ try: - conversion_args = [traceconv, 'profile', '--perf'] + ( + conversion_args = [trace_processor, 'convert', 'profile', '--perf'] + ( ['--no-annotations'] if args.no_annotations else []) + [trace_file] - traceconv_output = subprocess.check_output(conversion_args) + trace_processor_output = subprocess.check_output(conversion_args) except Exception as error: exit_with_bug_report( "Unable to extract profiles from trace: {}".format(error)) profiles_output_directory = None - for word in traceconv_output.decode('utf-8').split(): + for word in trace_processor_output.decode('utf-8').split(): if 'perf_profile-' in word: profiles_output_directory = word if profiles_output_directory is None: @@ -511,10 +513,11 @@ def main(argv): print(trace_config) return 0 record_trace(trace_config, profile_target) - traceconv = get_traceconv() - trace_file = symbolize_trace(traceconv, profile_target) + trace_processor = get_trace_processor() + trace_file = symbolize_trace(trace_processor, profile_target) copy_profiles_to_destination( - profile_target, generate_pprof_profiles(traceconv, trace_file, args)) + profile_target, generate_pprof_profiles(trace_processor, trace_file, + args)) return 0 diff --git a/python/tools/heap_profile.py b/python/tools/heap_profile.py index 9eacbabc32e..6e8243ecc19 100644 --- a/python/tools/heap_profile.py +++ b/python/tools/heap_profile.py @@ -30,7 +30,7 @@ from perfetto.prebuilts.manifests.heapprofd_glibc_preload import * from perfetto.prebuilts.manifests.tracebox import * -from perfetto.prebuilts.manifests.traceconv import * +from perfetto.prebuilts.manifests.trace_processor_shell import * from perfetto.prebuilts.perfetto_prebuilts import * NULL = open(os.devnull) @@ -147,10 +147,10 @@ def arg_order(action): return result, action.option_strings[0].strip('-') -def process_trace(trace_file, profile_target, traceconv_binary, args, +def process_trace(trace_file, profile_target, trace_processor_binary, args, android_mode): - """Convert a raw trace to pprof via traceconv. Returns an exit code.""" - if traceconv_binary is None: + """Convert a raw trace to pprof via trace_processor. Returns an exit code.""" + if trace_processor_binary is None: print('Wrote profile to {}'.format(trace_file)) print( 'This file can be opened using the Perfetto UI, https://ui.perfetto.dev' @@ -171,10 +171,10 @@ def process_trace(trace_file, profile_target, traceconv_binary, args, if binary_path is not None: symbols_path = os.path.join(profile_target, 'symbols') with open(symbols_path, 'w') as fd: - ret = subprocess.call([traceconv_binary, 'symbolize', trace_file], - env=dict( - os.environ, PERFETTO_BINARY_PATH=binary_path), - stdout=fd) + ret = subprocess.call( + [trace_processor_binary, 'util', 'symbolize', trace_file], + env=dict(os.environ, PERFETTO_BINARY_PATH=binary_path), + stdout=fd) if ret == 0: concat_files.append(symbols_path) else: @@ -185,11 +185,10 @@ def process_trace(trace_file, profile_target, traceconv_binary, args, if proguard_map is not None: deobf_path = os.path.join(profile_target, 'deobfuscation-packets') with open(deobf_path, 'w') as fd: - ret = subprocess.call([traceconv_binary, 'deobfuscate', trace_file], - env=dict( - os.environ, - PERFETTO_PROGUARD_MAP=proguard_map), - stdout=fd) + ret = subprocess.call( + [trace_processor_binary, 'util', 'deobfuscate', trace_file], + env=dict(os.environ, PERFETTO_PROGUARD_MAP=proguard_map), + stdout=fd) if ret == 0: concat_files.append(deobf_path) else: @@ -209,12 +208,12 @@ def process_trace(trace_file, profile_target, traceconv_binary, args, out.write(buf) trace_file = symbolized_path - conversion_args = [traceconv_binary, 'profile'] + ( + conversion_args = [trace_processor_binary, 'convert', 'profile'] + ( ['--no-annotations'] if args.no_annotations else []) + [trace_file] - traceconv_output = subprocess.check_output( + trace_processor_output = subprocess.check_output( conversion_args, stderr=subprocess.STDOUT) profile_path = None - for word in traceconv_output.decode('utf-8').split(): + for word in trace_processor_output.decode('utf-8').split(): if 'heap_profile-' in word: profile_path = word if profile_path is None: @@ -251,7 +250,7 @@ def process_trace(trace_file, profile_target, traceconv_binary, args, return 0 -def linux_main(args, cfg, cmd, traceconv_binary): +def linux_main(args, cfg, cmd, trace_processor_binary): """Run a local heap profile session on Linux using LD_PRELOAD.""" tracebox_binary = args.tracebox_binary if tracebox_binary is None: @@ -330,7 +329,11 @@ def linux_main(args, cfg, cmd, traceconv_binary): perfetto_proc.wait() return process_trace( - trace_output, profile_target, traceconv_binary, args, android_mode=False) + trace_output, + profile_target, + trace_processor_binary, + args, + android_mode=False) def print_options(parser): @@ -461,7 +464,8 @@ def main(argv): help="Get simpleperf profile of heapprofd. This is " "only for heapprofd development.") common.add_argument( - "--traceconv-binary", help="Path to local trace to text. For debugging.") + "--trace-processor-binary", + help="Path to local trace_processor. For debugging.") common.add_argument( "--no-annotations", help="Do not suffix the pprof function names with Android ART mode " @@ -603,7 +607,7 @@ def main(argv): parser.print_help() return 1 - traceconv_binary = args.traceconv_binary + trace_processor_binary = args.trace_processor_binary if args.continuous_dump: target_cfg += CONTINUOUS_DUMP.format(dump_interval=args.continuous_dump) @@ -620,13 +624,14 @@ def main(argv): print(cfg) return 0 - # Do this AFTER print_config so we do not download traceconv only to + # Do this AFTER print_config so we do not download trace_processor only to # print out the config. - if traceconv_binary is None: - traceconv_binary = get_perfetto_prebuilt(TRACECONV_MANIFEST, soft_fail=True) + if trace_processor_binary is None: + trace_processor_binary = get_perfetto_prebuilt( + TRACE_PROCESSOR_SHELL_MANIFEST, soft_fail=True) if args.subcommand == 'host': - return linux_main(args, cfg, cmd, traceconv_binary) + return linux_main(args, cfg, cmd, trace_processor_binary) # --- Android path --- @@ -731,7 +736,7 @@ def main(argv): return process_trace( profile_host_path, profile_target, - traceconv_binary, + trace_processor_binary, args, android_mode=True) diff --git a/tools/cpu_profile b/tools/cpu_profile index 1bd3430b3b6..fc8b838df8a 100755 --- a/tools/cpu_profile +++ b/tools/cpu_profile @@ -35,19 +35,19 @@ import textwrap import time import uuid -# ----- Amalgamator: begin of python/perfetto/prebuilts/manifests/traceconv.py +# ----- Amalgamator: begin of python/perfetto/prebuilts/manifests/trace_processor_shell.py # This file has been generated by: tools/release/roll-prebuilts v57.2 -TRACECONV_MANIFEST = [{ +TRACE_PROCESSOR_SHELL_MANIFEST = [{ 'arch': 'mac-amd64', 'file_name': - 'traceconv', + 'trace_processor_shell', 'file_size': - 12119576, + 13787208, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/mac-amd64/traceconv', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/mac-amd64/trace_processor_shell', 'sha256': - '2a97ff6d78190b4b87928c0ca4abefaa2162fd2f97aaac4278cdf28337472104', + 'c0f61397901da47cbe1bb9a0843624f7c2038ac92176ce15e3736ce9aa0afef0', 'platform': 'darwin', 'machine': ['x86_64'] @@ -55,13 +55,13 @@ TRACECONV_MANIFEST = [{ 'arch': 'mac-arm64', 'file_name': - 'traceconv', + 'trace_processor_shell', 'file_size': - 11175288, + 12704456, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/mac-arm64/traceconv', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/mac-arm64/trace_processor_shell', 'sha256': - '2a4692f355fb48ad481d523a9f0b13d61f3693f233cba0b9fed25d639f74f892', + '98a41b80e9f60da0373d64aff6455681f8c26b7c391ae5736324a5b11e3dacc2', 'platform': 'darwin', 'machine': ['arm64'] @@ -69,13 +69,13 @@ TRACECONV_MANIFEST = [{ 'arch': 'linux-amd64', 'file_name': - 'traceconv', + 'trace_processor_shell', 'file_size': - 12291856, + 14008280, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-amd64/traceconv', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-amd64/trace_processor_shell', 'sha256': - '9fabfcc1e289770e0ebe74b0ce28d78e008c4a21e16256af46a67628f5d6a500', + '55ba613fc6d4f71df81eee2dbfc293020063655c241b3e314bff75345b802684', 'platform': 'linux', 'machine': ['x86_64'] @@ -83,13 +83,13 @@ TRACECONV_MANIFEST = [{ 'arch': 'linux-arm', 'file_name': - 'traceconv', + 'trace_processor_shell', 'file_size': - 9257196, + 10321532, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-arm/traceconv', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-arm/trace_processor_shell', 'sha256': - '1a74626cac342214e711af6061cf4abe622eda48f13f55b2d300cc0f71ab2dc8', + '0f3221a1fb6dbe584c4bdc4a7541bcf15e6e5c5dde5e4910744dfb8913ee62c5', 'platform': 'linux', 'machine': ['armv6l', 'armv7l', 'armv8l'] @@ -97,13 +97,13 @@ TRACECONV_MANIFEST = [{ 'arch': 'linux-arm64', 'file_name': - 'traceconv', + 'trace_processor_shell', 'file_size': - 11634904, + 13297064, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-arm64/traceconv', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-arm64/trace_processor_shell', 'sha256': - '54d58327671804790c91a6d98483b4e2f7e1d1b0fe4d2617b4a5a74ed6d8d602', + '1dcc1d9aaff2eb92e8bc58f1957e4e445600294bd61dbc09345c1018c5ff0868', 'platform': 'linux', 'machine': ['aarch64'] @@ -111,63 +111,63 @@ TRACECONV_MANIFEST = [{ 'arch': 'android-arm', 'file_name': - 'traceconv', + 'trace_processor_shell', 'file_size': - 9238156, + 10293452, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-arm/traceconv', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-arm/trace_processor_shell', 'sha256': - '02c56f0ba2f412dacdf400a361b6004046b37452d0955b949f9635763a86a997' + 'a92d4138966a494bbf017d054fd9c859bf1a3deeca56dc6f84715292d87b6073' }, { 'arch': 'android-arm64', 'file_name': - 'traceconv', + 'trace_processor_shell', 'file_size': - 11491816, + 13098064, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-arm64/traceconv', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-arm64/trace_processor_shell', 'sha256': - 'd7f44b723d2097d06de372995cfcbdb805e63bc8e95b54efd73745bb738fccf6' + '05e95758a26cf57fb8d552d3c1d532486681a6ecc4ee705a484a8deb4d092d09' }, { 'arch': 'android-x86', 'file_name': - 'traceconv', + 'trace_processor_shell', 'file_size': - 12885868, + 14811628, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-x86/traceconv', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-x86/trace_processor_shell', 'sha256': - '71eb7cb43d2156215c1f01ab227a049a46912e5d3186fb79dee549caf71de73f' + '21b72f5f2821f8e6c050ee3788df9043af1b83b5e90726c343405b4f3c9837a3' }, { 'arch': 'android-x64', 'file_name': - 'traceconv', + 'trace_processor_shell', 'file_size': - 12060912, + 13724184, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-x64/traceconv', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-x64/trace_processor_shell', 'sha256': - '7d26485eda0a97f5926cc97ef861444b7ded9e1394c83c641a8bfc94663b7e0d' + '0e3fe6d80fc00891035e09b7dbf7fa6b2e9752282ac4b8f1ebe792377877f7d8' }, { 'arch': 'windows-amd64', 'file_name': - 'traceconv.exe', + 'trace_processor_shell.exe', 'file_size': - 11972096, + 13617152, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/windows-amd64/traceconv.exe', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/windows-amd64/trace_processor_shell.exe', 'sha256': - '11e83c6f8e9d9ec02ba88e7d84a7844d58014519ec1e6897787882ebebe00336', + '100334b6091596fbc97f872556849a5747bf47a7f7190c485ba8cea8d2409c7b', 'platform': 'win32', 'machine': ['amd64'] }] -# ----- Amalgamator: end of python/perfetto/prebuilts/manifests/traceconv.py +# ----- Amalgamator: end of python/perfetto/prebuilts/manifests/trace_processor_shell.py # ----- Amalgamator: begin of python/perfetto/prebuilts/perfetto_prebuilts.py # Copyright (C) 2021 The Android Open Source Project @@ -671,17 +671,18 @@ def record_trace(config, profile_target): adb_check_output(['adb', 'shell', 'rm', profile_device_path]) -def get_traceconv(): - """Sets up and returns the path to `traceconv`.""" +def get_trace_processor(): + """Sets up and returns the path to `trace_processor`.""" try: - traceconv = get_perfetto_prebuilt(TRACECONV_MANIFEST, soft_fail=True) + trace_processor = get_perfetto_prebuilt( + TRACE_PROCESSOR_SHELL_MANIFEST, soft_fail=True) except Exception as error: exit_with_bug_report(error) - if traceconv is None: + if trace_processor is None: exit_with_bug_report( - "Unable to download `traceconv` for symbolizing profiles.") + "Unable to download `trace_processor` for symbolizing profiles.") - return traceconv + return trace_processor def concatenate_files(files_to_concatenate, output_file): @@ -697,12 +698,13 @@ def concatenate_files(files_to_concatenate, output_file): shutil.copyfileobj(input, output) -def symbolize_trace(traceconv, profile_target): +def symbolize_trace(trace_processor, profile_target): """Attempts symbolization of the recorded trace/profile, if symbols are available. Args: - traceconv: The path to the `traceconv` binary used for symbolization. + trace_processor: The path to the `trace_processor` binary used for + symbolization. profile_target: The directory where the recorded trace was output. Returns: @@ -716,11 +718,10 @@ def symbolize_trace(traceconv, profile_target): if binary_path is not None: try: with open(os.path.join(profile_target, 'symbols'), 'w') as symbols_file: - return_code = subprocess.call([traceconv, 'symbolize', trace_file], - env=dict( - os.environ, - PERFETTO_BINARY_PATH=binary_path), - stdout=symbols_file) + return_code = subprocess.call( + [trace_processor, 'util', 'symbolize', trace_file], + env=dict(os.environ, PERFETTO_BINARY_PATH=binary_path), + stdout=symbols_file) except IOError as error: sys.exit("Unable to write symbols to disk: {}".format(error)) if return_code == 0: @@ -738,26 +739,27 @@ def symbolize_trace(traceconv, profile_target): return trace_file -def generate_pprof_profiles(traceconv, trace_file, args): +def generate_pprof_profiles(trace_processor, trace_file, args): """Generates pprof profiles from the recorded trace. Args: - traceconv: The path to the `traceconv` binary used for generating profiles. + trace_processor: The path to the `trace_processor` binary used for + generating profiles. trace_file: The oath to the recorded and potentially symbolized trace file. Returns: The directory where pprof profiles are output. """ try: - conversion_args = [traceconv, 'profile', '--perf'] + ( + conversion_args = [trace_processor, 'convert', 'profile', '--perf'] + ( ['--no-annotations'] if args.no_annotations else []) + [trace_file] - traceconv_output = subprocess.check_output(conversion_args) + trace_processor_output = subprocess.check_output(conversion_args) except Exception as error: exit_with_bug_report( "Unable to extract profiles from trace: {}".format(error)) profiles_output_directory = None - for word in traceconv_output.decode('utf-8').split(): + for word in trace_processor_output.decode('utf-8').split(): if 'perf_profile-' in word: profiles_output_directory = word if profiles_output_directory is None: @@ -788,10 +790,11 @@ def main(argv): print(trace_config) return 0 record_trace(trace_config, profile_target) - traceconv = get_traceconv() - trace_file = symbolize_trace(traceconv, profile_target) + trace_processor = get_trace_processor() + trace_file = symbolize_trace(trace_processor, profile_target) copy_profiles_to_destination( - profile_target, generate_pprof_profiles(traceconv, trace_file, args)) + profile_target, generate_pprof_profiles(trace_processor, trace_file, + args)) return 0 diff --git a/tools/heap_profile b/tools/heap_profile index b0c2466da43..a1ea17b7963 100755 --- a/tools/heap_profile +++ b/tools/heap_profile @@ -200,19 +200,19 @@ TRACEBOX_MANIFEST = [{ # ----- Amalgamator: end of python/perfetto/prebuilts/manifests/tracebox.py -# ----- Amalgamator: begin of python/perfetto/prebuilts/manifests/traceconv.py +# ----- Amalgamator: begin of python/perfetto/prebuilts/manifests/trace_processor_shell.py # This file has been generated by: tools/release/roll-prebuilts v57.2 -TRACECONV_MANIFEST = [{ +TRACE_PROCESSOR_SHELL_MANIFEST = [{ 'arch': 'mac-amd64', 'file_name': - 'traceconv', + 'trace_processor_shell', 'file_size': - 12119576, + 13787208, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/mac-amd64/traceconv', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/mac-amd64/trace_processor_shell', 'sha256': - '2a97ff6d78190b4b87928c0ca4abefaa2162fd2f97aaac4278cdf28337472104', + 'c0f61397901da47cbe1bb9a0843624f7c2038ac92176ce15e3736ce9aa0afef0', 'platform': 'darwin', 'machine': ['x86_64'] @@ -220,13 +220,13 @@ TRACECONV_MANIFEST = [{ 'arch': 'mac-arm64', 'file_name': - 'traceconv', + 'trace_processor_shell', 'file_size': - 11175288, + 12704456, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/mac-arm64/traceconv', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/mac-arm64/trace_processor_shell', 'sha256': - '2a4692f355fb48ad481d523a9f0b13d61f3693f233cba0b9fed25d639f74f892', + '98a41b80e9f60da0373d64aff6455681f8c26b7c391ae5736324a5b11e3dacc2', 'platform': 'darwin', 'machine': ['arm64'] @@ -234,13 +234,13 @@ TRACECONV_MANIFEST = [{ 'arch': 'linux-amd64', 'file_name': - 'traceconv', + 'trace_processor_shell', 'file_size': - 12291856, + 14008280, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-amd64/traceconv', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-amd64/trace_processor_shell', 'sha256': - '9fabfcc1e289770e0ebe74b0ce28d78e008c4a21e16256af46a67628f5d6a500', + '55ba613fc6d4f71df81eee2dbfc293020063655c241b3e314bff75345b802684', 'platform': 'linux', 'machine': ['x86_64'] @@ -248,13 +248,13 @@ TRACECONV_MANIFEST = [{ 'arch': 'linux-arm', 'file_name': - 'traceconv', + 'trace_processor_shell', 'file_size': - 9257196, + 10321532, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-arm/traceconv', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-arm/trace_processor_shell', 'sha256': - '1a74626cac342214e711af6061cf4abe622eda48f13f55b2d300cc0f71ab2dc8', + '0f3221a1fb6dbe584c4bdc4a7541bcf15e6e5c5dde5e4910744dfb8913ee62c5', 'platform': 'linux', 'machine': ['armv6l', 'armv7l', 'armv8l'] @@ -262,13 +262,13 @@ TRACECONV_MANIFEST = [{ 'arch': 'linux-arm64', 'file_name': - 'traceconv', + 'trace_processor_shell', 'file_size': - 11634904, + 13297064, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-arm64/traceconv', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/linux-arm64/trace_processor_shell', 'sha256': - '54d58327671804790c91a6d98483b4e2f7e1d1b0fe4d2617b4a5a74ed6d8d602', + '1dcc1d9aaff2eb92e8bc58f1957e4e445600294bd61dbc09345c1018c5ff0868', 'platform': 'linux', 'machine': ['aarch64'] @@ -276,63 +276,63 @@ TRACECONV_MANIFEST = [{ 'arch': 'android-arm', 'file_name': - 'traceconv', + 'trace_processor_shell', 'file_size': - 9238156, + 10293452, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-arm/traceconv', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-arm/trace_processor_shell', 'sha256': - '02c56f0ba2f412dacdf400a361b6004046b37452d0955b949f9635763a86a997' + 'a92d4138966a494bbf017d054fd9c859bf1a3deeca56dc6f84715292d87b6073' }, { 'arch': 'android-arm64', 'file_name': - 'traceconv', + 'trace_processor_shell', 'file_size': - 11491816, + 13098064, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-arm64/traceconv', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-arm64/trace_processor_shell', 'sha256': - 'd7f44b723d2097d06de372995cfcbdb805e63bc8e95b54efd73745bb738fccf6' + '05e95758a26cf57fb8d552d3c1d532486681a6ecc4ee705a484a8deb4d092d09' }, { 'arch': 'android-x86', 'file_name': - 'traceconv', + 'trace_processor_shell', 'file_size': - 12885868, + 14811628, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-x86/traceconv', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-x86/trace_processor_shell', 'sha256': - '71eb7cb43d2156215c1f01ab227a049a46912e5d3186fb79dee549caf71de73f' + '21b72f5f2821f8e6c050ee3788df9043af1b83b5e90726c343405b4f3c9837a3' }, { 'arch': 'android-x64', 'file_name': - 'traceconv', + 'trace_processor_shell', 'file_size': - 12060912, + 13724184, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-x64/traceconv', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/android-x64/trace_processor_shell', 'sha256': - '7d26485eda0a97f5926cc97ef861444b7ded9e1394c83c641a8bfc94663b7e0d' + '0e3fe6d80fc00891035e09b7dbf7fa6b2e9752282ac4b8f1ebe792377877f7d8' }, { 'arch': 'windows-amd64', 'file_name': - 'traceconv.exe', + 'trace_processor_shell.exe', 'file_size': - 11972096, + 13617152, 'url': - 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/windows-amd64/traceconv.exe', + 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v57.2/windows-amd64/trace_processor_shell.exe', 'sha256': - '11e83c6f8e9d9ec02ba88e7d84a7844d58014519ec1e6897787882ebebe00336', + '100334b6091596fbc97f872556849a5747bf47a7f7190c485ba8cea8d2409c7b', 'platform': 'win32', 'machine': ['amd64'] }] -# ----- Amalgamator: end of python/perfetto/prebuilts/manifests/traceconv.py +# ----- Amalgamator: end of python/perfetto/prebuilts/manifests/trace_processor_shell.py # ----- Amalgamator: begin of python/perfetto/prebuilts/perfetto_prebuilts.py # Copyright (C) 2021 The Android Open Source Project @@ -590,10 +590,10 @@ def arg_order(action): return result, action.option_strings[0].strip('-') -def process_trace(trace_file, profile_target, traceconv_binary, args, +def process_trace(trace_file, profile_target, trace_processor_binary, args, android_mode): - """Convert a raw trace to pprof via traceconv. Returns an exit code.""" - if traceconv_binary is None: + """Convert a raw trace to pprof via trace_processor. Returns an exit code.""" + if trace_processor_binary is None: print('Wrote profile to {}'.format(trace_file)) print( 'This file can be opened using the Perfetto UI, https://ui.perfetto.dev' @@ -614,10 +614,10 @@ def process_trace(trace_file, profile_target, traceconv_binary, args, if binary_path is not None: symbols_path = os.path.join(profile_target, 'symbols') with open(symbols_path, 'w') as fd: - ret = subprocess.call([traceconv_binary, 'symbolize', trace_file], - env=dict( - os.environ, PERFETTO_BINARY_PATH=binary_path), - stdout=fd) + ret = subprocess.call( + [trace_processor_binary, 'util', 'symbolize', trace_file], + env=dict(os.environ, PERFETTO_BINARY_PATH=binary_path), + stdout=fd) if ret == 0: concat_files.append(symbols_path) else: @@ -628,11 +628,10 @@ def process_trace(trace_file, profile_target, traceconv_binary, args, if proguard_map is not None: deobf_path = os.path.join(profile_target, 'deobfuscation-packets') with open(deobf_path, 'w') as fd: - ret = subprocess.call([traceconv_binary, 'deobfuscate', trace_file], - env=dict( - os.environ, - PERFETTO_PROGUARD_MAP=proguard_map), - stdout=fd) + ret = subprocess.call( + [trace_processor_binary, 'util', 'deobfuscate', trace_file], + env=dict(os.environ, PERFETTO_PROGUARD_MAP=proguard_map), + stdout=fd) if ret == 0: concat_files.append(deobf_path) else: @@ -652,12 +651,12 @@ def process_trace(trace_file, profile_target, traceconv_binary, args, out.write(buf) trace_file = symbolized_path - conversion_args = [traceconv_binary, 'profile'] + ( + conversion_args = [trace_processor_binary, 'convert', 'profile'] + ( ['--no-annotations'] if args.no_annotations else []) + [trace_file] - traceconv_output = subprocess.check_output( + trace_processor_output = subprocess.check_output( conversion_args, stderr=subprocess.STDOUT) profile_path = None - for word in traceconv_output.decode('utf-8').split(): + for word in trace_processor_output.decode('utf-8').split(): if 'heap_profile-' in word: profile_path = word if profile_path is None: @@ -694,7 +693,7 @@ def process_trace(trace_file, profile_target, traceconv_binary, args, return 0 -def linux_main(args, cfg, cmd, traceconv_binary): +def linux_main(args, cfg, cmd, trace_processor_binary): """Run a local heap profile session on Linux using LD_PRELOAD.""" tracebox_binary = args.tracebox_binary if tracebox_binary is None: @@ -773,7 +772,11 @@ def linux_main(args, cfg, cmd, traceconv_binary): perfetto_proc.wait() return process_trace( - trace_output, profile_target, traceconv_binary, args, android_mode=False) + trace_output, + profile_target, + trace_processor_binary, + args, + android_mode=False) def print_options(parser): @@ -904,7 +907,8 @@ def main(argv): help="Get simpleperf profile of heapprofd. This is " "only for heapprofd development.") common.add_argument( - "--traceconv-binary", help="Path to local trace to text. For debugging.") + "--trace-processor-binary", + help="Path to local trace_processor. For debugging.") common.add_argument( "--no-annotations", help="Do not suffix the pprof function names with Android ART mode " @@ -1046,7 +1050,7 @@ def main(argv): parser.print_help() return 1 - traceconv_binary = args.traceconv_binary + trace_processor_binary = args.trace_processor_binary if args.continuous_dump: target_cfg += CONTINUOUS_DUMP.format(dump_interval=args.continuous_dump) @@ -1063,13 +1067,14 @@ def main(argv): print(cfg) return 0 - # Do this AFTER print_config so we do not download traceconv only to + # Do this AFTER print_config so we do not download trace_processor only to # print out the config. - if traceconv_binary is None: - traceconv_binary = get_perfetto_prebuilt(TRACECONV_MANIFEST, soft_fail=True) + if trace_processor_binary is None: + trace_processor_binary = get_perfetto_prebuilt( + TRACE_PROCESSOR_SHELL_MANIFEST, soft_fail=True) if args.subcommand == 'host': - return linux_main(args, cfg, cmd, traceconv_binary) + return linux_main(args, cfg, cmd, trace_processor_binary) # --- Android path --- @@ -1174,7 +1179,7 @@ def main(argv): return process_trace( profile_host_path, profile_target, - traceconv_binary, + trace_processor_binary, args, android_mode=True)