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.
diff --git a/python/tools/cpu_profile.py b/python/tools/cpu_profile.py index 3723ecf..c3bda91 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 9eacbab..6e8243e 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 1bd3430..fc8b838 100755 --- a/tools/cpu_profile +++ b/tools/cpu_profile
@@ -35,19 +35,19 @@ 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 @@ '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 @@ '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 @@ '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 @@ '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 @@ '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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 b0c2466..a1ea17b 100755 --- a/tools/heap_profile +++ b/tools/heap_profile
@@ -200,19 +200,19 @@ # ----- 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 @@ '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 @@ '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 @@ '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 @@ '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 @@ '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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ return process_trace( profile_host_path, profile_target, - traceconv_binary, + trace_processor_binary, args, android_mode=True)