Merge "ui: Fixed the problem that special file names cannot be opened by the UI." into main
diff --git a/Android.bp b/Android.bp
index f58dc80..bf201a2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -11499,6 +11499,7 @@
         "src/trace_processor/metrics/sql/android/startup/launches_minsdk33.sql",
         "src/trace_processor/metrics/sql/android/startup/mcycles_per_launch.sql",
         "src/trace_processor/metrics/sql/android/startup/slice_functions.sql",
+        "src/trace_processor/metrics/sql/android/startup/slow_start_reasons.sql",
         "src/trace_processor/metrics/sql/android/startup/system_state.sql",
         "src/trace_processor/metrics/sql/android/startup/thread_state_breakdown.sql",
         "src/trace_processor/metrics/sql/android/unsymbolized_frames.sql",
@@ -11765,20 +11766,7 @@
         "src/trace_processor/perfetto_sql/stdlib/android/startup/startups.sql",
         "src/trace_processor/perfetto_sql/stdlib/android/statsd.sql",
         "src/trace_processor/perfetto_sql/stdlib/android/thread.sql",
-        "src/trace_processor/perfetto_sql/stdlib/chrome/chrome_scrolls.sql",
-        "src/trace_processor/perfetto_sql/stdlib/chrome/cpu_powerups.sql",
-        "src/trace_processor/perfetto_sql/stdlib/chrome/histograms.sql",
-        "src/trace_processor/perfetto_sql/stdlib/chrome/interactions.sql",
-        "src/trace_processor/perfetto_sql/stdlib/chrome/metadata.sql",
-        "src/trace_processor/perfetto_sql/stdlib/chrome/page_loads.sql",
-        "src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_intervals.sql",
-        "src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_v3.sql",
-        "src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_v3_cause.sql",
-        "src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_offsets.sql",
-        "src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/utils.sql",
-        "src/trace_processor/perfetto_sql/stdlib/chrome/speedometer.sql",
-        "src/trace_processor/perfetto_sql/stdlib/chrome/tasks.sql",
-        "src/trace_processor/perfetto_sql/stdlib/chrome/vsync_intervals.sql",
+        "src/trace_processor/perfetto_sql/stdlib/chrome/**/*.sql",
         "src/trace_processor/perfetto_sql/stdlib/common/args.sql",
         "src/trace_processor/perfetto_sql/stdlib/common/counters.sql",
         "src/trace_processor/perfetto_sql/stdlib/common/cpus.sql",
diff --git a/BUILD b/BUILD
index fae1e4b..affa401 100644
--- a/BUILD
+++ b/BUILD
@@ -1918,6 +1918,7 @@
         "src/trace_processor/metrics/sql/android/startup/launches_minsdk33.sql",
         "src/trace_processor/metrics/sql/android/startup/mcycles_per_launch.sql",
         "src/trace_processor/metrics/sql/android/startup/slice_functions.sql",
+        "src/trace_processor/metrics/sql/android/startup/slow_start_reasons.sql",
         "src/trace_processor/metrics/sql/android/startup/system_state.sql",
         "src/trace_processor/metrics/sql/android/startup/thread_state_breakdown.sql",
         "src/trace_processor/metrics/sql/android/unsymbolized_frames.sql",
diff --git a/BUILD.gn b/BUILD.gn
index 0369d78..63b418e 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -315,7 +315,12 @@
       ]
     }
   }
-  component("libtrace_processor") {
+
+  # In Chromium, we want to ensure that we don't link dynamically against sqlite
+  # (as Chromium also uses a more restricted version of sqlite which is actually
+  # shipped to the users).
+  # source_set helps us to achieve that.
+  source_set("libtrace_processor") {
     public_configs = [ "gn:public_config" ]
     deps = [ "src/trace_processor:lib" ]
     configs -= [ "//build/config/compiler:chromium_code" ]
diff --git a/CHANGELOG b/CHANGELOG
index a157ffd..1c5e81b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,16 @@
 Unreleased:
   Tracing service and probes:
+    *
+  Trace Processor:
+    *
+  UI:
+    *
+  SDK:
+    *
+
+
+v39.0 - 2023-11-15:
+  Tracing service and probes:
     * Added reporting of TZ offset under system_info.timezone_off_mins .
     * Added no_flush option to DataSourceDescriptor to avoid unnecessary IPC
       roundtrips to flush data sources like track_event that rely uniquely on
@@ -7,11 +18,13 @@
     * Added support for running on Linux & Android systems configured with 16K
       pagetables.
   Trace Processor:
-    *
+    * New android_boot metric.
+    * Added new PerfettoSQL syntax (CREATE PERFETTO VIEW) for adding schemas to views.
+    * Support perf.data import format.
+    * Add dvfs and cpu_idle to stdlib.
   UI:
     * Add a new type of debug tracks: counter.
-  SDK:
-    *
+    * Improved visualization of timestamps for durations.
 
 
 v38.0 - 2023-10-10:
diff --git a/docs/contributing/ui-plugins.md b/docs/contributing/ui-plugins.md
index 3b84547..939e334 100644
--- a/docs/contributing/ui-plugins.md
+++ b/docs/contributing/ui-plugins.md
@@ -115,6 +115,26 @@
 - [dev.perfetto.CoreCommands](https://cs.android.com/android/platform/superproject/main/+/main:external/perfetto/ui/src/plugins/dev.perfetto.CoreCommands/index.ts).
 - [dev.perfetto.ExampleState](https://cs.android.com/android/platform/superproject/main/+/main:external/perfetto/ui/src/plugins/dev.perfetto.ExampleState/index.ts).
 
+#### Hotkeys
+
+A default hotkey may be provided when registering a command.
+
+```typescript
+ctx.registerCommand({
+  id: 'dev.perfetto.ExampleSimpleCommand#LogHelloWorld',
+  name: 'Log "Hello, World!"',
+  callback: () => console.log('Hello, World!'),
+  defaultHotkey: 'Shift+H',
+});
+```
+
+Even though the hotkey is a string, it's format checked at compile time using 
+typescript's [template literal types](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html).
+
+See [hotkey.ts](https://cs.android.com/android/platform/superproject/main/+/main:external/perfetto/ui/src/base/hotkeys.ts)
+for more details on how the hotkey syntax works, and for the available keys and
+modifiers.
+
 ### Tracks
 TBD
 
diff --git a/docs/instrumentation/tracing-sdk.md b/docs/instrumentation/tracing-sdk.md
index 0cf0eb0..783c989 100644
--- a/docs/instrumentation/tracing-sdk.md
+++ b/docs/instrumentation/tracing-sdk.md
@@ -30,7 +30,7 @@
 To start using the Client API, first check out the latest SDK release:
 
 ```bash
-git clone https://android.googlesource.com/platform/external/perfetto -b v37.0
+git clone https://android.googlesource.com/platform/external/perfetto -b v39.0
 ```
 
 The SDK consists of two files, `sdk/perfetto.h` and `sdk/perfetto.cc`. These are
diff --git a/examples/sdk/README.md b/examples/sdk/README.md
index 2d2de1c..e491db0 100644
--- a/examples/sdk/README.md
+++ b/examples/sdk/README.md
@@ -15,7 +15,7 @@
 First, check out the latest Perfetto release:
 
 ```bash
-git clone https://android.googlesource.com/platform/external/perfetto -b v37.0
+git clone https://android.googlesource.com/platform/external/perfetto -b v39.0
 ```
 
 Then, build using CMake:
diff --git a/gn/perfetto.gni b/gn/perfetto.gni
index 715688d..8cd9b08 100644
--- a/gn/perfetto.gni
+++ b/gn/perfetto.gni
@@ -296,9 +296,12 @@
 
   # Enables httpd RPC support in the trace processor.
   # Further per-OS conditionals are applied in gn/BUILD.gn.
+  # Chromium+Win: httpd support depends on enable_perfetto_ipc, which is not
+  # enabled on Chromium+Win for now (see a comment there).
   enable_perfetto_trace_processor_httpd =
       enable_perfetto_trace_processor &&
-      (perfetto_build_standalone || perfetto_build_with_android)
+      (perfetto_build_standalone || perfetto_build_with_android ||
+       (build_with_chromium && !is_win))
 
   # Enables Zlib support. This is used to compress traces (by the tracing
   # service and by the "perfetto" cmdline client) and to decompress traces (by
diff --git a/infra/config/recipes.cfg b/infra/config/recipes.cfg
index 9057396..119fff4 100644
--- a/infra/config/recipes.cfg
+++ b/infra/config/recipes.cfg
@@ -3,17 +3,17 @@
   "deps": {
     "depot_tools": {
       "branch": "refs/heads/main",
-      "revision": "6b98cdcbc133ec6902e84da64617560b33f9febc",
+      "revision": "0c5e8652fe1fefee1c291cbf05ca3a41b9f66890",
       "url": "https://chromium.googlesource.com/chromium/tools/depot_tools.git"
     },
     "recipe_engine": {
       "branch": "refs/heads/main",
-      "revision": "086386d9ca13cbcedba146391ff25241a4ec2dfd",
+      "revision": "94e9b251b56473c68935e0b42aad3fcbe95e3f6c",
       "url": "https://chromium.googlesource.com/infra/luci/recipes-py"
     }
   },
   "project_id": "perfetto",
-  "recipes_path": "infra/luci",
   "py3_only": true,
+  "recipes_path": "infra/luci",
   "repo_name": "perfetto"
 }
diff --git a/infra/luci/README.recipes.md b/infra/luci/README.recipes.md
index 085f220..c818fe4 100644
--- a/infra/luci/README.recipes.md
+++ b/infra/luci/README.recipes.md
@@ -3,20 +3,19 @@
 ## Table of Contents
 
 **[Recipe Modules](#Recipe-Modules)**
-  * [macos_sdk](#recipe_modules-macos_sdk) (Python3 ✅) — The `macos_sdk` module provides safe functions to access a semi-hermetic XCode installation.
-  * [windows_sdk](#recipe_modules-windows_sdk) (Python3 ✅)
+  * [macos_sdk](#recipe_modules-macos_sdk) — The `macos_sdk` module provides safe functions to access a semi-hermetic XCode installation.
+  * [windows_sdk](#recipe_modules-windows_sdk)
 
 **[Recipes](#Recipes)**
-  * [macos_sdk:examples/full](#recipes-macos_sdk_examples_full) (Python3 ✅)
-  * [perfetto](#recipes-perfetto) (Python3 ✅) — Recipe for building Perfetto.
-  * [windows_sdk:examples/full](#recipes-windows_sdk_examples_full) (Python3 ✅)
+  * [macos_sdk:examples/full](#recipes-macos_sdk_examples_full)
+  * [perfetto](#recipes-perfetto) — Recipe for building Perfetto.
+  * [windows_sdk:examples/full](#recipes-windows_sdk_examples_full)
 ## Recipe Modules
 
 ### *recipe_modules* / [macos\_sdk](/infra/luci/recipe_modules/macos_sdk)
 
 [DEPS](/infra/luci/recipe_modules/macos_sdk/__init__.py#15): [recipe\_engine/cipd][recipe_engine/recipe_modules/cipd], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/json][recipe_engine/recipe_modules/json], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/step][recipe_engine/recipe_modules/step]
 
-PYTHON_VERSION_COMPATIBILITY: PY3
 
 The `macos_sdk` module provides safe functions to access a semi-hermetic
 XCode installation.
@@ -66,7 +65,6 @@
 
 [DEPS](/infra/luci/recipe_modules/windows_sdk/__init__.py#15): [recipe\_engine/cipd][recipe_engine/recipe_modules/cipd], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/json][recipe_engine/recipe_modules/json], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/step][recipe_engine/recipe_modules/step]
 
-PYTHON_VERSION_COMPATIBILITY: PY3
 
 #### **class [WindowsSDKApi](/infra/luci/recipe_modules/windows_sdk/api.py#20)([RecipeApi][recipe_engine/wkt/RecipeApi]):**
 
@@ -86,14 +84,12 @@
 
 [DEPS](/infra/luci/recipe_modules/macos_sdk/examples/full.py#15): [macos\_sdk](#recipe_modules-macos_sdk), [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/step][recipe_engine/recipe_modules/step]
 
-PYTHON_VERSION_COMPATIBILITY: PY3
 
 — **def [RunSteps](/infra/luci/recipe_modules/macos_sdk/examples/full.py#23)(api):**
 ### *recipes* / [perfetto](/infra/luci/recipes/perfetto.py)
 
 [DEPS](/infra/luci/recipes/perfetto.py#18): [depot\_tools/gsutil][depot_tools/recipe_modules/gsutil], [macos\_sdk](#recipe_modules-macos_sdk), [windows\_sdk](#recipe_modules-windows_sdk), [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [recipe\_engine/cipd][recipe_engine/recipe_modules/cipd], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/file][recipe_engine/recipe_modules/file], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/step][recipe_engine/recipe_modules/step]
 
-PYTHON_VERSION_COMPATIBILITY: PY3
 
 Recipe for building Perfetto.
 
@@ -108,19 +104,18 @@
 
 [DEPS](/infra/luci/recipe_modules/windows_sdk/examples/full.py#15): [windows\_sdk](#recipe_modules-windows_sdk), [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/step][recipe_engine/recipe_modules/step]
 
-PYTHON_VERSION_COMPATIBILITY: PY3
 
 — **def [RunSteps](/infra/luci/recipe_modules/windows_sdk/examples/full.py#23)(api):**
 
-[depot_tools/recipe_modules/gsutil]: https://chromium.googlesource.com/chromium/tools/depot_tools.git/+/6b98cdcbc133ec6902e84da64617560b33f9febc/recipes/README.recipes.md#recipe_modules-gsutil
-[recipe_engine/recipe_modules/buildbucket]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/086386d9ca13cbcedba146391ff25241a4ec2dfd/README.recipes.md#recipe_modules-buildbucket
-[recipe_engine/recipe_modules/cipd]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/086386d9ca13cbcedba146391ff25241a4ec2dfd/README.recipes.md#recipe_modules-cipd
-[recipe_engine/recipe_modules/context]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/086386d9ca13cbcedba146391ff25241a4ec2dfd/README.recipes.md#recipe_modules-context
-[recipe_engine/recipe_modules/file]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/086386d9ca13cbcedba146391ff25241a4ec2dfd/README.recipes.md#recipe_modules-file
-[recipe_engine/recipe_modules/json]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/086386d9ca13cbcedba146391ff25241a4ec2dfd/README.recipes.md#recipe_modules-json
-[recipe_engine/recipe_modules/path]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/086386d9ca13cbcedba146391ff25241a4ec2dfd/README.recipes.md#recipe_modules-path
-[recipe_engine/recipe_modules/platform]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/086386d9ca13cbcedba146391ff25241a4ec2dfd/README.recipes.md#recipe_modules-platform
-[recipe_engine/recipe_modules/properties]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/086386d9ca13cbcedba146391ff25241a4ec2dfd/README.recipes.md#recipe_modules-properties
-[recipe_engine/recipe_modules/raw_io]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/086386d9ca13cbcedba146391ff25241a4ec2dfd/README.recipes.md#recipe_modules-raw_io
-[recipe_engine/recipe_modules/step]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/086386d9ca13cbcedba146391ff25241a4ec2dfd/README.recipes.md#recipe_modules-step
-[recipe_engine/wkt/RecipeApi]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/086386d9ca13cbcedba146391ff25241a4ec2dfd/recipe_engine/recipe_api.py#886
+[depot_tools/recipe_modules/gsutil]: https://chromium.googlesource.com/chromium/tools/depot_tools.git/+/0c5e8652fe1fefee1c291cbf05ca3a41b9f66890/recipes/README.recipes.md#recipe_modules-gsutil
+[recipe_engine/recipe_modules/buildbucket]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/94e9b251b56473c68935e0b42aad3fcbe95e3f6c/README.recipes.md#recipe_modules-buildbucket
+[recipe_engine/recipe_modules/cipd]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/94e9b251b56473c68935e0b42aad3fcbe95e3f6c/README.recipes.md#recipe_modules-cipd
+[recipe_engine/recipe_modules/context]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/94e9b251b56473c68935e0b42aad3fcbe95e3f6c/README.recipes.md#recipe_modules-context
+[recipe_engine/recipe_modules/file]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/94e9b251b56473c68935e0b42aad3fcbe95e3f6c/README.recipes.md#recipe_modules-file
+[recipe_engine/recipe_modules/json]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/94e9b251b56473c68935e0b42aad3fcbe95e3f6c/README.recipes.md#recipe_modules-json
+[recipe_engine/recipe_modules/path]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/94e9b251b56473c68935e0b42aad3fcbe95e3f6c/README.recipes.md#recipe_modules-path
+[recipe_engine/recipe_modules/platform]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/94e9b251b56473c68935e0b42aad3fcbe95e3f6c/README.recipes.md#recipe_modules-platform
+[recipe_engine/recipe_modules/properties]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/94e9b251b56473c68935e0b42aad3fcbe95e3f6c/README.recipes.md#recipe_modules-properties
+[recipe_engine/recipe_modules/raw_io]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/94e9b251b56473c68935e0b42aad3fcbe95e3f6c/README.recipes.md#recipe_modules-raw_io
+[recipe_engine/recipe_modules/step]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/94e9b251b56473c68935e0b42aad3fcbe95e3f6c/README.recipes.md#recipe_modules-step
+[recipe_engine/wkt/RecipeApi]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/94e9b251b56473c68935e0b42aad3fcbe95e3f6c/recipe_engine/recipe_api.py#902
diff --git a/infra/luci/recipe_modules/macos_sdk/examples/full.expected/mac.json b/infra/luci/recipe_modules/macos_sdk/examples/full.expected/mac.json
index 7d0f197..94406ba 100644
--- a/infra/luci/recipe_modules/macos_sdk/examples/full.expected/mac.json
+++ b/infra/luci/recipe_modules/macos_sdk/examples/full.expected/mac.json
@@ -19,7 +19,7 @@
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
       "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-git_revision:e9b\", @@@",
+      "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-git_revision:e9b\",@@@",
       "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/tools/mac_toolchain/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ]@@@",
diff --git a/infra/luci/recipe_modules/windows_sdk/examples/full.expected/win.json b/infra/luci/recipe_modules/windows_sdk/examples/full.expected/win.json
index 0f68f34..f9646c9 100644
--- a/infra/luci/recipe_modules/windows_sdk/examples/full.expected/win.json
+++ b/infra/luci/recipe_modules/windows_sdk/examples/full.expected/win.json
@@ -19,7 +19,7 @@
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
       "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-uploaded:2019-09\", @@@",
+      "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-uploaded:2019-09\",@@@",
       "@@@STEP_LOG_LINE@json.output@        \"package\": \"chrome_internal/third_party/sdk/windows\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ]@@@",
@@ -42,16 +42,16 @@
       "@@@STEP_LOG_LINE@json.output@  \"env\": {@@@",
       "@@@STEP_LOG_LINE@json.output@    \"PATH\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      [@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"..\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"..\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"win_sdk\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"bin\", @@@",
+      "@@@STEP_LOG_LINE@json.output@        \"..\",@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"..\",@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"win_sdk\",@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"bin\",@@@",
       "@@@STEP_LOG_LINE@json.output@        \"x64\"@@@",
       "@@@STEP_LOG_LINE@json.output@      ]@@@",
-      "@@@STEP_LOG_LINE@json.output@    ], @@@",
+      "@@@STEP_LOG_LINE@json.output@    ],@@@",
       "@@@STEP_LOG_LINE@json.output@    \"VSINSTALLDIR\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      [@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"..\", @@@",
+      "@@@STEP_LOG_LINE@json.output@        \"..\",@@@",
       "@@@STEP_LOG_LINE@json.output@        \"..\\\\\"@@@",
       "@@@STEP_LOG_LINE@json.output@      ]@@@",
       "@@@STEP_LOG_LINE@json.output@    ]@@@",
diff --git a/infra/luci/recipes.py b/infra/luci/recipes.py
index 642a90c..05ca941 100755
--- a/infra/luci/recipes.py
+++ b/infra/luci/recipes.py
@@ -12,7 +12,6 @@
 # evaluates to re-exec'ing this script in unbuffered mode.
 # pylint: disable=pointless-string-statement
 ''''exec python3 -u -- "$0" ${1+"$@"} # '''
-# vi: syntax=python
 """Bootstrap script to clone and forward to the recipe engine tool.
 
 *******************
@@ -29,16 +28,14 @@
 import json
 import logging
 import os
+import shutil
 import subprocess
 import sys
 
-from collections import namedtuple
-from io import open  # pylint: disable=redefined-builtin
+import urllib.parse as urlparse
 
-try:
-  import urllib.parse as urlparse
-except ImportError:
-  import urlparse
+from collections import namedtuple
+
 
 # The dependency entry for the recipe_engine in the client repo's recipes.cfg
 #
@@ -52,8 +49,8 @@
 class MalformedRecipesCfg(Exception):
 
   def __init__(self, msg, path):
-    full_message = 'malformed recipes.cfg: %s: %r' % (msg, path)
-    super(MalformedRecipesCfg, self).__init__(full_message)
+    full_message = f'malformed recipes.cfg: {msg}: {path!r}'
+    super().__init__(full_message)
 
 
 def parse(repo_root, recipes_cfg_path):
@@ -70,27 +67,23 @@
     recipes_path (str) - native path to where the recipes live inside of the
       current repo (i.e. the folder containing `recipes/` and/or
       `recipe_modules`)
-    py3_only (bool) - True if this repo has been marked as ONLY supporting
-      python3.
   """
-  with open(recipes_cfg_path, 'r') as fh:
-    pb = json.load(fh)
-  py3_only = pb.get('py3_only', False)
+  with open(recipes_cfg_path, 'r', encoding='utf-8') as file:
+    recipes_cfg = json.load(file)
 
   try:
-    if pb['api_version'] != 2:
-      raise MalformedRecipesCfg('unknown version %d' % pb['api_version'],
-                                recipes_cfg_path)
+    if (version := recipes_cfg['api_version']) != 2:
+      raise MalformedRecipesCfg(f'unknown version {version}', recipes_cfg_path)
 
     # If we're running ./recipes.py from the recipe_engine repo itself, then
     # return None to signal that there's no EngineDep.
-    repo_name = pb.get('repo_name')
+    repo_name = recipes_cfg.get('repo_name')
     if not repo_name:
-      repo_name = pb['project_id']
+      repo_name = recipes_cfg['project_id']
     if repo_name == 'recipe_engine':
-      return None, pb.get('recipes_path', ''), py3_only
+      return None, recipes_cfg.get('recipes_path', '')
 
-    engine = pb['deps']['recipe_engine']
+    engine = recipes_cfg['deps']['recipe_engine']
 
     if 'url' not in engine:
       raise MalformedRecipesCfg(
@@ -99,7 +92,7 @@
 
     engine.setdefault('revision', '')
     engine.setdefault('branch', 'refs/heads/main')
-    recipes_path = pb.get('recipes_path', '')
+    recipes_path = recipes_cfg.get('recipes_path', '')
 
     # TODO(iannucci): only support absolute refs
     if not engine['branch'].startswith('refs/'):
@@ -107,9 +100,9 @@
 
     recipes_path = os.path.join(repo_root,
                                 recipes_path.replace('/', os.path.sep))
-    return EngineDep(**engine), recipes_path, py3_only
+    return EngineDep(**engine), recipes_path
   except KeyError as ex:
-    raise MalformedRecipesCfg(str(ex), recipes_cfg_path)
+    raise MalformedRecipesCfg(str(ex), recipes_cfg_path) from ex
 
 
 IS_WIN = sys.platform.startswith(('win', 'cygwin'))
@@ -124,15 +117,6 @@
   return os.path.isfile(path) and os.access(path, os.X_OK)
 
 
-# TODO: Use shutil.which once we switch to Python3.
-def _is_on_path(basename):
-  for path in os.environ['PATH'].split(os.pathsep):
-    full_path = os.path.join(path, basename)
-    if _is_executable(full_path):
-      return True
-  return False
-
-
 def _subprocess_call(argv, **kwargs):
   logging.info('Running %r', argv)
   return subprocess.call(argv, **kwargs)
@@ -156,27 +140,27 @@
     * an override for the recipe engine in the form of `-O recipe_engine=/path`
     * the --package option.
   """
-  PREFIX = 'recipe_engine='
+  override_prefix = 'recipe_engine='
 
-  p = argparse.ArgumentParser(add_help=False)
-  p.add_argument('-O', '--project-override', action='append')
-  p.add_argument('--package', type=os.path.abspath)
-  args, _ = p.parse_known_args(argv)
+  parser = argparse.ArgumentParser(add_help=False)
+  parser.add_argument('-O', '--project-override', action='append')
+  parser.add_argument('--package', type=os.path.abspath)
+  args, _ = parser.parse_known_args(argv)
   for override in args.project_override or ():
-    if override.startswith(PREFIX):
-      return override[len(PREFIX):], args.package
+    if override.startswith(override_prefix):
+      return override[len(override_prefix):], args.package
   return None, args.package
 
 
 def checkout_engine(engine_path, repo_root, recipes_cfg_path):
   """Checks out the recipe_engine repo pinned in recipes.cfg.
 
-  Returns the path to the recipe engine repo and the py3_only boolean.
+  Returns the path to the recipe engine repo.
   """
-  dep, recipes_path, py3_only = parse(repo_root, recipes_cfg_path)
+  dep, recipes_path = parse(repo_root, recipes_cfg_path)
   if dep is None:
     # we're running from the engine repo already!
-    return os.path.join(repo_root, recipes_path), py3_only
+    return os.path.join(repo_root, recipes_path)
 
   url = dep.url
 
@@ -190,20 +174,18 @@
     # Ensure that we have the recipe engine cloned.
     engine_path = os.path.join(recipes_path, '.recipe_deps', 'recipe_engine')
 
-    with open(os.devnull, 'w') as NUL:
-      # Note: this logic mirrors the logic in recipe_engine/fetch.py
-      _git_check_call(['init', engine_path], stdout=NUL)
+    # Note: this logic mirrors the logic in recipe_engine/fetch.py
+    _git_check_call(['init', engine_path], stdout=subprocess.DEVNULL)
 
-      try:
-        _git_check_call(['rev-parse', '--verify',
-                         '%s^{commit}' % revision],
-                        cwd=engine_path,
-                        stdout=NUL,
-                        stderr=NUL)
-      except subprocess.CalledProcessError:
-        _git_check_call(['fetch', '--quiet', url, branch],
-                        cwd=engine_path,
-                        stdout=NUL)
+    try:
+      _git_check_call(['rev-parse', '--verify', f'{revision}^{{commit}}'],
+                      cwd=engine_path,
+                      stdout=subprocess.DEVNULL,
+                      stderr=subprocess.DEVNULL)
+    except subprocess.CalledProcessError:
+      _git_check_call(['fetch', '--quiet', url, branch],
+                      cwd=engine_path,
+                      stdout=subprocess.DEVNULL)
 
     try:
       _git_check_call(['diff', '--quiet', revision], cwd=engine_path)
@@ -213,21 +195,21 @@
         os.remove(index_lock)
       except OSError as exc:
         if exc.errno != errno.ENOENT:
-          logging.warn('failed to remove %r, reset will fail: %s', index_lock,
-                       exc)
+          logging.warning('failed to remove %r, reset will fail: %s',
+                          index_lock, exc)
       _git_check_call(['reset', '-q', '--hard', revision], cwd=engine_path)
 
     # If the engine has refactored/moved modules we need to clean all .pyc files
     # or things will get squirrely.
     _git_check_call(['clean', '-qxf'], cwd=engine_path)
 
-  return engine_path, py3_only
+  return engine_path
 
 
 def main():
   for required_binary in REQUIRED_BINARIES:
-    if not _is_on_path(required_binary):
-      return 'Required binary is not found on PATH: %s' % required_binary
+    if not shutil.which(required_binary):
+      return f'Required binary is not found on PATH: {required_binary}'
 
   if '--verbose' in sys.argv:
     logging.getLogger().setLevel(logging.INFO)
@@ -247,16 +229,31 @@
     repo_root = os.path.abspath(repo_root).decode()
     recipes_cfg_path = os.path.join(repo_root, 'infra', 'config', 'recipes.cfg')
     args = ['--package', recipes_cfg_path] + args
-  engine_path, py3_only = checkout_engine(engine_override, repo_root,
-                                          recipes_cfg_path)
+  engine_path = checkout_engine(engine_override, repo_root, recipes_cfg_path)
 
-  using_py3 = py3_only or os.getenv('RECIPES_USE_PY3') == 'true'
-  vpython = ('vpython' + ('3' if using_py3 else '') + _BAT)
-  if not _is_on_path(vpython):
-    return 'Required binary is not found on PATH: %s' % vpython
+  vpython = 'vpython3' + _BAT
+  if not shutil.which(vpython):
+    return f'Required binary is not found on PATH: {vpython}'
+
+  # We unset PYTHONPATH here in case the user has conflicting environmental
+  # things we don't want them to leak through into the recipe_engine which
+  # manages its environment entirely via vpython.
+  #
+  # NOTE: os.unsetenv unhelpfully doesn't exist on all platforms until python3.9
+  # so we have to use the cutesy `pop` formulation below until then...
+  os.environ.pop("PYTHONPATH", None)
+
+  spec = '.vpython3'
+  debugger = os.environ.get('RECIPE_DEBUGGER', '')
+  if debugger.startswith('pycharm'):
+    spec = '.pycharm.vpython3'
+  elif debugger.startswith('vscode'):
+    spec = '.vscode.vpython3'
 
   argv = ([
       vpython,
+      '-vpython-spec',
+      os.path.join(engine_path, spec),
       '-u',
       os.path.join(engine_path, 'recipe_engine', 'main.py'),
   ] + args)
@@ -264,13 +261,14 @@
   if IS_WIN:
     # No real 'exec' on windows; set these signals to ignore so that they
     # propagate to our children but we still wait for the child process to quit.
-    import signal
-    signal.signal(signal.SIGBREAK, signal.SIG_IGN)
+    import signal  # pylint: disable=import-outside-toplevel
+    signal.signal(signal.SIGBREAK, signal.SIG_IGN)  # pylint: disable=no-member
     signal.signal(signal.SIGINT, signal.SIG_IGN)
     signal.signal(signal.SIGTERM, signal.SIG_IGN)
     return _subprocess_call(argv)
-  else:
-    os.execvp(argv[0], argv)
+
+  os.execvp(argv[0], argv)
+  return -1  # should never occur
 
 
 if __name__ == '__main__':
diff --git a/infra/luci/recipes/perfetto.expected/ci_android.json b/infra/luci/recipes/perfetto.expected/ci_android.json
index eb09d35..d4d4207 100644
--- a/infra/luci/recipes/perfetto.expected/ci_android.json
+++ b/infra/luci/recipes/perfetto.expected/ci_android.json
@@ -312,7 +312,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/android-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -349,7 +349,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/android-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -420,7 +420,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/android-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -457,7 +457,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/android-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -528,7 +528,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/android-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -565,7 +565,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/android-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -636,7 +636,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/android-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -673,7 +673,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/android-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -744,7 +744,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/android-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -781,7 +781,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/android-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -852,7 +852,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/android-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -889,7 +889,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/android-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1053,7 +1053,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/android-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1090,7 +1090,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/android-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1161,7 +1161,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/android-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1198,7 +1198,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/android-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1269,7 +1269,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/android-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1306,7 +1306,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/android-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1377,7 +1377,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/android-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1414,7 +1414,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/android-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1485,7 +1485,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/android-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1522,7 +1522,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/android-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1593,7 +1593,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/android-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1630,7 +1630,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/android-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1794,7 +1794,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/android-x86\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1831,7 +1831,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/android-x86\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1902,7 +1902,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/android-x86\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1939,7 +1939,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/android-x86\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2010,7 +2010,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/android-x86\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2047,7 +2047,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/android-x86\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2118,7 +2118,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/android-x86\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2155,7 +2155,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/android-x86\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2226,7 +2226,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/android-x86\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2263,7 +2263,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/android-x86\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2334,7 +2334,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/android-x86\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2371,7 +2371,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/android-x86\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2535,7 +2535,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/android-x64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2572,7 +2572,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/android-x64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2643,7 +2643,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/android-x64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2680,7 +2680,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/android-x64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2751,7 +2751,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/android-x64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2788,7 +2788,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/android-x64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2859,7 +2859,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/android-x64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2896,7 +2896,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/android-x64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2967,7 +2967,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/android-x64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -3004,7 +3004,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/android-x64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -3075,7 +3075,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/android-x64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -3112,7 +3112,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/android-x64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
diff --git a/infra/luci/recipes/perfetto.expected/ci_linux.json b/infra/luci/recipes/perfetto.expected/ci_linux.json
index 43d3d4a..508ea21 100644
--- a/infra/luci/recipes/perfetto.expected/ci_linux.json
+++ b/infra/luci/recipes/perfetto.expected/ci_linux.json
@@ -312,7 +312,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -349,7 +349,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -420,7 +420,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -457,7 +457,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -528,7 +528,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -565,7 +565,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -636,7 +636,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -673,7 +673,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -744,7 +744,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -781,7 +781,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -852,7 +852,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -889,7 +889,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1053,7 +1053,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1090,7 +1090,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1161,7 +1161,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1198,7 +1198,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1269,7 +1269,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1306,7 +1306,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1377,7 +1377,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1414,7 +1414,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1485,7 +1485,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1522,7 +1522,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1593,7 +1593,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1630,7 +1630,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1794,7 +1794,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1831,7 +1831,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1902,7 +1902,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1939,7 +1939,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2010,7 +2010,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2047,7 +2047,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2118,7 +2118,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2155,7 +2155,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2226,7 +2226,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2263,7 +2263,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2334,7 +2334,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2371,7 +2371,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
diff --git a/infra/luci/recipes/perfetto.expected/ci_mac.json b/infra/luci/recipes/perfetto.expected/ci_mac.json
index 60543d4..b0a478a 100644
--- a/infra/luci/recipes/perfetto.expected/ci_mac.json
+++ b/infra/luci/recipes/perfetto.expected/ci_mac.json
@@ -193,7 +193,7 @@
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
       "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-git_revision:e9b\", @@@",
+      "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-git_revision:e9b\",@@@",
       "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/tools/mac_toolchain/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ]@@@",
@@ -435,7 +435,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/mac-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -472,7 +472,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/mac-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -543,7 +543,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/mac-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -580,7 +580,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/mac-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -651,7 +651,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/mac-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -688,7 +688,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/mac-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -759,7 +759,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/mac-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -796,7 +796,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/mac-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -867,7 +867,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/mac-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -904,7 +904,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/mac-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -975,7 +975,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/mac-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1012,7 +1012,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/mac-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1058,7 +1058,7 @@
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
       "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-git_revision:e9b\", @@@",
+      "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-git_revision:e9b\",@@@",
       "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/tools/mac_toolchain/resolved-platform\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ]@@@",
@@ -1300,7 +1300,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/mac-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1337,7 +1337,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/mac-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1408,7 +1408,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/mac-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1445,7 +1445,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/mac-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1516,7 +1516,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/mac-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1553,7 +1553,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/mac-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1624,7 +1624,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/mac-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1661,7 +1661,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/mac-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1732,7 +1732,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/mac-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1769,7 +1769,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/mac-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1840,7 +1840,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/mac-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1877,7 +1877,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/mac-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
diff --git a/infra/luci/recipes/perfetto.expected/ci_tag.json b/infra/luci/recipes/perfetto.expected/ci_tag.json
index d3227ee..b5dc047 100644
--- a/infra/luci/recipes/perfetto.expected/ci_tag.json
+++ b/infra/luci/recipes/perfetto.expected/ci_tag.json
@@ -312,7 +312,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -351,7 +351,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -422,7 +422,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -461,7 +461,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -532,7 +532,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -571,7 +571,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -642,7 +642,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -681,7 +681,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -752,7 +752,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -791,7 +791,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -862,7 +862,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -901,7 +901,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/linux-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1065,7 +1065,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1104,7 +1104,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1175,7 +1175,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1214,7 +1214,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1285,7 +1285,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1324,7 +1324,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1395,7 +1395,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1434,7 +1434,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1505,7 +1505,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1544,7 +1544,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1615,7 +1615,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1654,7 +1654,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/linux-arm\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1818,7 +1818,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1857,7 +1857,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1928,7 +1928,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -1967,7 +1967,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2038,7 +2038,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2077,7 +2077,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/tracebox/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2148,7 +2148,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2187,7 +2187,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2258,7 +2258,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2297,7 +2297,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2368,7 +2368,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -2407,7 +2407,7 @@
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced_probes/linux-arm64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
diff --git a/infra/luci/recipes/perfetto.expected/ci_win.json b/infra/luci/recipes/perfetto.expected/ci_win.json
index 9687045..34f2d95 100644
--- a/infra/luci/recipes/perfetto.expected/ci_win.json
+++ b/infra/luci/recipes/perfetto.expected/ci_win.json
@@ -188,7 +188,7 @@
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
       "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      {@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-uploaded:2019-09\", @@@",
+      "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-uploaded:2019-09\",@@@",
       "@@@STEP_LOG_LINE@json.output@        \"package\": \"chrome_internal/third_party/sdk/windows\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }@@@",
       "@@@STEP_LOG_LINE@json.output@    ]@@@",
@@ -224,16 +224,16 @@
       "@@@STEP_LOG_LINE@json.output@  \"env\": {@@@",
       "@@@STEP_LOG_LINE@json.output@    \"PATH\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      [@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"..\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"..\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"win_sdk\", @@@",
-      "@@@STEP_LOG_LINE@json.output@        \"bin\", @@@",
+      "@@@STEP_LOG_LINE@json.output@        \"..\",@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"..\",@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"win_sdk\",@@@",
+      "@@@STEP_LOG_LINE@json.output@        \"bin\",@@@",
       "@@@STEP_LOG_LINE@json.output@        \"x64\"@@@",
       "@@@STEP_LOG_LINE@json.output@      ]@@@",
-      "@@@STEP_LOG_LINE@json.output@    ], @@@",
+      "@@@STEP_LOG_LINE@json.output@    ],@@@",
       "@@@STEP_LOG_LINE@json.output@    \"VSINSTALLDIR\": [@@@",
       "@@@STEP_LOG_LINE@json.output@      [@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"..\", @@@",
+      "@@@STEP_LOG_LINE@json.output@        \"..\",@@@",
       "@@@STEP_LOG_LINE@json.output@        \"..\\\\\"@@@",
       "@@@STEP_LOG_LINE@json.output@      ]@@@",
       "@@@STEP_LOG_LINE@json.output@    ]@@@",
@@ -404,7 +404,7 @@
       "@@@STEP_NEST_LEVEL@1@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/windows-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -441,7 +441,7 @@
       "@@@STEP_NEST_LEVEL@1@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/trace_processor_shell/windows-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -512,7 +512,7 @@
       "@@@STEP_NEST_LEVEL@1@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/windows-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -549,7 +549,7 @@
       "@@@STEP_NEST_LEVEL@1@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traceconv/windows-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -620,7 +620,7 @@
       "@@@STEP_NEST_LEVEL@1@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/windows-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -657,7 +657,7 @@
       "@@@STEP_NEST_LEVEL@1@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/perfetto/windows-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -728,7 +728,7 @@
       "@@@STEP_NEST_LEVEL@1@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/windows-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
@@ -765,7 +765,7 @@
       "@@@STEP_NEST_LEVEL@1@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"instance_id\": \"40-chars-fake-of-the-package-instance_id\",@@@",
       "@@@STEP_LOG_LINE@json.output@    \"package\": \"perfetto/traced/windows-amd64\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
diff --git a/protos/perfetto/metrics/android/startup_metric.proto b/protos/perfetto/metrics/android/startup_metric.proto
index 599a07e..c5ad849 100644
--- a/protos/perfetto/metrics/android/startup_metric.proto
+++ b/protos/perfetto/metrics/android/startup_metric.proto
@@ -228,7 +228,13 @@
     optional int64 dex2oat_dur_ns = 7;
   }
 
-  // Next id: 21
+  // Contains detailed information for slow startup causes.
+  message SlowStartReasonDetailed {
+    optional string reason = 1;
+    optional string details = 2;
+  }
+
+  // Next id: 22
   message Startup {
     // Random id uniquely identifying an app startup in this trace.
     optional uint32 startup_id = 1;
@@ -299,6 +305,9 @@
     // Optional.
     repeated string slow_start_reason = 17;
 
+    // Same as slow_start_reason, but with more detailed information.
+    repeated SlowStartReasonDetailed slow_start_reason_detailed = 21;
+
     reserved 10;
   }
 
diff --git a/protos/perfetto/metrics/perfetto_merged_metrics.proto b/protos/perfetto/metrics/perfetto_merged_metrics.proto
index c518c7f..4021174 100644
--- a/protos/perfetto/metrics/perfetto_merged_metrics.proto
+++ b/protos/perfetto/metrics/perfetto_merged_metrics.proto
@@ -2052,7 +2052,13 @@
     optional int64 dex2oat_dur_ns = 7;
   }
 
-  // Next id: 21
+  // Contains detailed information for slow startup causes.
+  message SlowStartReasonDetailed {
+    optional string reason = 1;
+    optional string details = 2;
+  }
+
+  // Next id: 22
   message Startup {
     // Random id uniquely identifying an app startup in this trace.
     optional uint32 startup_id = 1;
@@ -2123,6 +2129,9 @@
     // Optional.
     repeated string slow_start_reason = 17;
 
+    // Same as slow_start_reason, but with more detailed information.
+    repeated SlowStartReasonDetailed slow_start_reason_detailed = 21;
+
     reserved 10;
   }
 
diff --git a/protos/perfetto/trace_processor/trace_processor.proto b/protos/perfetto/trace_processor/trace_processor.proto
index 8a6f511..48959ad 100644
--- a/protos/perfetto/trace_processor/trace_processor.proto
+++ b/protos/perfetto/trace_processor/trace_processor.proto
@@ -46,7 +46,8 @@
   // 7. Introduce GUESS_CPU_SIZE
   // 8. Add 'json' option to ComputeMetricArgs
   // 9. Add get_thread_state_summary_for_interval.
-  TRACE_PROCESSOR_CURRENT_API_VERSION = 9;
+  // 10. Add 'slice_is_ancestor' to stdlib.
+  TRACE_PROCESSOR_CURRENT_API_VERSION = 10;
 }
 
 // At lowest level, the wire-format of the RPC procol is a linear sequence of
diff --git a/protos/third_party/chromium/chrome_track_event.proto b/protos/third_party/chromium/chrome_track_event.proto
index 9237f78..90cde7d 100644
--- a/protos/third_party/chromium/chrome_track_event.proto
+++ b/protos/third_party/chromium/chrome_track_event.proto
@@ -1377,6 +1377,10 @@
     STEP_SEND_BEGIN_MAIN_FRAME = 8;
     STEP_SUBMIT_COMPOSITOR_FRAME = 9;
     STEP_SURFACE_AGGREGATION = 10;
+    STEP_SEND_BUFFER_SWAP = 11;
+    STEP_BUFFER_SWAP_POST_SUBMIT = 12;
+    STEP_FINISH_BUFFER_SWAP = 13;
+    STEP_SWAP_BUFFERS_ACK = 14;
   }
   enum FrameSkippedReason {
     SKIPPED_REASON_UNKNOWN = 0;
@@ -1393,9 +1397,110 @@
   optional FrameSkippedReason frame_skipped_reason = 6;
 };
 
+message LibunwindstackUnwinder {
+  // The enum is a copy of ErrorCode enum inside third_party/libunwindstack,
+  // ideally this should be in sync with that.
+  enum ErrorCode {
+    ERROR_NONE = 0;            // No error.
+    ERROR_MEMORY_INVALID = 1;  // Memory read failed.
+    ERROR_UNWIND_INFO = 2;     // Unable to use unwind information to unwind.
+    ERROR_UNSUPPORTED = 3;     // Encountered unsupported feature.
+    ERROR_INVALID_MAP = 4;     // Unwind in an invalid map.
+    ERROR_MAX_FRAMES_EXCEEDED = 5;  // The number of frames exceed the total
+                                    // allowed.
+    ERROR_REPEATED_FRAME = 6;  // The last frame has the same pc/sp as the next.
+    ERROR_INVALID_ELF = 7;     // Unwind in an invalid elf.
+    ERROR_THREAD_DOES_NOT_EXIST = 8;  // Attempt to unwind a local thread that
+                                      // does not exist.
+    ERROR_THREAD_TIMEOUT = 9;  // Timeout trying to unwind a local thread.
+    ERROR_SYSTEM_CALL = 10;    // System call failed while unwinding.
+    ERROR_BAD_ARCH = 11;       // Arch invalid (none, or mismatched).
+    ERROR_MAPS_PARSE = 12;     // Failed to parse maps data.
+    ERROR_INVALID_PARAMETER_LIBUNWINDSTACK =
+        13;                  // Invalid parameter passed to function.
+    ERROR_PTRACE_CALL = 14;  // Ptrace call failed while unwinding.
+  }
+  optional ErrorCode error_code = 1;
+  optional int32 num_frames = 2;
+};
+
+message ScrollPredictorMetrics {
+  message EventFrameValue {
+    optional int64 event_trace_id = 1;
+    // The fractional pixels (can be fractional after the predictor adjusts in
+    // resampling of input) that the page was scrolled by this frame.
+    optional float delta_value_pixels = 2;
+  };
+  // Data from the previous, current, and next frame used to determine the
+  // values below as according to the metric doc:
+  // http://doc/1Y0u0Tq5eUZff75nYUzQVw6JxmbZAW9m64pJidmnGWsY.
+  optional EventFrameValue prev_event_frame_value = 1;
+  optional EventFrameValue cur_event_frame_value = 2;
+  optional EventFrameValue next_event_frame_value = 3;
+  // This is the amount of delta processed in this frame that was above the
+  // janky threshold (as defined by
+  // http://doc/1Y0u0Tq5eUZff75nYUzQVw6JxmbZAW9m64pJidmnGWsY)
+  optional float janky_value_pixels = 4;
+  // True if we are also missing frames (so multiple frames are being presented
+  // at once).
+  optional bool has_missed_vsyncs = 5;
+  // True if we're moving less than the slow scroll threshold as defined by the
+  // doc above.
+  optional bool is_slow_scroll = 6;
+};
+
+//
+// Critical User Interaction metrics
+//
+
+message PageLoad {
+  optional int64 navigation_id = 1;
+  optional string url = 2;
+}
+
+message StartUp {
+  // This enum must be kept up to date with LaunchCauseMetrics.LaunchCause.
+  enum LauchCauseType {
+    OTHER = 0;
+    CUSTOM_TAB = 1;
+    TWA = 2;
+    RECENTS = 3;
+    RECENTS_OR_BACK = 4;
+    FOREGROUND_WHEN_LOCKED = 5;
+    MAIN_LAUNCHER_ICON = 6;
+    MAIN_LAUNCHER_ICON_SHORTCUT = 7;
+    HOME_SCREEN_WIDGET = 8;
+    OPEN_IN_BROWSER_FROM_MENU = 9;
+    EXTERNAL_SEARCH_ACTION_INTENT = 10;
+    NOTIFICATION = 11;
+    EXTERNAL_VIEW_INTENT = 12;
+    OTHER_CHROME = 13;
+    WEBAPK_CHROME_DISTRIBUTOR = 14;
+    WEBAPK_OTHER_DISTRIBUTOR = 15;
+    HOME_SCREEN_SHORTCUT = 16;
+    SHARE_INTENT = 17;
+    NFC = 18;
+  }
+
+  optional int64 activity_id = 1;
+  optional LauchCauseType launch_cause = 2;
+}
+
+message WebContentInteraction {
+  enum Type {
+    INTERACTION_UNSPECIFIED = 0;
+    INTERACTION_KEYBOARD = 1;
+    INTERACTION_CLICK_TAP = 2;
+    INTERACTION_DRAG = 3;
+  }
+
+  optional Type type = 1;
+  optional int64 total_duration_ms = 2;
+}
+
 message ChromeTrackEvent {
   // Extension range for Chrome: 1000-1999
-  // Next ID: 1053
+  // Next ID: 1059
   extend TrackEvent {
     optional ChromeAppState chrome_app_state = 1000;
 
@@ -1509,5 +1614,15 @@
     optional ChromeGraphicsPipeline chrome_graphics_pipeline = 1052;
 
     optional CrasUnified chromeos_cras_unified = 1053;
+
+    optional LibunwindstackUnwinder libunwindstack_unwinder = 1054;
+
+    optional ScrollPredictorMetrics scroll_predictor_metrics = 1055;
+
+    optional PageLoad page_load = 1056;
+
+    optional StartUp startup = 1057;
+
+    optional WebContentInteraction web_content_interaction = 1058;
   }
 }
diff --git a/python/generators/sql_processing/utils.py b/python/generators/sql_processing/utils.py
index f5c6a2c..0a05a71 100644
--- a/python/generators/sql_processing/utils.py
+++ b/python/generators/sql_processing/utils.py
@@ -173,7 +173,7 @@
 
 # Given SQL string check whether there is (not allowlisted) usage of
 # CREATE TABLE {name} AS.
-def check_banned_create_table_as(sql: str, filename: str,
+def check_banned_create_table_as(sql: str, filename: str, stdlib_path: str,
                                  allowlist: Dict[str, List[str]]) -> List[str]:
   errors = []
   for _, matches in match_pattern(CREATE_TABLE_AS_PATTERN, sql).items():
@@ -182,33 +182,13 @@
     # work on Windows for the Chrome stdlib presubmit.
     allowlist_normpath = dict(
         (os.path.normpath(path), tables) for path, tables in allowlist.items())
-    if os.path.normpath(filename) not in allowlist_normpath:
-      errors.append(f"CREATE TABLE '{name}' is deprecated."
-                    "Use CREATE PERFETTO TABLE instead.\n"
-                    f"Offending file: {filename}\n")
-      continue
-    if name not in allowlist_normpath[os.path.normpath(filename)]:
-      errors.append(
-          f"Table '{name}' uses CREATE TABLE which is deprecated "
-          "and this table is not allowlisted. Use CREATE PERFETTO TABLE.\n"
-          f"Offending file: {filename}\n")
-  return errors
-
-
-# Given SQL string check whether there is (not allowlisted) usage of
-# CREATE TABLE {name} AS.
-def check_banned_create_table_as(sql: str, filename: str, stdlib_path: str,
-                                 allowlist: Dict[str, List[str]]) -> List[str]:
-  errors = []
-  for _, matches in match_pattern(CREATE_TABLE_AS_PATTERN, sql).items():
-    name = matches[0]
-    allowlist_key = filename[len(stdlib_path):]
-    if allowlist_key not in allowlist:
+    allowlist_key = os.path.normpath(filename[len(stdlib_path):])
+    if allowlist_key not in allowlist_normpath:
       errors.append(f"CREATE TABLE '{name}' is deprecated. "
                     "Use CREATE PERFETTO TABLE instead.\n"
                     f"Offending file: {filename}\n")
       continue
-    if name not in allowlist[allowlist_key]:
+    if name not in allowlist_normpath[allowlist_key]:
       errors.append(
           f"Table '{name}' uses CREATE TABLE which is deprecated "
           "and this table is not allowlisted. Use CREATE PERFETTO TABLE.\n"
diff --git a/python/perfetto/prebuilts/manifests/trace_processor_shell.py b/python/perfetto/prebuilts/manifests/trace_processor_shell.py
index b31da6e..61ff73c 100755
--- a/python/perfetto/prebuilts/manifests/trace_processor_shell.py
+++ b/python/perfetto/prebuilts/manifests/trace_processor_shell.py
@@ -1,15 +1,15 @@
-# This file has been generated by: tools/roll-prebuilts v38.0
+# This file has been generated by: tools/roll-prebuilts v39.0
 TRACE_PROCESSOR_SHELL_MANIFEST = [{
     'arch':
         'mac-amd64',
     'file_name':
         'trace_processor_shell',
     'file_size':
-        9682976,
+        9814280,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/mac-amd64/trace_processor_shell',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/mac-amd64/trace_processor_shell',
     'sha256':
-        '74b097836f16d788edce11bfda46f52e6499d8ec546d10f8dbab182612407b3b',
+        'd3b61b97f2e18aa8e6ece06b3167a012d23f895a97ed12e1f400e3f0480b72af',
     'platform':
         'darwin',
     'machine': ['x86_64']
@@ -19,11 +19,11 @@
     'file_name':
         'trace_processor_shell',
     'file_size':
-        8180008,
+        8295768,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/mac-arm64/trace_processor_shell',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/mac-arm64/trace_processor_shell',
     'sha256':
-        '9a96a2f9ef81f210fcba4a08b21db6f2f57fb1d325e91924043ae066327c29a8',
+        '32560ee9eb8d86397fd8daec24e5e1e091e760c8cec708a1340cc7259cfd8f07',
     'platform':
         'darwin',
     'machine': ['arm64']
@@ -33,11 +33,11 @@
     'file_name':
         'trace_processor_shell',
     'file_size':
-        9533320,
+        9660152,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-amd64/trace_processor_shell',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-amd64/trace_processor_shell',
     'sha256':
-        'ee0ccae766aad09f0135efa83cc3a1cd78bd0e86824a7b1245e013d32e61d820',
+        'efbbb42291eecd0bd658694c6e60f3c7df5eee8b6e23ca6a1438059ddbd65667',
     'platform':
         'linux',
     'machine': ['x86_64']
@@ -47,11 +47,11 @@
     'file_name':
         'trace_processor_shell',
     'file_size':
-        6963584,
+        7066080,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-arm/trace_processor_shell',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-arm/trace_processor_shell',
     'sha256':
-        '2c69d2016dd18b6d42bf6c2a5b4398e29e4fd294950882387942272dd25a045a',
+        'c62db9a9be13fefc114301e5a42714e400201bbf3a90d4f35c46494fc91ac230',
     'platform':
         'linux',
     'machine': ['armv6l', 'armv7l', 'armv8l']
@@ -61,11 +61,11 @@
     'file_name':
         'trace_processor_shell',
     'file_size':
-        8950112,
+        9069000,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-arm64/trace_processor_shell',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-arm64/trace_processor_shell',
     'sha256':
-        'a10a7a9a6614461beb1f32ee16da3290e2770bb6f3a506269defbdbf7e8803af',
+        'f2f5c4de02d9bd8505bcea931de8605d93485c5479130835e49b3d6ecf23fc4a',
     'platform':
         'linux',
     'machine': ['aarch64']
@@ -75,55 +75,55 @@
     'file_name':
         'trace_processor_shell',
     'file_size':
-        6580152,
+        6707128,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-arm/trace_processor_shell',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-arm/trace_processor_shell',
     'sha256':
-        '994a038b932accf5796550207a4e7d80c7612fd25e6eee414324e7e4f3ae14f2'
+        '5a9a5b8965f7b923444cb3ec9dea10df322a22d82765335be3191314aea48bf5'
 }, {
     'arch':
         'android-arm64',
     'file_name':
         'trace_processor_shell',
     'file_size':
-        8115560,
+        8234344,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-arm64/trace_processor_shell',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-arm64/trace_processor_shell',
     'sha256':
-        '42426b12ad60894aee37e502e4d023cfded53e706d990abf5c70c4556c2b73ff'
+        'e6033a8928bc7b3ef6a5b4e56040219824dbba858b101241eb03513b39868829'
 }, {
     'arch':
         'android-x86',
     'file_name':
         'trace_processor_shell',
     'file_size':
-        9009020,
+        9148284,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-x86/trace_processor_shell',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-x86/trace_processor_shell',
     'sha256':
-        'af982ad7897d8cafb29a9f1303e32df20486a92eb07930db8b1898a75e84a667'
+        '38348a3295540e3c10d6622910d42844f37d7e849d3fbd8910b734df5c09f817'
 }, {
     'arch':
         'android-x64',
     'file_name':
         'trace_processor_shell',
     'file_size':
-        9270696,
+        9397672,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-x64/trace_processor_shell',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-x64/trace_processor_shell',
     'sha256':
-        '081be392ddccdf37da80dd888277ea9215cfa8d05ddf6f90d9bff13a0a72f672'
+        '2f91b3c32dd48891c0979c546074b208ea7c0aa46b8ef543835d8361cb962070'
 }, {
     'arch':
         'windows-amd64',
     'file_name':
         'trace_processor_shell.exe',
     'file_size':
-        8898560,
+        9078272,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/windows-amd64/trace_processor_shell.exe',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/windows-amd64/trace_processor_shell.exe',
     'sha256':
-        '2e66e5b6ab9c0f7ecad98c3b5b822133c9aa34f137b4007c228c78672fdea5a7',
+        '65e2e29e2b6c76388af17f268cf5e597896a6e135a0bbbd224174f25715f0a32',
     'platform':
         'win32',
     'machine': ['amd64']
diff --git a/python/perfetto/prebuilts/manifests/tracebox.py b/python/perfetto/prebuilts/manifests/tracebox.py
index 16ce884..8721e41 100755
--- a/python/perfetto/prebuilts/manifests/tracebox.py
+++ b/python/perfetto/prebuilts/manifests/tracebox.py
@@ -1,15 +1,15 @@
-# This file has been generated by: tools/roll-prebuilts v38.0
+# This file has been generated by: tools/roll-prebuilts v39.0
 TRACEBOX_MANIFEST = [{
     'arch':
         'mac-amd64',
     'file_name':
         'tracebox',
     'file_size':
-        1498560,
+        1498680,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/mac-amd64/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/mac-amd64/tracebox',
     'sha256':
-        'b760c7ed682d23f8d268174a939f1b8cb130ffb0d52f42b4cc4499a25423e782',
+        '07285ce963cb77212e580fe7034f6c380933c982a31272de47c7e0311d9144a1',
     'platform':
         'darwin',
     'machine': ['x86_64']
@@ -19,11 +19,11 @@
     'file_name':
         'tracebox',
     'file_size':
-        1376008,
+        1376136,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/mac-arm64/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/mac-arm64/tracebox',
     'sha256':
-        '2835127a5fc42e501e29a685a1cbcd98c26f977ee845bb1bd60a43008fd48161',
+        'f56e47303fde2de737d73bc0aebddb81a624a1130ab79ca22fb9aa4f41a4e662',
     'platform':
         'darwin',
     'machine': ['arm64']
@@ -33,11 +33,11 @@
     'file_name':
         'tracebox',
     'file_size':
-        2212088,
+        2218840,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-amd64/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-amd64/tracebox',
     'sha256':
-        '0b4a61a3e45f4e1b6111ca0b440f9e4a0b0726df912542373f69b6821a3113bc',
+        '6a23cdbae7ecdf77b2c1f72b33350c6e4a2098627454cff4af42c027808e2be8',
     'platform':
         'linux',
     'machine': ['x86_64']
@@ -47,11 +47,11 @@
     'file_name':
         'tracebox',
     'file_size':
-        1327204,
+        1332292,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-arm/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-arm/tracebox',
     'sha256':
-        '43c20d80e5b40cebe5b26579319be6d57796b04155ffc90f133b6a13c2de25ab',
+        '4732def5d23a3c66c3c286387488c9043d4f68d535d22af8374c3e1b9a9a61f5',
     'platform':
         'linux',
     'machine': ['armv6l', 'armv7l', 'armv8l']
@@ -61,11 +61,11 @@
     'file_name':
         'tracebox',
     'file_size':
-        2139928,
+        2147464,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-arm64/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-arm64/tracebox',
     'sha256':
-        '261cd7912dd69e8d82ce61b66a78f098eba46f6f492f6ec6bf73124d40a9a202',
+        'c9e83bc7b3d9059d3444392e509f96cbb242d45b0a0a27594a6b371c1a85e67f',
     'platform':
         'linux',
     'machine': ['aarch64']
@@ -75,42 +75,42 @@
     'file_name':
         'tracebox',
     'file_size':
-        1202132,
+        1230804,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-arm/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-arm/tracebox',
     'sha256':
-        '43874c4d187e3da5820ae3988d16608a8bf89d04282b8ab3e1486c6e57cd891f'
+        '2def9ce29483c8e368cc7aa3e49ff2da60555444e6cb25c5acaec7c570b06f57'
 }, {
     'arch':
         'android-arm64',
     'file_name':
         'tracebox',
     'file_size':
-        1825448,
+        1854120,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-arm64/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-arm64/tracebox',
     'sha256':
-        '9264d8f23ea3988f2952696668d3d572669134e4ca5b3e25a3209d3bfdb7d015'
+        '2484ee8210620a1dd9044610b75874302245d12aca7b59f6b7c3d55fe7ebcdde'
 }, {
     'arch':
         'android-x86',
     'file_name':
         'tracebox',
     'file_size':
-        1820588,
+        1853356,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-x86/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-x86/tracebox',
     'sha256':
-        'd591e903b1e2b0e4b270f0510c24992aac68167c80e61450ebf6c36cc780cd21'
+        '7b9f8f8eb98343bf645582439c4deb9785e6b63724ff9470a703e3bf7e2522c2'
 }, {
     'arch':
         'android-x64',
     'file_name':
         'tracebox',
     'file_size':
-        2108072,
+        2149032,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-x64/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-x64/tracebox',
     'sha256':
-        'd3e4278e17764b605236c568202eb8d94f3f7e7593b0be9eba09f670a987acba'
+        'f81afa4516b96c3ff66cfe65b9c64567771efeef3bcb2b518a6846d358c0b93c'
 }]
diff --git a/python/perfetto/prebuilts/manifests/traceconv.py b/python/perfetto/prebuilts/manifests/traceconv.py
index 7065064..1b60f70 100755
--- a/python/perfetto/prebuilts/manifests/traceconv.py
+++ b/python/perfetto/prebuilts/manifests/traceconv.py
@@ -1,15 +1,15 @@
-# This file has been generated by: tools/roll-prebuilts v38.0
+# This file has been generated by: tools/roll-prebuilts v39.0
 TRACECONV_MANIFEST = [{
     'arch':
         'mac-amd64',
     'file_name':
         'traceconv',
     'file_size':
-        8889568,
+        9004496,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/mac-amd64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/mac-amd64/traceconv',
     'sha256':
-        'e45d08f7050553f77c87764823c6ca26e877d0b3865f2764b33dcab6dfd0b9ee',
+        '11586dade97edf07d5b10fd5248127507fca16537f595d6530b81cbc266d1b12',
     'platform':
         'darwin',
     'machine': ['x86_64']
@@ -19,11 +19,11 @@
     'file_name':
         'traceconv',
     'file_size':
-        7447928,
+        7563688,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/mac-arm64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/mac-arm64/traceconv',
     'sha256':
-        '19cabe8789566e6383632bbe79e360b8bf05465f8bb156788c8c957aba77f224',
+        '48568604b4ad119f88d847d9b306102f47a5760b923ca574dfb08b3f49bdf253',
     'platform':
         'darwin',
     'machine': ['arm64']
@@ -33,11 +33,11 @@
     'file_name':
         'traceconv',
     'file_size':
-        8633416,
+        8757640,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-amd64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-amd64/traceconv',
     'sha256':
-        'a7a309c667a3e6a4c0268252540e3fc8052ebbd0abc30faf8f1783df411cf559',
+        'b263b7d4a63c923aad46940bde87063a647bb506667d857336f379d858d20646',
     'platform':
         'linux',
     'machine': ['x86_64']
@@ -47,11 +47,11 @@
     'file_name':
         'traceconv',
     'file_size':
-        6505268,
+        6605348,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-arm/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-arm/traceconv',
     'sha256':
-        '3ff0f9d4ef43e9e76d27c69827e508f4504d2d1fcfb4dac9d739023cd72106d7',
+        'c9454182a9e53b563511e1625533644829933cec13839a6fd3f08677a0e927c0',
     'platform':
         'linux',
     'machine': ['armv6l', 'armv7l', 'armv8l']
@@ -61,11 +61,11 @@
     'file_name':
         'traceconv',
     'file_size':
-        8108432,
+        8224984,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-arm64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-arm64/traceconv',
     'sha256':
-        '1f4641b341f2c8bf36faf8d4befedc01bd414c8f778a5b314c99c2d42c42c068',
+        '78cd7bfa0507c43c6ab728b691c5b885e18097d761c608a31388d3f8f7d84857',
     'platform':
         'linux',
     'machine': ['aarch64']
@@ -75,55 +75,55 @@
     'file_name':
         'traceconv',
     'file_size':
-        6096120,
+        6231288,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-arm/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-arm/traceconv',
     'sha256':
-        'f15c86b1d83bd1706b81426a6d11c3274044b4838abfb5d313954c65282162a9'
+        '87f57efb365dab3b5f4230518198cf0505476a6a8376842d41403ff0e7aa13ec'
 }, {
     'arch':
         'android-arm64',
     'file_name':
         'traceconv',
     'file_size':
-        7401672,
+        7528648,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-arm64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-arm64/traceconv',
     'sha256':
-        '8e98e30a8e137116e74390bcb9d662f0a3f22f9d38fe3fd7ef305d1051bdf19d'
+        '896d7af7632179a05ad4278482ec00ede09806d6d4c5e07d2cc7a802bc672b5b'
 }, {
     'arch':
         'android-x86',
     'file_name':
         'traceconv',
     'file_size':
-        8238268,
+        8393916,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-x86/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-x86/traceconv',
     'sha256':
-        '8ce56de90b18cc01d94b26f521292d71326552f8b4fb29b919f4b2b80c3eb2ec'
+        '6ce14e83af5a4e93d8dc7d39635ccb1cd7fffe988541b94960e167d33b5c5281'
 }, {
     'arch':
         'android-x64',
     'file_name':
         'traceconv',
     'file_size':
-        8397056,
+        8528128,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-x64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-x64/traceconv',
     'sha256':
-        'e5f31569261b3f201e2cc13b8eea510627d555767272373d9196e83ddaefa3f0'
+        '11aeb6293736175c09aacff155f793eb5508ab627f612cdecf7fec7e60485d78'
 }, {
     'arch':
         'windows-amd64',
     'file_name':
         'traceconv.exe',
     'file_size':
-        7867904,
+        8034304,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/windows-amd64/traceconv.exe',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/windows-amd64/traceconv.exe',
     'sha256':
-        '74c24b2a74ae2a490ac5f918ab079a7713af07e9a36e70a2cc8536040d7df099',
+        'd53e20465cf326b5d9f5f3513cc5cd387889024ed940ec243f56dcf6fe178279',
     'platform':
         'win32',
     'machine': ['amd64']
diff --git a/python/perfetto/trace_processor/metrics.descriptor b/python/perfetto/trace_processor/metrics.descriptor
index b989e77..1fb3d89 100644
--- a/python/perfetto/trace_processor/metrics.descriptor
+++ b/python/perfetto/trace_processor/metrics.descriptor
Binary files differ
diff --git a/python/perfetto/trace_processor/trace_processor.descriptor b/python/perfetto/trace_processor/trace_processor.descriptor
index 8b8383f..ecb561d 100644
--- a/python/perfetto/trace_processor/trace_processor.descriptor
+++ b/python/perfetto/trace_processor/trace_processor.descriptor
Binary files differ
diff --git a/src/trace_processor/metrics/sql/android/BUILD.gn b/src/trace_processor/metrics/sql/android/BUILD.gn
index a2e64da..d6c5589 100644
--- a/src/trace_processor/metrics/sql/android/BUILD.gn
+++ b/src/trace_processor/metrics/sql/android/BUILD.gn
@@ -126,6 +126,7 @@
     "startup/launches_minsdk33.sql",
     "startup/mcycles_per_launch.sql",
     "startup/slice_functions.sql",
+    "startup/slow_start_reasons.sql",
     "startup/system_state.sql",
     "startup/thread_state_breakdown.sql",
     "unsymbolized_frames.sql",
diff --git a/src/trace_processor/metrics/sql/android/android_startup.sql b/src/trace_processor/metrics/sql/android/android_startup.sql
index b14e5cb..cc401b6 100644
--- a/src/trace_processor/metrics/sql/android/android_startup.sql
+++ b/src/trace_processor/metrics/sql/android/android_startup.sql
@@ -25,6 +25,9 @@
 SELECT RUN_METRIC('android/startup/slice_functions.sql');
 INCLUDE PERFETTO MODULE common.timestamps;
 
+-- Define helper functions related to slow start reasons
+SELECT RUN_METRIC('android/startup/slow_start_reasons.sql');
+
 -- Run all the HSC metrics.
 SELECT RUN_METRIC('android/startup/hsc.sql');
 
@@ -338,6 +341,8 @@
       'dex2oat_dur_ns',
       dur_of_process_running_concurrent_to_launch(launches.startup_id, '*dex2oat64')
     ),
+    -- Remove slow_start_reason implementation once slow_start_reason_detailed
+    -- is added to slow_start dashboards. (b/308460401)
     'slow_start_reason', (SELECT RepeatedField(slow_cause)
       FROM (
         SELECT 'No baseline or cloud profiles' AS slow_cause
@@ -481,11 +486,12 @@
         SELECT 'Main Thread - Binder transactions blocked'
         WHERE (
           SELECT COUNT(1)
-          FROM BINDER_TRANSACTION_REPLY_SLICES_FOR_LAUNCH(launches.startup_id, 2e7)
+          FROM binder_transaction_reply_slices_for_launch(launches.startup_id, 2e7)
         ) > 0
 
       )
-    )
+    ),
+    'slow_start_reason_detailed', get_slow_start_reason_detailed(launches.startup_id)
   ) AS startup
 FROM android_startups launches;
 
diff --git a/src/trace_processor/metrics/sql/android/startup/slow_start_reasons.sql b/src/trace_processor/metrics/sql/android/startup/slow_start_reasons.sql
new file mode 100644
index 0000000..e9b1393
--- /dev/null
+++ b/src/trace_processor/metrics/sql/android/startup/slow_start_reasons.sql
@@ -0,0 +1,391 @@
+--
+-- Copyright 2022 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
+--
+--     https://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 MODULE android.startup.startups;
+
+SELECT RUN_METRIC('android/startup/thread_state_breakdown.sql');
+SELECT RUN_METRIC('android/startup/system_state.sql');
+SELECT RUN_METRIC('android/startup/mcycles_per_launch.sql');
+
+CREATE OR REPLACE PERFETTO FUNCTION get_percent(num LONG, total LONG)
+RETURNS STRING AS
+  SELECT SUBSTRING(CAST(($num * 100 + 0.0) / $total AS STRING), 1, 5);
+
+CREATE OR REPLACE PERFETTO FUNCTION get_ns_to_s(ns LONG)
+RETURNS STRING AS
+  SELECT CAST(($ns + 0.0) / 1e9 AS STRING);
+
+CREATE OR REPLACE PERFETTO FUNCTION get_ns_to_ms(ns LONG)
+RETURNS STRING AS
+  SELECT SUBSTRING(CAST(($ns + 0.0) / 1e6 AS STRING), 1, 6);
+
+CREATE OR REPLACE PERFETTO FUNCTION get_longest_chunk(start_ns LONG, dur_ns LONG, tid LONG, name STRING)
+RETURNS STRING AS
+  SELECT " [ longest_chunk:"
+    || " start_s " || get_ns_to_s($start_ns - TRACE_START())
+    || " dur_ms " || get_ns_to_ms($dur_ns)
+    || " thread_id " || $tid
+    || " thread_name " || $name
+    || " ]";
+
+CREATE OR REPLACE PERFETTO FUNCTION get_main_thread_time_for_launch_in_runnable_state(
+  startup_id LONG, launches_dur LONG)
+RETURNS STRING AS
+  SELECT
+    " target" || " 15%"
+    || " actual "
+    || get_percent(main_thread_time_for_launch_in_runnable_state($startup_id), $launches_dur)
+    || "%"
+    || get_longest_chunk(ts, dur, tid, name)
+    || " [ extra_info: "
+    || " launches_dur_ms " || get_ns_to_ms($launches_dur)
+    || " runnable_dur_ms "
+    || get_ns_to_ms(main_thread_time_for_launch_in_runnable_state($startup_id))
+    || " R_sum_dur_ms "
+    || get_ns_to_ms(IFNULL(main_thread_time_for_launch_and_state($startup_id, "R"), 0))
+    || " R+(Preempted)_sum_dur_ms "
+    || get_ns_to_ms(IFNULL(main_thread_time_for_launch_and_state($startup_id, "R+"), 0))
+    || " ]"
+  FROM launch_threads_by_thread_state l
+  JOIN thread USING (utid)
+  WHERE l.startup_id = $startup_id AND (state GLOB "R" OR state GLOB "R+") AND l.is_main_thread
+  ORDER BY dur DESC
+  LIMIT 1;
+
+CREATE OR REPLACE PERFETTO FUNCTION get_android_sum_dur_on_main_thread_for_startup_and_slice(
+  startup_id LONG, slice_name STRING, launches_dur LONG)
+RETURNS STRING AS
+  SELECT
+    " target" || " 20%"
+    || " actual "
+    || get_percent(android_sum_dur_on_main_thread_for_startup_and_slice(
+          $startup_id, $slice_name), $launches_dur) || "%"
+    || get_longest_chunk(slice_ts, slice_dur, tid, name)
+    || " [ extra_info: "
+    || " launches_dur_ms " || get_ns_to_ms($launches_dur)
+    || " sum_dur_ms "
+    || get_ns_to_ms(android_sum_dur_on_main_thread_for_startup_and_slice($startup_id, $slice_name))
+    || " ]"
+    FROM android_thread_slices_for_all_startups slices
+    JOIN thread USING (utid)
+    WHERE startup_id = $startup_id AND slice_name GLOB $slice_name AND slices.is_main_thread
+    ORDER BY slice_dur DESC
+    LIMIT 1;
+
+CREATE OR REPLACE PERFETTO FUNCTION get_android_sum_dur_for_startup_and_slice(
+  startup_id LONG, slice_name STRING, target_ms LONG)
+RETURNS STRING AS
+  SELECT
+    " target " || $target_ms || "ms"
+    || " actual "
+    || get_ns_to_ms(android_sum_dur_for_startup_and_slice($startup_id, $slice_name)) || "ms"
+    || get_longest_chunk(slice_ts, slice_dur, tid, name)
+    FROM android_thread_slices_for_all_startups
+    JOIN thread USING (utid)
+    WHERE startup_id = $startup_id AND slice_name GLOB $slice_name
+    ORDER BY slice_dur DESC
+    LIMIT 1;
+
+CREATE OR REPLACE PERFETTO FUNCTION get_potential_cpu_contention_with_another_process(startup_id LONG)
+RETURNS STRING AS
+  SELECT
+    " target" || " 100ms"
+    || " actual "
+    || get_ns_to_ms(main_thread_time_for_launch_in_runnable_state($startup_id)) || "ms"
+    || " most_active_process_for_launch " || most_active_process_for_launch($startup_id)
+    || get_longest_chunk(ts, dur, tid, name)
+    || " [ extra_info: "
+    || " runnable_dur_ms "
+    || get_ns_to_ms(main_thread_time_for_launch_in_runnable_state($startup_id))
+    || " R_sum_dur_ms "
+    || get_ns_to_ms(IFNULL(main_thread_time_for_launch_and_state($startup_id, "R"), 0))
+    || " R+(Preempted)_sum_dur "
+    || IFNULL(main_thread_time_for_launch_and_state($startup_id, "R+"), 0)
+    || " ]"
+  FROM launch_threads_by_thread_state l
+  JOIN thread USING (utid)
+  WHERE l.startup_id = $startup_id AND (state GLOB "R" OR state GLOB "R+") AND l.is_main_thread
+  ORDER BY dur DESC
+  LIMIT 1;
+
+CREATE OR REPLACE PERFETTO FUNCTION get_jit_activity(startup_id LONG)
+RETURNS STRING AS
+  SELECT
+    " target" || " 100ms"
+    || " actual "
+    || get_ns_to_ms(thread_time_for_launch_state_and_thread(
+      $startup_id, 'Running', 'Jit thread pool'))
+    || "ms"
+    || get_longest_chunk(ts, dur, tid, name)
+  FROM launch_threads_by_thread_state l
+  JOIN thread USING (utid)
+  WHERE l.startup_id = $startup_id AND state GLOB 'Running' AND thread_name = 'Jit thread pool'
+  ORDER BY dur DESC
+  LIMIT 1;
+
+CREATE OR REPLACE PERFETTO FUNCTION get_main_thread_binder_transactions_blocked(
+  startup_id LONG, threshold DOUBLE)
+RETURNS STRING AS
+  SELECT
+    " per_instance_target" || " 20ms"
+    || " per_instance_actual " || get_ns_to_ms(request.slice_dur) || "ms"
+    || get_longest_chunk(request.slice_ts, request.slice_dur, tid, request.thread_name)
+    || " [ extra_info: "
+    || " reply.dur_ms " || get_ns_to_ms(reply.dur)
+    || " ]"
+  FROM (
+    SELECT slice_id as id, slice_dur, thread_name, process.name as process,
+      s.arg_set_id, is_main_thread,
+      slice_ts, s.utid
+    FROM android_thread_slices_for_all_startups s
+    JOIN process ON (
+      EXTRACT_ARG(s.arg_set_id, "destination process") = process.pid
+    )
+    WHERE startup_id = $startup_id AND slice_name GLOB "binder transaction"
+      AND slice_dur > $threshold
+  ) request
+  JOIN following_flow(request.id) arrow
+  JOIN slice reply ON reply.id = arrow.slice_in
+  JOIN thread USING (utid)
+  WHERE reply.dur > $threshold AND request.is_main_thread
+  ORDER BY request.slice_dur DESC
+  LIMIT 1;
+
+CREATE OR REPLACE PERFETTO FUNCTION get_missing_baseline_profile_for_launch(
+  startup_id LONG, pkg_name STRING)
+RETURNS STRING AS
+  SELECT
+    " target " || "FALSE"
+    || " actual " || "TRUE"
+    || get_longest_chunk(slice_ts, slice_dur, -1, thread_name)
+    || " [ extra_info: "
+    || " slice_name " || slice_name
+    || " ]"
+    FROM (
+      SELECT *
+      FROM ANDROID_SLICES_FOR_STARTUP_AND_SLICE_NAME(
+        $startup_id,
+        "location=* status=* filter=* reason=*"
+      )
+      ORDER BY slice_name
+    )
+    WHERE
+      -- when location is the package odex file and the reason is "install" or "install-dm",
+      -- if the compilation filter is not "speed-profile", baseline/cloud profile is missing.
+      SUBSTR(STR_SPLIT(slice_name, " status=", 0), LENGTH("location=") + 1)
+        GLOB ("*" || $pkg_name || "*odex")
+      AND (STR_SPLIT(slice_name, " reason=", 1) = "install"
+        OR STR_SPLIT(slice_name, " reason=", 1) = "install-dm")
+    ORDER BY slice_dur DESC
+    LIMIT 1;
+
+
+CREATE PERFETTO FUNCTION get_slow_start_reason_detailed(startup_id LONG)
+RETURNS PROTO AS
+      SELECT RepeatedField(AndroidStartupMetric_SlowStartReasonDetailed(
+        'reason', slow_cause,
+        'details', details))
+      FROM (
+        SELECT 'No baseline or cloud profiles' AS slow_cause,
+          get_missing_baseline_profile_for_launch(launch.startup_id, launch.package) as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+          AND missing_baseline_profile_for_launch(launch.startup_id, launch.package)
+
+        UNION ALL
+        SELECT 'Optimized artifacts missing, run from apk' as slow_cause, NULL as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+          AND  run_from_apk_for_launch(launch.startup_id)
+
+        UNION ALL
+        SELECT 'Unlock running during launch' as slow_cause, NULL as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+         AND is_unlock_running_during_launch(launch.startup_id)
+
+        UNION ALL
+        SELECT 'App in debuggable mode' as slow_cause, NULL as details
+       	FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+          AND is_process_debuggable(launch.package)
+
+        UNION ALL
+        SELECT 'GC Activity' as slow_cause, NULL as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+          AND total_gc_time_by_launch(launch.startup_id) > 0
+
+        UNION ALL
+        SELECT 'dex2oat running during launch' AS slow_cause, NULL as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id AND
+          dur_of_process_running_concurrent_to_launch(launch.startup_id, '*dex2oat64') > 0
+
+        UNION ALL
+        SELECT 'installd running during launch' AS slow_cause, NULL as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id AND
+          dur_of_process_running_concurrent_to_launch(launch.startup_id, '*installd') > 0
+
+        UNION ALL
+        SELECT 'Main Thread - Time spent in Runnable state' as slow_cause,
+          get_main_thread_time_for_launch_in_runnable_state(
+            launch.startup_id, launch.dur) as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+          AND main_thread_time_for_launch_in_runnable_state(launch.startup_id) > launch.dur * 0.15
+
+        UNION ALL
+        SELECT 'Main Thread - Time spent in interruptible sleep state'
+          AS slow_cause, NULL as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+          AND main_thread_time_for_launch_and_state(launch.startup_id, 'S') > 2900e6
+
+        UNION ALL
+        SELECT 'Main Thread - Time spent in Blocking I/O' as slow_cause, NULL as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+          AND main_thread_time_for_launch_state_and_io_wait(launch.startup_id, 'D*', TRUE) > 450e6
+
+        UNION ALL
+        SELECT 'Main Thread - Time spent in OpenDexFilesFromOat*' as slow_cause,
+          get_android_sum_dur_on_main_thread_for_startup_and_slice(
+            launch.startup_id, 'OpenDexFilesFromOat*', launch.dur) as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id AND
+          android_sum_dur_on_main_thread_for_startup_and_slice(
+          launch.startup_id, 'OpenDexFilesFromOat*') > launch.dur * 0.2
+
+        UNION ALL
+        SELECT 'Time spent in bindApplication'
+          AS slow_cause, NULL as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+          AND android_sum_dur_for_startup_and_slice(launch.startup_id, 'bindApplication') > 1250e6
+
+        UNION ALL
+        SELECT 'Time spent in view inflation' as slow_cause, NULL as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+          AND android_sum_dur_for_startup_and_slice(launch.startup_id, 'inflate') > 450e6
+
+        UNION ALL
+        SELECT 'Time spent in ResourcesManager#getResources' as slow_cause,
+          get_android_sum_dur_for_startup_and_slice(
+            launch.startup_id, 'ResourcesManager#getResources', 130) as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+          AND android_sum_dur_for_startup_and_slice(
+          launch.startup_id, 'ResourcesManager#getResources') > 130e6
+
+        UNION ALL
+        SELECT 'Time spent verifying classes'
+          AS slow_cause, NULL as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id AND
+          android_sum_dur_for_startup_and_slice(launch.startup_id, 'VerifyClass*')
+            > launch.dur * 0.15
+
+        UNION ALL
+        SELECT 'Potential CPU contention with another process' AS slow_cause,
+          get_potential_cpu_contention_with_another_process(launch.startup_id) as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id AND
+          main_thread_time_for_launch_in_runnable_state(launch.startup_id) > 100e6 AND
+          most_active_process_for_launch(launch.startup_id) IS NOT NULL
+
+        UNION ALL
+        SELECT 'JIT Activity' as slow_cause,
+          get_jit_activity(launch.startup_id) as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+        AND thread_time_for_launch_state_and_thread(
+          launch.startup_id,
+          'Running',
+          'Jit thread pool'
+        ) > 100e6
+
+        UNION ALL
+        SELECT 'Main Thread - Lock contention'
+          AS slow_cause, NULL as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+          AND android_sum_dur_on_main_thread_for_startup_and_slice(
+          launch.startup_id,
+          'Lock contention on*'
+        ) > launch.dur * 0.2
+
+        UNION ALL
+        SELECT 'Main Thread - Monitor contention'
+          AS slow_cause, NULL as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+          AND android_sum_dur_on_main_thread_for_startup_and_slice(
+          launch.startup_id,
+          'Lock contention on a monitor*'
+        ) > launch.dur * 0.15
+
+        UNION ALL
+        SELECT 'JIT compiled methods' as slow_cause, NULL as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+          AND (
+          SELECT COUNT(1)
+          FROM ANDROID_SLICES_FOR_STARTUP_AND_SLICE_NAME(launch.startup_id, 'JIT compiling*')
+          WHERE thread_name = 'Jit thread pool'
+        ) > 65
+
+        UNION ALL
+        SELECT 'Broadcast dispatched count' as slow_cause, NULL as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+          AND count_slices_concurrent_to_launch(
+          launch.startup_id,
+          'Broadcast dispatched*'
+        ) > 15
+
+        UNION ALL
+        SELECT 'Broadcast received count' as slow_cause, NULL as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+          AND count_slices_concurrent_to_launch(
+          launch.startup_id,
+          'broadcastReceiveReg*'
+        ) > 50
+
+        UNION ALL
+        SELECT 'Startup running concurrent to launch' as slow_cause, NULL as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+          AND EXISTS(
+          SELECT package
+          FROM android_startups l
+          WHERE l.startup_id != launch.startup_id
+            AND is_spans_overlapping(l.ts, l.ts_end, launch.ts, launch.ts_end)
+        )
+
+        UNION ALL
+        SELECT 'Main Thread - Binder transactions blocked' as slow_cause,
+          get_main_thread_binder_transactions_blocked(launch.startup_id, 2e7) as details
+        FROM android_startups launch
+        WHERE launch.startup_id = $startup_id
+          AND (
+          SELECT COUNT(1)
+          FROM BINDER_TRANSACTION_REPLY_SLICES_FOR_LAUNCH(launch.startup_id, 2e7)
+        ) > 0
+      );
diff --git a/src/trace_processor/perfetto_sql/engine/perfetto_sql_engine.h b/src/trace_processor/perfetto_sql/engine/perfetto_sql_engine.h
index 23f47dc..6a8d2d0 100644
--- a/src/trace_processor/perfetto_sql/engine/perfetto_sql_engine.h
+++ b/src/trace_processor/perfetto_sql/engine/perfetto_sql_engine.h
@@ -132,6 +132,7 @@
   // Makes new SQL module available to import.
   void RegisterModule(const std::string& name,
                       sql_modules::RegisteredModule module) {
+    modules_.Erase(name);
     modules_.Insert(name, std::move(module));
   }
 
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/BUILD.gn b/src/trace_processor/perfetto_sql/stdlib/chrome/BUILD.gn
index 7665102..adbd429 100644
--- a/src/trace_processor/perfetto_sql/stdlib/chrome/BUILD.gn
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/BUILD.gn
@@ -1,34 +1,14 @@
-# Copyright (C) 2022 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.
+# Copyright 2023 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
 
+# List the SQL files in the perfetto_sql_files.gni so the list can be
+# used in Chromium targets as well.
+import("perfetto_sql_files.gni")
+
+# This file is rolled to Perfetto so this relative path is intended to
+# work in the Perfetto repository but does not make sense here.
 import("../../../../../gn/perfetto_sql.gni")
-
 perfetto_sql_source_set("chrome_sql") {
-  sources = [
-    "chrome_scrolls.sql",
-    "cpu_powerups.sql",
-    "histograms.sql",
-    "interactions.sql",
-    "metadata.sql",
-    "page_loads.sql",
-    "scroll_jank/scroll_jank_intervals.sql",
-    "scroll_jank/scroll_jank_v3.sql",
-    "scroll_jank/scroll_jank_v3_cause.sql",
-    "scroll_jank/scroll_offsets.sql",
-    "scroll_jank/utils.sql",
-    "speedometer.sql",
-    "tasks.sql",
-    "vsync_intervals.sql",
-  ]
+  sources = chrome_stdlib_sql_files
 }
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/chrome_scrolls.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/chrome_scrolls.sql
index 80b371c..f6e29f9 100644
--- a/src/trace_processor/perfetto_sql/stdlib/chrome/chrome_scrolls.sql
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/chrome_scrolls.sql
@@ -1,16 +1,6 @@
--- Copyright 2023 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
---
---     https://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.
+-- Copyright 2023 The Chromium Authors
+-- Use of this source code is governed by a BSD-style license that can be
+-- found in the LICENSE file.
 
 -- Defines slices for all of the individual scrolls in a trace based on the
 -- LatencyInfo-based scroll definition.
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/cpu_powerups.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/cpu_powerups.sql
index 4fa04a7..3d51765 100644
--- a/src/trace_processor/perfetto_sql/stdlib/chrome/cpu_powerups.sql
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/cpu_powerups.sql
@@ -1,16 +1,6 @@
--- Copyright 2022 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
---
---     https://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.
+-- Copyright 2023 The Chromium Authors
+-- Use of this source code is governed by a BSD-style license that can be
+-- found in the LICENSE file.
 
 -- Find causes for CPUs powering up.
 --
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/event_latency_description.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/event_latency_description.sql
new file mode 100644
index 0000000..ca89dae
--- /dev/null
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/event_latency_description.sql
@@ -0,0 +1,183 @@
+-- Copyright 2023 The Chromium Authors
+-- Use of this source code is governed by a BSD-style license that can be
+-- found in the LICENSE file.
+
+-- Source of truth of the descriptions of EventLatency stages.
+CREATE PERFETTO TABLE chrome_event_latency_stage_descriptions (
+    -- The name of the EventLatency stage.
+    name STRING,
+    -- A description of the EventLatency stage.
+    description STRING
+) AS
+WITH event_latency_descriptions(
+  name,
+  description)
+AS (
+VALUES
+  ('TouchRendererHandlingToBrowserMain',
+    'Interval between when the website handled blocking touch move to when ' ||
+    'the browser UI thread started processing the input. Blocking touch ' ||
+    'move happens when a touch event has to be handled by the website ' ||
+    'before being converted to a scroll.'),
+  ('GenerationToBrowserMain',
+    'Interval between OS-provided hardware input timestamp to when the ' ||
+    'browser UI thread began processing the input.'),
+  ('GenerationToRendererCompositor',
+    'Interval between OS-provided hardware input timestamp to when the ' ||
+    'renderer compositor thread starts handling the artificial TOUCH_PRESS ' ||
+    'browser injects in the kTouchScrollStarted event. See ' ||
+    'PrependTouchScrollNotification for more info.'),
+  ('BrowserMainToRendererCompositor',
+    'Interval between when Browser UI thread starts to process the input to ' ||
+    'renderer compositor thread starting to process it. This stage includes ' ||
+    'browser UI thread processing, and task queueing times on the IO and ' ||
+    'renderer compositor threads.'),
+  ('RendererCompositorQueueingDelay',
+    'Interval between when the input event is queued in the renderer ' ||
+    'compositor and start of the BeginImplFrame producing a frame ' ||
+    'containing this input.'),
+  ('RendererCompositorToMain',
+    'Interval between when the Renderer Compositor finishes processing the ' ||
+    'event and when the Renderer Main (CrRendererMain) starts processing ' ||
+    'the event, only seen when the compositor thread cannot handle the ' ||
+    'scroll event by itself (known as "slow path"), usually caused by the ' ||
+    'presence of blocking JS event listeners or complex page layout.'),
+  ('RendererCompositorProcessing',
+    'Interval corresponding to the Renderer Compositor thread processing ' ||
+    'the frame updates.'),
+  ('RendererMainProcessing',
+    'Interval corresponding to the Renderer Main thread processing the ' ||
+    'frame updates.'),
+  ('EndActivateToSubmitCompositorFrame',
+    'Interval that the Renderer Compositor waits for the GPU to flush a ' ||
+    'frame to submit a new one.'),
+  ('SubmitCompositorFrameToPresentationCompositorFrame',
+    'Interval between the first Renderer Frame received to when the system ' ||
+    'presented the fully composited frame on the screen. Note that on some ' ||
+    'systems/apps this is incomplete/inaccurate due to lack of feedback ' ||
+    'timestamps from the platform (Mac, iOS, Android Webview, etc).'),
+  ('ArrivedInRendererCompositorToTermination',
+    'Interval between when Renderer Compositor received the frame to when ' ||
+    'this input was decided to either be ignored or merged into another ' ||
+    'frame being produced. This could be a dropped frame, or just a normal ' ||
+    'coalescing.'),
+  ('RendererCompositorStartedToTermination',
+    'Interval between when Renderer Compositor started processing the frame ' ||
+    'to when this input was decided to either be ignored or merged into ' ||
+    'another frame being produced. This could be a dropped frame, or just a ' ||
+    'normal coalescing.'),
+  ('RendererMainFinishedToTermination',
+    'Interval between when Renderer Main finished processing the frame ' ||
+    'to when this input was decided to either be ignored or merged into ' ||
+    'another frame being produced. This could be a dropped frame, or just a ' ||
+    'normal coalescing.'),
+  ('RendererCompositorFinishedToTermination',
+    'Interval between when Renderer Compositor finished processing the ' ||
+    'frame to when this input was decided to either be ignored or merged ' ||
+    'into another frame being produced. This could be just a normal ' ||
+    'coalescing.'),
+  ('RendererMainStartedToTermination',
+    'Interval between when Renderer Main started processing the frame ' ||
+    'to when this input was decided to either be ignored or merged into ' ||
+    'another frame being produced. This could be a dropped frame, or just a ' ||
+    'normal coalescing.'),
+  ('RendererCompositorFinishedToBeginImplFrame',
+    'Interval when Renderer Compositor has finished processing a vsync ' ||
+    '(with input), but did not end up producing a CompositorFrame due to ' ||
+    'reasons such as waiting on main thread, and is now waiting for the ' ||
+    'next BeginFrame from the GPU VizCompositor.'),
+  ('RendererCompositorFinishedToCommit',
+    'Interval between when the Renderer Compositor has finished its work ' ||
+    'and the current tree state will be committed from the Renderer Main ' ||
+    '(CrRendererMain) thread.'),
+  ('RendererCompositorFinishedToEndCommit',
+    'Interval between when the Renderer Compositor finishing processing to ' ||
+    'the Renderer Main (CrRendererMain) both starting and finishing the ' ||
+    'commit.'),
+  ('RendererCompositorFinishedToActivation',
+    'Interval of activation without a previous commit (not as a stage with ' ||
+    'ToEndCommit). Activation occurs on the Renderer Compositor Thread ' ||
+    'after it has been notified of a fully committed RendererMain tree.'),
+  ('RendererCompositorFinishedToEndActivate',
+    'Interval when the Renderer Compositor has finished processing and ' ||
+    'activating the Tree.'),
+  ('RendererCompositorFinishedToSubmitCompositorFrame',
+    'Interval when processing does not need to wait for a commit (can do an ' ||
+    'early out) for activation and can go straight to providing the frame ' ||
+    'to the GPU VizCompositor. The Renderer Compositor is waiting for the ' ||
+    'GPU to flush a frame so that it can then submit a new frame.'),
+  ('RendererMainFinishedToBeginImplFrame',
+    'Interval when the input was sent first to the RendererMain thread and ' ||
+    'now requires the Renderer Compositor to react, aka it is is waiting ' ||
+    'for a BeginFrame signal.'),
+  ('RendererMainFinishedToSendBeginMainFrame',
+    'Interval during which the Renderer Main (CrRendererMain) thread is ' ||
+    'waiting for BeginMainFrame.'),
+  ('RendererMainFinishedToCommit',
+    'Interval when the Renderer Main (CrRendererMain) is ready to commit ' ||
+    'its work to the Renderer Compositor.'),
+  ('BeginImplFrameToSendBeginMainFrame',
+    'Interval during which the Renderer Compositor has received the ' ||
+    'BeginFrame signal from the GPU VizCompositor, and now needs to send it ' ||
+    'to the Renderer Main thread (CrRendererMain).'),
+  ('RendererCompositorFinishedToSendBeginMainFrame',
+    'Interval during which the Renderer Compositor is waiting for a ' ||
+    'BeginFrame from the GPU VizCompositor, and it expects to have to do ' ||
+    'work on the Renderer Main thread (CrRendererMain), so we are waiting ' ||
+    'for a BeginMainFrame'),
+  ('SendBeginMainFrameToCommit',
+    'Interval when updates (such as HandleInputEvents, Animate, StyleUpdate ' ||
+    'and LayoutUpdate) are updatedon the Renderer Main thread ' ||
+    '(CrRendererMain).'),
+  ('Commit',
+    'Interval during which the Renderer Main thread (CrRendererMain) ' ||
+    'commits updates back to Renderer Compositor for activation. ' ||
+    'Specifically, the main thread copies its own version of layer tree ' ||
+    'onto the pending tree on the compositor thread. The main thread is ' ||
+    'blocked during the copying process.'),
+  ('EndCommitToActivation',
+    'Interval when the commit is ready and waiting for activation.'),
+  ('Activation',
+    'Interval when the layer trees and properties are on the pending tree ' ||
+    'is pused to the active tree on the Renderer Compositor.'),
+  ('SubmitToReceiveCompositorFrame',
+    'Interval of the delay b/w Renderer Compositor thread sending ' ||
+    'CompositorFrame and then GPU VizCompositorThread receiving the ' ||
+    'CompositorFrame.'),
+  ('ReceiveCompositorFrameToStartDraw',
+    'Interval between the first frame received to when all frames (or ' ||
+    'timeouts have occured) and we start drawing. It can be blocked by ' ||
+    'other processes (e.g to draw a toolbar it waiting for information from ' ||
+    'the Browser) as it waits for timeouts or frames to be provided. This ' ||
+    'is the tree of dependencies that the GPU VizCompositor is waiting for ' ||
+    'things to arrive. That is creating a single frame for multiple ' ||
+    'compositor frames. '),
+  ('StartDrawToSwapStart',
+    'Interval when all compositing sources are done, or compositing ' ||
+    'deadline passes - the viz thread takes all the latest composited ' ||
+    'surfaces and issues the software draw instructions to layer the ' ||
+    'composited tiles, this substage ends when the swap starts on Gpu ' ||
+    'CompositorGpuThread.'),
+  ('SwapStartToBufferAvailable',
+    'Interval that is a substage of stage "Swap" when the framebuffer ' ||
+    'is prepared by the system and the fence Chrome waits on before ' ||
+    'writing is signalled, and Chrome can start transferring the new frame.'),
+  ('BufferAvailableToBufferReady',
+    'Interval that is a Ssubstage of stage "Swap" when Chrome is ' ||
+    'transferring a new frame to when it has finished completely sending a ' ||
+    'frame to the framebuffer.'),
+  ('BufferReadyToLatch',
+    'Interval that is a substage of stage "Swap", when the system latches ' ||
+    'and is ready to use the frame, and then it can get to work producing ' ||
+    'the final frame.'),
+  ('LatchToSwapEnd',
+    'Intereval that is a substage of stage "Swap", when the latch has ' ||
+    'finished until the frame is fully swapped and in the queue of frames ' ||
+    'to be presented.'),
+  ('SwapEndToPresentationCompositorFrame',
+    'Interval that the frame is presented on the screen (and pixels became ' ||
+    'visible).'))
+SELECT
+  name,
+  description
+FROM event_latency_descriptions;
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/histograms.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/histograms.sql
index e88f76a..b7bb525 100644
--- a/src/trace_processor/perfetto_sql/stdlib/chrome/histograms.sql
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/histograms.sql
@@ -1,16 +1,6 @@
--- Copyright 2023 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
---
---     https://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.
+-- Copyright 2023 The Chromium Authors
+-- Use of this source code is governed by a BSD-style license that can be
+-- found in the LICENSE file.
 
 DROP VIEW IF EXISTS chrome_histograms;
 
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/interactions.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/interactions.sql
index e8764a6..129258c 100644
--- a/src/trace_processor/perfetto_sql/stdlib/chrome/interactions.sql
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/interactions.sql
@@ -1,16 +1,6 @@
--- Copyright 2023 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
---
---     https://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.
+-- Copyright 2023 The Chromium Authors
+-- Use of this source code is governed by a BSD-style license that can be
+-- found in the LICENSE file.
 
 -- This file specifies common metrics/tables for critical user interactions. It
 -- is expected to be in flux as metrics are added across different CUI types.
@@ -38,7 +28,7 @@
   dur INT
 ) AS
 SELECT
-  navigation_id AS scoped_id,
+  id AS scoped_id,
   'chrome_page_loads' AS type,
   'PageLoad' AS name,
   navigation_start_ts AS ts,
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/metadata.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/metadata.sql
index 8905f5b..1b31c0c 100644
--- a/src/trace_processor/perfetto_sql/stdlib/chrome/metadata.sql
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/metadata.sql
@@ -1,16 +1,6 @@
--- Copyright 2023 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
---
---     https://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.
+-- Copyright 2023 The Chromium Authors
+-- Use of this source code is governed by a BSD-style license that can be
+-- found in the LICENSE file.
 
 -- Returns hardware class of the device, often use to find device brand
 -- and model.
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/page_loads.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/page_loads.sql
index 35f933a..73e44e9 100644
--- a/src/trace_processor/perfetto_sql/stdlib/chrome/page_loads.sql
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/page_loads.sql
@@ -1,16 +1,6 @@
--- Copyright 2023 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
---
---     https://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.
+-- Copyright 2023 The Chromium Authors
+-- Use of this source code is governed by a BSD-style license that can be
+-- found in the LICENSE file.
 
 -- TODO(b/306300843): The recorded navigation ids are not guaranteed to be
 -- unique within a trace; they are only guaranteed to be unique within a single
@@ -33,18 +23,23 @@
 RETURNS TABLE(
   ts LONG,
   dur LONG,
-  navigation_id INT
+  navigation_id INT,
+  browser_upid INT
 ) AS
 SELECT
   ts,
   dur,
   EXTRACT_ARG(arg_set_id, 'page_load.navigation_id')
-    AS navigation_id
-FROM slice
+    AS navigation_id,
+  upid AS browser_upid
+FROM process_slice
 WHERE name = $event_name;
 
 -- Chrome page loads, including associated high-level metrics and properties.
 CREATE PERFETTO TABLE chrome_page_loads(
+  -- ID of the navigation and Chrome browser process; this combination is
+  -- unique to every individual navigation.
+  id INT,
   -- ID of the navigation associated with the page load (i.e. the cross-document
   -- navigation in primary main frame which created this page's main document).
   -- Also note that navigation_id is specific to a given Chrome browser process,
@@ -83,6 +78,7 @@
   browser_upid INT
 ) AS
 SELECT
+  ROW_NUMBER() OVER(ORDER BY fcp.ts) AS id,
   fcp.navigation_id,
   fcp.ts AS navigation_start_ts,
   fcp.dur AS fcp,
@@ -99,19 +95,19 @@
 FROM internal_fcp_metrics fcp
 LEFT JOIN
   internal_page_load_metrics('PageLoadMetrics.NavigationToLargestContentfulPaint') lcp
-    USING (navigation_id)
+    USING (navigation_id, browser_upid)
 LEFT JOIN
   internal_page_load_metrics('PageLoadMetrics.NavigationToDOMContentLoadedEventFired') load_fired
-    using (navigation_id)
+    USING (navigation_id, browser_upid)
 LEFT JOIN
   internal_page_load_metrics('PageLoadMetrics.NavigationToMainFrameOnLoad') start_load
-    using (navigation_id)
+    USING (navigation_id, browser_upid)
 LEFT JOIN
   internal_page_load_metrics('PageLoadMetrics.UserTimingMarkFullyLoaded') timing_loaded
-    using (navigation_id)
+    USING (navigation_id, browser_upid)
 LEFT JOIN
   internal_page_load_metrics('PageLoadMetrics.UserTimingMarkFullyVisible') timing_visible
-    using (navigation_id)
+    USING (navigation_id, browser_upid)
 LEFT JOIN
   internal_page_load_metrics('PageLoadMetrics.UserTimingMarkInteractive') timing_interactive
-    using (navigation_id);
+    USING (navigation_id, browser_upid);
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/perfetto_sql_files.gni b/src/trace_processor/perfetto_sql/stdlib/chrome/perfetto_sql_files.gni
new file mode 100644
index 0000000..5edf42c
--- /dev/null
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/perfetto_sql_files.gni
@@ -0,0 +1,24 @@
+# Copyright 2023 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# List of files in //base/tracing/stdlib/chrome and subdirectories.
+chrome_stdlib_sql_files = [
+  "chrome_scrolls.sql",
+  "cpu_powerups.sql",
+  "event_latency_description.sql",
+  "histograms.sql",
+  "interactions.sql",
+  "metadata.sql",
+  "page_loads.sql",
+  "speedometer.sql",
+  "tasks.sql",
+  "vsync_intervals.sql",
+  "scroll_jank/scroll_jank_cause_map.sql",
+  "scroll_jank/scroll_jank_cause_utils.sql",
+  "scroll_jank/scroll_jank_intervals.sql",
+  "scroll_jank/scroll_jank_v3_cause.sql",
+  "scroll_jank/scroll_jank_v3.sql",
+  "scroll_jank/scroll_offsets.sql",
+  "scroll_jank/utils.sql",
+]
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_cause_map.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_cause_map.sql
new file mode 100644
index 0000000..f049075
--- /dev/null
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_cause_map.sql
@@ -0,0 +1,94 @@
+-- Copyright 2023 The Chromium Authors
+-- Use of this source code is governed by a BSD-style license that can be
+-- found in the LICENSE file.
+
+-- Source of truth of the descriptions of EventLatency-based scroll jank causes.
+CREATE PERFETTO TABLE chrome_scroll_jank_cause_descriptions (
+  -- The name of the EventLatency stage.
+  event_latency_stage STRING,
+  -- The process where the cause of scroll jank occurred.
+  cause_process STRING,
+  -- The thread where the cause of scroll jank occurred.
+  cause_thread STRING,
+  -- A description of the cause of scroll jank.
+  cause_description STRING
+) AS
+WITH cause_descriptions(
+  event_latency_stage,
+  cause_process,
+  cause_thread,
+  cause_description)
+AS (
+VALUES
+  ('GenerationToBrowserMain', 'Browser', 'CrBrowserMain',
+    'This also corresponds to a matching InputLatency::TouchMove. Key ' ||
+    'things to look for: Browser Main thread (CrBrowserMain) is busy, often ' ||
+    'running tasks. The true cause can be confirmed by checking which tasks ' ||
+    'are being run on CrBrowserMain, or checking any ScopedBlockingCall ' ||
+    'slices during this stage from a ThreadPoolForegroundWorker, or ' ||
+    'checking if the NetworkService is busy. Common causes may include page' ||
+    'navigations (same document and new pages), slow BeginMainFrames, and ' ||
+    'Java Choreographer slowdowns.'),
+  ('RendererCompositorQueueingDelay', 'Renderer', 'Compositor',
+    'The renderer needs to decide to produce a frame in response to a ' ||
+    'BeginFrame signal. Sometimes it can not because it is waiting on the ' ||
+    'RendererMain thread to do touch targeting or javascript handling or ' ||
+    'other such things causing a long queuing delay after it has already ' ||
+    'started the scroll (so the TouchStart has been processed).'),
+  ('RendererCompositorQueueingDelay', 'GPU', 'VizCompositorThread',
+    'Waiting for a BeginFrame to be sent. Key things to look for: check if ' ||
+    'a fling occurred before or during the scroll; flings produce a single ' ||
+    'input and result in multiple inputs coalescing into a single frame.'),
+  ('ReceiveCompositorFrameToStartDraw', 'GPU', 'VizCompositorThread',
+    'A delay when the VizCompositor is waiting for the frame, but may be ' ||
+    'connected to other processes and threads. Key things to look for: ' ||
+    'check the BeginFrame task that finished during this EventLatency. The ' ||
+    'VizCompositor holds onto the frame/does not send it on. Alternately ' ||
+    'the system may be holding on to the buffer.'),
+  ('ReceiveCompositorFrameToStartDraw', 'GPU', 'CrGpuMain',
+    'Key things to look for: if the GPU Main thread is busy, and does not ' ||
+    'release the buffer; specific causes will be on the GPU Main thread. If ' ||
+    'this thread is not busy, the buffer may be held by the system instead.'),
+  ('ReceiveCompositorFrameToStartDraw', 'Browser', 'CrBrowserMain',
+    'Key things to look for: the toolbar on the Browser may be blocked by ' ||
+    'other tasks.'),
+  ('BufferReadyToLatch', 'GPU', 'VizCompositorThread',
+    'Often a scheduling issue. The frame was submitted, but missed the ' ||
+    'latch in the system that was received from the previous frame. The ' ||
+    'system only latches a buffer once per frame; when the latch deadline ' ||
+    'is missed, the system is forced to wait for another vsync interval to ' ||
+    'latch again. Key things to look for: whether the event duration before ' ||
+    'BufferReadyToLatch stage of the previous EventLatency is longer or ' ||
+    'shorter than the event duration before BufferReadyToLatch in the ' ||
+    'current EventLatency. If this duration is longer, then this is a ' ||
+    'System problem. If this duration is shorter, then it is a Chrome ' ||
+    'problem. The previous frame may have been drawn too quickly, or the ' ||
+    'GPU may be delayed.'),
+  ('SwapEndToPresentationCompositorFrame', 'GPU', 'VizCompositorThread',
+    'May be attributed to a scheduling issue as with BufferReadyToLatch. ' ||
+    'The frame was submitted, but missed the latch in the system that was ' ||
+    'received from the previous frame. The system only latches a buffer ' ||
+    'once per frame; when the latch deadline is missed, the system is ' ||
+    'forced to wait for another vsync interval to latch again. Key things ' ||
+    'to look for: whether the event duration before BufferReadyToLatch ' ||
+    'stage of the previous EventLatency is longer or shorter than the event ' ||
+    'duration before BufferReadyToLatch in the current EventLatency. If ' ||
+    'this duration is longer, then this is a System problem. If this ' ||
+    'duration is shorter, then it is a Chrome problem. The previous frame ' ||
+    'may have been drawn too quickly, or the GPU may be delayed.'),
+  ('SwapEndToPresentationCompositorFrame', 'GPU', 'CrGpuMain',
+    'Key things to look for: whether StartDrawToBufferAvailable is also ' ||
+    'present during this EventLatency. If so, then the GPU main thread may ' ||
+    'be descheduled or busy. If surfaceflinger is available, check there as ' ||
+    'well.'),
+  ('SwapEndToPresentationCompositorFrame', 'GPU', 'surfaceflinger',
+    'Key things to look for: whether StartDrawToBufferAvailable is also ' ||
+    'present during this EventLatency. If so, then the VizCompositor has ' ||
+    'not received a signal from surfaceflinger to start writing into the ' ||
+    'buffer.'))
+SELECT
+  event_latency_stage,
+  cause_process,
+  cause_thread,
+  cause_description
+FROM cause_descriptions;
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_cause_utils.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_cause_utils.sql
new file mode 100644
index 0000000..2c6d0d0
--- /dev/null
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_cause_utils.sql
@@ -0,0 +1,48 @@
+-- Copyright 2023 The Chromium Authors
+-- Use of this source code is governed by a BSD-style license that can be
+-- found in the LICENSE file.
+
+
+-- Retrieve the thread id of the thread on a particular process, if the name of
+-- that process is known. Returns an error if there are multiple threads in
+-- the given process with the same name.
+CREATE PERFETTO FUNCTION internal_find_utid_by_upid_and_name(
+  -- Unique process id
+  upid INT,
+  -- The name of the thread
+  thread_name STRING)
+RETURNS TABLE (
+  -- Unique thread id.
+  utid INT
+) AS
+SELECT
+  DISTINCT utid
+FROM thread
+WHERE upid = $upid
+  AND name = $thread_name;
+
+-- Function to retrieve the track id of the thread on a particular process if
+-- there are any slices during a particular EventLatency slice duration; this
+-- upid/thread combination refers to a cause of Scroll Jank.
+CREATE PERFETTO FUNCTION chrome_select_scroll_jank_cause_track(
+  -- The slice id of an EventLatency slice.
+  event_latency_id INT,
+  -- The process id that the thread is on.
+  upid INT,
+  -- The name of the thread.
+  thread_name STRING)
+RETURNS TABLE (
+  -- The track id associated with |thread| on the process with |upid|.
+  track_id INT
+) AS
+SELECT
+ DISTINCT track_id
+FROM thread_slice
+WHERE utid IN
+  (
+    SELECT
+      utid
+    FROM internal_find_utid_by_upid_and_name($upid, $thread_name)
+  )
+  AND ts >= (SELECT ts FROM slice WHERE id = $event_latency_id LIMIT 1)
+  AND ts <= (SELECT ts + dur FROM slice WHERE id = $event_latency_id LIMIT 1);
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_intervals.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_intervals.sql
index e73cdab..d85d7c6 100644
--- a/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_intervals.sql
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_intervals.sql
@@ -1,16 +1,6 @@
--- Copyright 2023 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
---
---     https://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.
+-- Copyright 2023 The Chromium Authors
+-- Use of this source code is governed by a BSD-style license that can be
+-- found in the LICENSE file.
 
 INCLUDE PERFETTO MODULE chrome.chrome_scrolls;
 INCLUDE PERFETTO MODULE chrome.scroll_jank.scroll_jank_v3;
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_v3.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_v3.sql
index 303b8c5..4b20b6b 100644
--- a/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_v3.sql
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_v3.sql
@@ -1,17 +1,6 @@
---
--- Copyright 2023 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
---
---     https://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.
+-- Copyright 2023 The Chromium Authors
+-- Use of this source code is governed by a BSD-style license that can be
+-- found in the LICENSE file.
 
 INCLUDE PERFETTO MODULE common.slices;
 
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_v3_cause.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_v3_cause.sql
index f681381..d746457 100644
--- a/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_v3_cause.sql
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_v3_cause.sql
@@ -1,17 +1,6 @@
---
--- Copyright 2023 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
---
---     https://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.
+-- Copyright 2023 The Chromium Authors
+-- Use of this source code is governed by a BSD-style license that can be
+-- found in the LICENSE file.
 
 -- Helper functions for scroll_jank_v3 metric computation.
 
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_offsets.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_offsets.sql
index d9d817a..41ead9a 100644
--- a/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_offsets.sql
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_offsets.sql
@@ -1,16 +1,6 @@
--- Copyright 2023 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
---
---     https://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.
+-- Copyright 2023 The Chromium Authors
+-- Use of this source code is governed by a BSD-style license that can be
+-- found in the LICENSE file.
 
 -- This file creates two public views:
 --     - chrome_scroll_input_offsets and
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/utils.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/utils.sql
index 079443b..64c5e00 100644
--- a/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/utils.sql
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/utils.sql
@@ -1,17 +1,6 @@
---
--- Copyright 2022 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
---
---     https://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.
+-- Copyright 2023 The Chromium Authors
+-- Use of this source code is governed by a BSD-style license that can be
+-- found in the LICENSE file.
 --
 -- Those are helper functions used in computing jank metrics
 
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/speedometer.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/speedometer.sql
index c2fc1c7..e29811a 100644
--- a/src/trace_processor/perfetto_sql/stdlib/chrome/speedometer.sql
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/speedometer.sql
@@ -1,16 +1,6 @@
--- Copyright 2023 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
---
---     https://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.
+-- Copyright 2023 The Chromium Authors
+-- Use of this source code is governed by a BSD-style license that can be
+-- found in the LICENSE file.
 
 -- Annotates a trace with Speedometer 2.1 related information.
 --
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/tasks.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/tasks.sql
index bda37f5..0c7b18b 100644
--- a/src/trace_processor/perfetto_sql/stdlib/chrome/tasks.sql
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/tasks.sql
@@ -1,18 +1,6 @@
---
--- Copyright 2023 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
---
---     https://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.
---
+-- Copyright 2023 The Chromium Authors
+-- Use of this source code is governed by a BSD-style license that can be
+-- found in the LICENSE file.
 
 INCLUDE PERFETTO MODULE common.slices;
 
diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/vsync_intervals.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/vsync_intervals.sql
index 45cea5b..694cbc5 100644
--- a/src/trace_processor/perfetto_sql/stdlib/chrome/vsync_intervals.sql
+++ b/src/trace_processor/perfetto_sql/stdlib/chrome/vsync_intervals.sql
@@ -1,16 +1,6 @@
--- Copyright 2023 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
---
---     https://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.
+-- Copyright 2023 The Chromium Authors
+-- Use of this source code is governed by a BSD-style license that can be
+-- found in the LICENSE file.
 
 -- A simple table that checks the time between VSync (this can be used to
 -- determine if we're refreshing at 90 FPS or 60 FPS).
diff --git a/test/data/ui-screenshots/ui-chrome_rendering_desktop_select_slice_with_flows.png.sha256 b/test/data/ui-screenshots/ui-chrome_rendering_desktop_select_slice_with_flows.png.sha256
index 3af03af..7481c80 100644
--- a/test/data/ui-screenshots/ui-chrome_rendering_desktop_select_slice_with_flows.png.sha256
+++ b/test/data/ui-screenshots/ui-chrome_rendering_desktop_select_slice_with_flows.png.sha256
@@ -1 +1 @@
-b51988f52a96b6576e714111c96018b8f13541a5ccd44b8bf9b1989185edd515
\ No newline at end of file
+1fa69f1c7b6098b1e7ab944f4900a3b52984522e18ce94a6c68f8c46c6c06154
\ No newline at end of file
diff --git a/test/data/ui-screenshots/ui-modal_dialog_show_dialog_1.png.sha256 b/test/data/ui-screenshots/ui-modal_dialog_show_dialog_1.png.sha256
index e268e28..e138b33 100644
--- a/test/data/ui-screenshots/ui-modal_dialog_show_dialog_1.png.sha256
+++ b/test/data/ui-screenshots/ui-modal_dialog_show_dialog_1.png.sha256
@@ -1 +1 @@
-c753a17a466814841035cd006716128187d838c6c00fb7c600f810b6b36a7be9
\ No newline at end of file
+1dd5883861cff0c03811e5e97c479097771b8ab6ee97b5320593eb5f850c9a25
\ No newline at end of file
diff --git a/test/data/ui-screenshots/ui-modal_dialog_show_dialog_2.png.sha256 b/test/data/ui-screenshots/ui-modal_dialog_show_dialog_2.png.sha256
index a26ddd5..5aee346 100644
--- a/test/data/ui-screenshots/ui-modal_dialog_show_dialog_2.png.sha256
+++ b/test/data/ui-screenshots/ui-modal_dialog_show_dialog_2.png.sha256
@@ -1 +1 @@
-784304442fea618ab4ba75c16ccbc3d08fcfbe3ba19d7f7b1a470aa520d801a1
\ No newline at end of file
+f93e24fcd03c2f69570c4a01bc8df04b05260b35983d479ab24f7b912ebccd4d
\ No newline at end of file
diff --git a/test/data/ui-screenshots/ui-routing_open_invalid_trace_from_blank_page.png.sha256 b/test/data/ui-screenshots/ui-routing_open_invalid_trace_from_blank_page.png.sha256
index 36fadce..766073d 100644
--- a/test/data/ui-screenshots/ui-routing_open_invalid_trace_from_blank_page.png.sha256
+++ b/test/data/ui-screenshots/ui-routing_open_invalid_trace_from_blank_page.png.sha256
@@ -1 +1 @@
-ac4b7c10fb3ca19724f2f66b3b4b013cec90bac60d06d09b2bf96e30944750d8
\ No newline at end of file
+133e44411f05ea57299a67258d307ec06d381c2852143bf012059365fd2a7716
\ No newline at end of file
diff --git a/test/data/ui-screenshots/ui-routing_start_from_no_trace_open_invalid_trace.png.sha256 b/test/data/ui-screenshots/ui-routing_start_from_no_trace_open_invalid_trace.png.sha256
index 4afc696..5949d49 100644
--- a/test/data/ui-screenshots/ui-routing_start_from_no_trace_open_invalid_trace.png.sha256
+++ b/test/data/ui-screenshots/ui-routing_start_from_no_trace_open_invalid_trace.png.sha256
@@ -1 +1 @@
-3b624767a7b2118e71fb4efa948ffe2021f1e59e30ddfadf0a07fa22203fbb67
\ No newline at end of file
+f650a9a968e978dfa37f900cc5509bdc9118e8f3c74197164982285acde6149f
\ No newline at end of file
diff --git a/test/trace_processor/diff_tests/metrics/startup/android_startup.out b/test/trace_processor/diff_tests/metrics/startup/android_startup.out
index 1dc4c36..9dfc289 100644
--- a/test/trace_processor/diff_tests/metrics/startup/android_startup.out
+++ b/test/trace_processor/diff_tests/metrics/startup/android_startup.out
@@ -67,6 +67,10 @@
       installd_dur_ns: 0
       dex2oat_dur_ns: 0
     }
+    slow_start_reason_detailed {
+      reason: "Main Thread - Time spent in Runnable state"
+      details: " target 15% actual 74.07% [ longest_chunk: start_s 3.0e-08 dur_ms 8.0e-0 thread_id 3 thread_name com.google.android.calendar ] [ extra_info:  launches_dur_ms 0.0001 runnable_dur_ms 8.0e-0 R_sum_dur_ms 8.0e-0 R+(Preempted)_sum_dur_ms 0.0 ]"
+    } 
     startup_type: "warm"
   }
 }
diff --git a/test/trace_processor/diff_tests/metrics/startup/android_startup_attribution.out b/test/trace_processor/diff_tests/metrics/startup/android_startup_attribution.out
index d99f957..9b6e742 100644
--- a/test/trace_processor/diff_tests/metrics/startup/android_startup_attribution.out
+++ b/test/trace_processor/diff_tests/metrics/startup/android_startup_attribution.out
@@ -134,5 +134,14 @@
     slow_start_reason: "GC Activity"
     slow_start_reason: "Main Thread - Time spent in OpenDexFilesFromOat*"
     slow_start_reason: "Main Thread - Binder transactions blocked"
+    slow_start_reason_detailed {
+      reason: "GC Activity"
+    }
+    slow_start_reason_detailed {
+      reason: "Main Thread - Time spent in OpenDexFilesFromOat*"
+    }
+    slow_start_reason_detailed {
+      reason: "Main Thread - Binder transactions blocked"
+    }
   }
 }
diff --git a/test/trace_processor/diff_tests/metrics/startup/android_startup_attribution_slow.out b/test/trace_processor/diff_tests/metrics/startup/android_startup_attribution_slow.out
index db0495e..3e8ff27 100644
--- a/test/trace_processor/diff_tests/metrics/startup/android_startup_attribution_slow.out
+++ b/test/trace_processor/diff_tests/metrics/startup/android_startup_attribution_slow.out
@@ -98,5 +98,15 @@
     slow_start_reason: "GC Activity"
     slow_start_reason: "JIT Activity"
     slow_start_reason: "JIT compiled methods"
+    slow_start_reason_detailed {
+      reason: "GC Activity"
+    }
+    slow_start_reason_detailed {
+      reason: "JIT Activity"
+      details: " target 100ms actual 20000.ms [ longest_chunk: start_s 154.99 dur_ms 10000. thread_id 4 thread_name Jit thread pool ]"
+    }
+    slow_start_reason_detailed {
+      reason: "JIT compiled methods"
+    }
   }
 }
diff --git a/test/trace_processor/diff_tests/metrics/startup/android_startup_breakdown.out b/test/trace_processor/diff_tests/metrics/startup/android_startup_breakdown.out
index 8dfb3b3..f40578d 100644
--- a/test/trace_processor/diff_tests/metrics/startup/android_startup_breakdown.out
+++ b/test/trace_processor/diff_tests/metrics/startup/android_startup_breakdown.out
@@ -119,6 +119,27 @@
     slow_start_reason: "Time spent in bindApplication"
     slow_start_reason: "Time spent in view inflation"
     slow_start_reason: "Time spent in ResourcesManager#getResources"
+    slow_start_reason_detailed {
+      reason: "No baseline or cloud profiles"
+      details: " target FALSE actual TRUE [ longest_chunk: start_s 154.0 dur_ms 1000.0 thread_id -1 thread_name com.google.android.calendar ] [ extra_info:  slice_name location=/system/framework/oat/arm/com.google.android.calendar.odex status=up-to-date filter=speed reason=install-dm ]"
+    }
+    slow_start_reason_detailed {
+      reason: "Optimized artifacts missing, run from apk"
+    }
+    slow_start_reason_detailed {
+      reason: "Time spent in bindApplication"
+    }
+    slow_start_reason_detailed {
+      reason: "Time spent in view inflation"
+    }
+    slow_start_reason_detailed {
+      reason: "Time spent in ResourcesManager#getResources"
+      details: " target 130ms actual 1000.0ms [ longest_chunk: start_s 138.0 dur_ms 1000.0 thread_id 3 thread_name com.google.android.calendar ]"
+    }
+    slow_start_reason_detailed {
+      reason: "Potential CPU contention with another process"
+      details: " target 100ms actual 5000.0ms most_active_process_for_launch init [ longest_chunk: start_s 155.0 dur_ms 5000.0 thread_id 3 thread_name com.google.android.calendar ] [ extra_info:  runnable_dur_ms 5000.0 R_sum_dur_ms 5000.0 R+(Preempted)_sum_dur 0 ]"
+    }
     startup_type: "cold"
   }
 }
diff --git a/test/trace_processor/diff_tests/metrics/startup/android_startup_breakdown_slow.out b/test/trace_processor/diff_tests/metrics/startup/android_startup_breakdown_slow.out
index a10ac3f..891060b 100644
--- a/test/trace_processor/diff_tests/metrics/startup/android_startup_breakdown_slow.out
+++ b/test/trace_processor/diff_tests/metrics/startup/android_startup_breakdown_slow.out
@@ -118,6 +118,23 @@
     slow_start_reason: "Time spent in bindApplication"
     slow_start_reason: "Time spent in view inflation"
     slow_start_reason: "Time spent in ResourcesManager#getResources"
+    slow_start_reason_detailed {
+      reason: "Optimized artifacts missing, run from apk"
+    }
+    slow_start_reason_detailed {
+      reason: "Time spent in bindApplication"
+    }
+    slow_start_reason_detailed {
+      reason: "Time spent in view inflation"
+    }
+    slow_start_reason_detailed {
+      reason: "Time spent in ResourcesManager#getResources"
+      details: " target 130ms actual 5000.0ms [ longest_chunk: start_s 137.0 dur_ms 5000.0 thread_id 3 thread_name com.google.android.calendar ]"
+    }
+    slow_start_reason_detailed {
+      reason: "Potential CPU contention with another process"
+      details: " target 100ms actual 5000.0ms most_active_process_for_launch init [ longest_chunk: start_s 155.0 dur_ms 5000.0 thread_id 3 thread_name com.google.android.calendar ] [ extra_info:  runnable_dur_ms 5000.0 R_sum_dur_ms 5000.0 R+(Preempted)_sum_dur 0 ]"
+    }
     startup_type: "cold"
   }
 }
diff --git a/test/trace_processor/diff_tests/metrics/startup/android_startup_broadcast_multiple.out b/test/trace_processor/diff_tests/metrics/startup/android_startup_broadcast_multiple.out
index c0b245c..02e142c 100644
--- a/test/trace_processor/diff_tests/metrics/startup/android_startup_broadcast_multiple.out
+++ b/test/trace_processor/diff_tests/metrics/startup/android_startup_broadcast_multiple.out
@@ -31,5 +31,11 @@
     }
     slow_start_reason: "Broadcast dispatched count"
     slow_start_reason: "Broadcast received count"
+    slow_start_reason_detailed {
+      reason: "Broadcast dispatched count"
+    }
+    slow_start_reason_detailed {
+      reason: "Broadcast received count"
+    }
   }
 }
diff --git a/test/trace_processor/diff_tests/metrics/startup/android_startup_installd_dex2oat.out b/test/trace_processor/diff_tests/metrics/startup/android_startup_installd_dex2oat.out
index f2b6285..1fd7f2e 100644
--- a/test/trace_processor/diff_tests/metrics/startup/android_startup_installd_dex2oat.out
+++ b/test/trace_processor/diff_tests/metrics/startup/android_startup_installd_dex2oat.out
@@ -62,6 +62,9 @@
       dex2oat_dur_ns: 5
     }
     slow_start_reason: "dex2oat running during launch"
+    slow_start_reason_detailed {
+      reason: "dex2oat running during launch"
+    }
   }
   startup {
     startup_id: 3
@@ -95,6 +98,9 @@
       dex2oat_dur_ns: 0
     }
     slow_start_reason: "installd running during launch"
+    slow_start_reason_detailed {
+      reason: "installd running during launch"
+    }
   }
   startup {
     startup_id: 4
@@ -130,5 +136,11 @@
     }
     slow_start_reason: "dex2oat running during launch"
     slow_start_reason: "installd running during launch"
+    slow_start_reason_detailed {
+      reason: "dex2oat running during launch"
+    }
+    slow_start_reason_detailed {
+      reason: "installd running during launch"
+    }
   }
 }
diff --git a/test/trace_processor/diff_tests/metrics/startup/android_startup_installd_dex2oat_slow.out b/test/trace_processor/diff_tests/metrics/startup/android_startup_installd_dex2oat_slow.out
index 18039c2..91e0d5a 100644
--- a/test/trace_processor/diff_tests/metrics/startup/android_startup_installd_dex2oat_slow.out
+++ b/test/trace_processor/diff_tests/metrics/startup/android_startup_installd_dex2oat_slow.out
@@ -62,6 +62,9 @@
       dex2oat_dur_ns: 5000000000
     }
     slow_start_reason: "dex2oat running during launch"
+    slow_start_reason_detailed {
+      reason: "dex2oat running during launch"
+    }
   }
   startup {
     startup_id: 3
@@ -98,6 +101,15 @@
     slow_start_reason: "dex2oat running during launch"
     slow_start_reason: "installd running during launch"
     slow_start_reason: "Startup running concurrent to launch"
+    slow_start_reason_detailed {
+      reason: "dex2oat running during launch"
+    }
+    slow_start_reason_detailed {
+      reason: "installd running during launch"
+    }
+    slow_start_reason_detailed {
+      reason: "Startup running concurrent to launch"
+    }
     startup_concurrent_to_launch: "com.google.android.gm"
   }
   startup {
@@ -133,6 +145,15 @@
     slow_start_reason: "dex2oat running during launch"
     slow_start_reason: "installd running during launch"
     slow_start_reason: "Startup running concurrent to launch"
+    slow_start_reason_detailed {
+      reason: "dex2oat running during launch"
+    }
+    slow_start_reason_detailed {
+      reason: "installd running during launch"
+    }
+    slow_start_reason_detailed {
+      reason: "Startup running concurrent to launch"
+    }
     startup_concurrent_to_launch: "com.google.android.deskclock"
   }
 }
diff --git a/test/trace_processor/diff_tests/metrics/startup/android_startup_lock_contention_slow.out b/test/trace_processor/diff_tests/metrics/startup/android_startup_lock_contention_slow.out
index aa4ec05..3e5f6a6 100644
--- a/test/trace_processor/diff_tests/metrics/startup/android_startup_lock_contention_slow.out
+++ b/test/trace_processor/diff_tests/metrics/startup/android_startup_lock_contention_slow.out
@@ -72,6 +72,15 @@
     slow_start_reason: "Time spent in bindApplication"
     slow_start_reason: "Main Thread - Lock contention"
     slow_start_reason: "Main Thread - Monitor contention"
+    slow_start_reason_detailed {
+      reason: "Time spent in bindApplication"
+    }
+    slow_start_reason_detailed {
+      reason: "Main Thread - Lock contention"
+    }
+    slow_start_reason_detailed {
+      reason: "Main Thread - Monitor contention"
+    }
     startup_type: "cold"
   }
 }
diff --git a/test/trace_processor/diff_tests/metrics/startup/android_startup_minsdk33.out b/test/trace_processor/diff_tests/metrics/startup/android_startup_minsdk33.out
index d4de48e..e56ae6f 100644
--- a/test/trace_processor/diff_tests/metrics/startup/android_startup_minsdk33.out
+++ b/test/trace_processor/diff_tests/metrics/startup/android_startup_minsdk33.out
@@ -30,6 +30,9 @@
       dex2oat_dur_ns: 0
     }
     slow_start_reason: "App in debuggable mode"
+    slow_start_reason_detailed {
+      reason: "App in debuggable mode"
+    }
   }
   startup {
     startup_id: 2
@@ -83,5 +86,8 @@
     }
     startup_type: "hot"
     slow_start_reason: "App in debuggable mode"
+    slow_start_reason_detailed {
+      reason: "App in debuggable mode"
+    }
   }
 }
diff --git a/test/trace_processor/diff_tests/metrics/startup/android_startup_process_track.out b/test/trace_processor/diff_tests/metrics/startup/android_startup_process_track.out
index 21d909d..fb10a32 100644
--- a/test/trace_processor/diff_tests/metrics/startup/android_startup_process_track.out
+++ b/test/trace_processor/diff_tests/metrics/startup/android_startup_process_track.out
@@ -66,6 +66,10 @@
       dex2oat_dur_ns: 0
     }
     startup_type: "cold"
+    slow_start_reason_detailed {
+      reason: "Main Thread - Time spent in Runnable state"
+      details: " target 15% actual 57.14% [ longest_chunk: start_s 3.0e-09 dur_ms 4.0e-0 thread_id 3 thread_name com.google.android.calendar ] [ extra_info:  launches_dur_ms 7.0e-0 runnable_dur_ms 4.0e-0 R_sum_dur_ms 4.0e-0 R+(Preempted)_sum_dur_ms 0.0 ]"
+    }
   }
   startup {
     startup_id: 2
@@ -135,5 +139,9 @@
       dex2oat_dur_ns: 0
     }
     startup_type: "cold"
+    slow_start_reason_detailed {
+      reason: "Main Thread - Time spent in Runnable state"
+      details: " target 15% actual 57.14% [ longest_chunk: start_s 1.03e-07 dur_ms 4.0e-0 thread_id 4 thread_name com.google.android.calendar ] [ extra_info:  launches_dur_ms 7.0e-0 runnable_dur_ms 4.0e-0 R_sum_dur_ms 4.0e-0 R+(Preempted)_sum_dur_ms 0.0 ]"
+    }
   }
 }
diff --git a/test/trace_processor/diff_tests/metrics/startup/android_startup_slow.out b/test/trace_processor/diff_tests/metrics/startup/android_startup_slow.out
index 78e1908..4cdc5e9 100644
--- a/test/trace_processor/diff_tests/metrics/startup/android_startup_slow.out
+++ b/test/trace_processor/diff_tests/metrics/startup/android_startup_slow.out
@@ -70,5 +70,19 @@
     startup_type: "warm"
     slow_start_reason: "Main Thread - Time spent in interruptible sleep state"
     slow_start_reason: "Main Thread - Time spent in Blocking I/O"
+    slow_start_reason_detailed {
+      reason: "Main Thread - Time spent in Runnable state"
+      details: " target 15% actual 74.07% [ longest_chunk: start_s 30.0 dur_ms 80000. thread_id 3 thread_name com.google.android.calendar ] [ extra_info:  launches_dur_ms 108000 runnable_dur_ms 80000. R_sum_dur_ms 80000. R+(Preempted)_sum_dur_ms 0.0 ]"
+    }
+    slow_start_reason_detailed {
+      reason: "Main Thread - Time spent in interruptible sleep state"
+    }
+    slow_start_reason_detailed {
+      reason: "Main Thread - Time spent in Blocking I/O"
+    }
+    slow_start_reason_detailed {
+      reason: "Potential CPU contention with another process"
+      details: " target 100ms actual 80000.ms most_active_process_for_launch init [ longest_chunk: start_s 30.0 dur_ms 80000. thread_id 3 thread_name com.google.android.calendar ] [ extra_info:  runnable_dur_ms 80000. R_sum_dur_ms 80000. R+(Preempted)_sum_dur 0 ]"
+    }
   }
 }
diff --git a/test/trace_processor/diff_tests/metrics/startup/android_startup_unlock.out b/test/trace_processor/diff_tests/metrics/startup/android_startup_unlock.out
index ba5d58f..9686456 100644
--- a/test/trace_processor/diff_tests/metrics/startup/android_startup_unlock.out
+++ b/test/trace_processor/diff_tests/metrics/startup/android_startup_unlock.out
@@ -30,5 +30,8 @@
       dex2oat_dur_ns: 0
     }
     slow_start_reason: "Unlock running during launch"
+    slow_start_reason_detailed {
+      reason: "Unlock running during launch"
+    }
   }
 }
diff --git a/test/trace_processor/diff_tests/stdlib/chrome/chrome_scroll_check.py b/test/trace_processor/diff_tests/stdlib/chrome/chrome_scroll_check.py
old mode 100644
new mode 100755
index 909ea1d..445356e
--- a/test/trace_processor/diff_tests/stdlib/chrome/chrome_scroll_check.py
+++ b/test/trace_processor/diff_tests/stdlib/chrome/chrome_scroll_check.py
@@ -1,17 +1,7 @@
 #!/usr/bin/env python3
-# Copyright (C) 2023 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.
+# Copyright 2023 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
 
 # Discarded events that do not get to GPU are invisible for UMA metric and
 # therefore should be excluded in trace-based metric. This tests ensures that's
diff --git a/test/trace_processor/diff_tests/stdlib/chrome/chrome_scroll_helper.py b/test/trace_processor/diff_tests/stdlib/chrome/chrome_scroll_helper.py
old mode 100644
new mode 100755
index 77b6e05..07a7b8b
--- a/test/trace_processor/diff_tests/stdlib/chrome/chrome_scroll_helper.py
+++ b/test/trace_processor/diff_tests/stdlib/chrome/chrome_scroll_helper.py
@@ -1,17 +1,7 @@
 #!/usr/bin/env python3
-# Copyright (C) 2023 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.
+# Copyright 2023 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
 
 # Discarded events that do not get to GPU are invisible for UMA metric and
 # therefore should be excluded in trace-based metric. This tests ensures that's
diff --git a/test/trace_processor/diff_tests/stdlib/chrome/tests.py b/test/trace_processor/diff_tests/stdlib/chrome/tests.py
old mode 100644
new mode 100755
index cc709b1..ddc088e
--- a/test/trace_processor/diff_tests/stdlib/chrome/tests.py
+++ b/test/trace_processor/diff_tests/stdlib/chrome/tests.py
@@ -1,17 +1,7 @@
 #!/usr/bin/env python3
-# Copyright (C) 2023 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 a
-#
-#      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.
+# Copyright 2023 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
 
 from python.generators.diff_tests.testing import Path, DataPath, Metric
 from python.generators.diff_tests.testing import Csv, Json, TextProto
diff --git a/test/trace_processor/diff_tests/stdlib/chrome/tests_chrome_interactions.py b/test/trace_processor/diff_tests/stdlib/chrome/tests_chrome_interactions.py
old mode 100644
new mode 100755
index 473c38c..5845dbb
--- a/test/trace_processor/diff_tests/stdlib/chrome/tests_chrome_interactions.py
+++ b/test/trace_processor/diff_tests/stdlib/chrome/tests_chrome_interactions.py
@@ -1,17 +1,7 @@
 #!/usr/bin/env python3
-# Copyright (C) 2023 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 a
-#
-#      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.
+# Copyright 2023 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
 
 from python.generators.diff_tests.testing import DataPath
 from python.generators.diff_tests.testing import Csv
diff --git a/test/trace_processor/diff_tests/stdlib/chrome/tests_scroll_jank.py b/test/trace_processor/diff_tests/stdlib/chrome/tests_scroll_jank.py
old mode 100644
new mode 100755
index 4d23659..b9d19fd
--- a/test/trace_processor/diff_tests/stdlib/chrome/tests_scroll_jank.py
+++ b/test/trace_processor/diff_tests/stdlib/chrome/tests_scroll_jank.py
@@ -1,17 +1,7 @@
 #!/usr/bin/env python3
-# Copyright (C) 2023 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 a
-#
-#      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.
+# Copyright 2023 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
 
 from python.generators.diff_tests.testing import Path, DataPath, Metric
 from python.generators.diff_tests.testing import Csv, Json, TextProto
@@ -138,3 +128,26 @@
         1993,4687375224739,-81,-181
         1996,4687386343739,-66,-247
         """))
+
+  def test_scroll_jank_cause_map(self):
+    return DiffTestBlueprint(
+        trace=TextProto(''),
+        query="""
+        INCLUDE PERFETTO MODULE chrome.event_latency_description;
+        INCLUDE PERFETTO MODULE chrome.scroll_jank.scroll_jank_cause_map;
+
+        SELECT
+          DISTINCT event_latency_stage
+        FROM chrome_scroll_jank_cause_descriptions
+        WHERE event_latency_stage NOT IN
+          (
+            SELECT
+              DISTINCT name
+            FROM chrome_event_latency_stage_descriptions
+          );
+        """,
+        # Empty output is expected to ensure that all scroll jank causes
+        # correspond to a valid EventLatency stage.
+        out=Csv("""
+        "event_latency_stage"
+        """))
diff --git a/tools/cpu_profile b/tools/cpu_profile
index a5e852e..2f405da 100755
--- a/tools/cpu_profile
+++ b/tools/cpu_profile
@@ -37,18 +37,18 @@
 
 
 # ----- Amalgamator: begin of python/perfetto/prebuilts/manifests/traceconv.py
-# This file has been generated by: tools/roll-prebuilts v38.0
+# This file has been generated by: tools/roll-prebuilts v39.0
 TRACECONV_MANIFEST = [{
     'arch':
         'mac-amd64',
     'file_name':
         'traceconv',
     'file_size':
-        8889568,
+        9004496,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/mac-amd64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/mac-amd64/traceconv',
     'sha256':
-        'e45d08f7050553f77c87764823c6ca26e877d0b3865f2764b33dcab6dfd0b9ee',
+        '11586dade97edf07d5b10fd5248127507fca16537f595d6530b81cbc266d1b12',
     'platform':
         'darwin',
     'machine': ['x86_64']
@@ -58,11 +58,11 @@
     'file_name':
         'traceconv',
     'file_size':
-        7447928,
+        7563688,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/mac-arm64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/mac-arm64/traceconv',
     'sha256':
-        '19cabe8789566e6383632bbe79e360b8bf05465f8bb156788c8c957aba77f224',
+        '48568604b4ad119f88d847d9b306102f47a5760b923ca574dfb08b3f49bdf253',
     'platform':
         'darwin',
     'machine': ['arm64']
@@ -72,11 +72,11 @@
     'file_name':
         'traceconv',
     'file_size':
-        8633416,
+        8757640,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-amd64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-amd64/traceconv',
     'sha256':
-        'a7a309c667a3e6a4c0268252540e3fc8052ebbd0abc30faf8f1783df411cf559',
+        'b263b7d4a63c923aad46940bde87063a647bb506667d857336f379d858d20646',
     'platform':
         'linux',
     'machine': ['x86_64']
@@ -86,11 +86,11 @@
     'file_name':
         'traceconv',
     'file_size':
-        6505268,
+        6605348,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-arm/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-arm/traceconv',
     'sha256':
-        '3ff0f9d4ef43e9e76d27c69827e508f4504d2d1fcfb4dac9d739023cd72106d7',
+        'c9454182a9e53b563511e1625533644829933cec13839a6fd3f08677a0e927c0',
     'platform':
         'linux',
     'machine': ['armv6l', 'armv7l', 'armv8l']
@@ -100,11 +100,11 @@
     'file_name':
         'traceconv',
     'file_size':
-        8108432,
+        8224984,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-arm64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-arm64/traceconv',
     'sha256':
-        '1f4641b341f2c8bf36faf8d4befedc01bd414c8f778a5b314c99c2d42c42c068',
+        '78cd7bfa0507c43c6ab728b691c5b885e18097d761c608a31388d3f8f7d84857',
     'platform':
         'linux',
     'machine': ['aarch64']
@@ -114,55 +114,55 @@
     'file_name':
         'traceconv',
     'file_size':
-        6096120,
+        6231288,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-arm/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-arm/traceconv',
     'sha256':
-        'f15c86b1d83bd1706b81426a6d11c3274044b4838abfb5d313954c65282162a9'
+        '87f57efb365dab3b5f4230518198cf0505476a6a8376842d41403ff0e7aa13ec'
 }, {
     'arch':
         'android-arm64',
     'file_name':
         'traceconv',
     'file_size':
-        7401672,
+        7528648,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-arm64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-arm64/traceconv',
     'sha256':
-        '8e98e30a8e137116e74390bcb9d662f0a3f22f9d38fe3fd7ef305d1051bdf19d'
+        '896d7af7632179a05ad4278482ec00ede09806d6d4c5e07d2cc7a802bc672b5b'
 }, {
     'arch':
         'android-x86',
     'file_name':
         'traceconv',
     'file_size':
-        8238268,
+        8393916,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-x86/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-x86/traceconv',
     'sha256':
-        '8ce56de90b18cc01d94b26f521292d71326552f8b4fb29b919f4b2b80c3eb2ec'
+        '6ce14e83af5a4e93d8dc7d39635ccb1cd7fffe988541b94960e167d33b5c5281'
 }, {
     'arch':
         'android-x64',
     'file_name':
         'traceconv',
     'file_size':
-        8397056,
+        8528128,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-x64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-x64/traceconv',
     'sha256':
-        'e5f31569261b3f201e2cc13b8eea510627d555767272373d9196e83ddaefa3f0'
+        '11aeb6293736175c09aacff155f793eb5508ab627f612cdecf7fec7e60485d78'
 }, {
     'arch':
         'windows-amd64',
     'file_name':
         'traceconv.exe',
     'file_size':
-        7867904,
+        8034304,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/windows-amd64/traceconv.exe',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/windows-amd64/traceconv.exe',
     'sha256':
-        '74c24b2a74ae2a490ac5f918ab079a7713af07e9a36e70a2cc8536040d7df099',
+        'd53e20465cf326b5d9f5f3513cc5cd387889024ed940ec243f56dcf6fe178279',
     'platform':
         'win32',
     'machine': ['amd64']
diff --git a/tools/gen_android_bp b/tools/gen_android_bp
index 2a06847..eea7f09 100755
--- a/tools/gen_android_bp
+++ b/tools/gen_android_bp
@@ -895,6 +895,12 @@
   module.out.update(target.outputs)
 
   for dep in target.transitive_deps:
+    # Use globs for the chrome stdlib so the file does not need to be
+    # regenerated in autoroll CLs.
+    if dep.name.startswith(
+          '//src/trace_processor/perfetto_sql/stdlib/chrome:chrome_sql'):
+      module.srcs.add('src/trace_processor/perfetto_sql/stdlib/chrome/**/*.sql')
+      continue
     module.srcs.update(
         [gn_utils.label_to_path(src) for src in gn.get_target(dep.name).inputs])
   blueprint.add_module(module)
diff --git a/tools/heap_profile b/tools/heap_profile
index cd6770b..3979be0 100755
--- a/tools/heap_profile
+++ b/tools/heap_profile
@@ -34,18 +34,18 @@
 
 
 # ----- Amalgamator: begin of python/perfetto/prebuilts/manifests/traceconv.py
-# This file has been generated by: tools/roll-prebuilts v38.0
+# This file has been generated by: tools/roll-prebuilts v39.0
 TRACECONV_MANIFEST = [{
     'arch':
         'mac-amd64',
     'file_name':
         'traceconv',
     'file_size':
-        8889568,
+        9004496,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/mac-amd64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/mac-amd64/traceconv',
     'sha256':
-        'e45d08f7050553f77c87764823c6ca26e877d0b3865f2764b33dcab6dfd0b9ee',
+        '11586dade97edf07d5b10fd5248127507fca16537f595d6530b81cbc266d1b12',
     'platform':
         'darwin',
     'machine': ['x86_64']
@@ -55,11 +55,11 @@
     'file_name':
         'traceconv',
     'file_size':
-        7447928,
+        7563688,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/mac-arm64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/mac-arm64/traceconv',
     'sha256':
-        '19cabe8789566e6383632bbe79e360b8bf05465f8bb156788c8c957aba77f224',
+        '48568604b4ad119f88d847d9b306102f47a5760b923ca574dfb08b3f49bdf253',
     'platform':
         'darwin',
     'machine': ['arm64']
@@ -69,11 +69,11 @@
     'file_name':
         'traceconv',
     'file_size':
-        8633416,
+        8757640,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-amd64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-amd64/traceconv',
     'sha256':
-        'a7a309c667a3e6a4c0268252540e3fc8052ebbd0abc30faf8f1783df411cf559',
+        'b263b7d4a63c923aad46940bde87063a647bb506667d857336f379d858d20646',
     'platform':
         'linux',
     'machine': ['x86_64']
@@ -83,11 +83,11 @@
     'file_name':
         'traceconv',
     'file_size':
-        6505268,
+        6605348,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-arm/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-arm/traceconv',
     'sha256':
-        '3ff0f9d4ef43e9e76d27c69827e508f4504d2d1fcfb4dac9d739023cd72106d7',
+        'c9454182a9e53b563511e1625533644829933cec13839a6fd3f08677a0e927c0',
     'platform':
         'linux',
     'machine': ['armv6l', 'armv7l', 'armv8l']
@@ -97,11 +97,11 @@
     'file_name':
         'traceconv',
     'file_size':
-        8108432,
+        8224984,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-arm64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-arm64/traceconv',
     'sha256':
-        '1f4641b341f2c8bf36faf8d4befedc01bd414c8f778a5b314c99c2d42c42c068',
+        '78cd7bfa0507c43c6ab728b691c5b885e18097d761c608a31388d3f8f7d84857',
     'platform':
         'linux',
     'machine': ['aarch64']
@@ -111,55 +111,55 @@
     'file_name':
         'traceconv',
     'file_size':
-        6096120,
+        6231288,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-arm/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-arm/traceconv',
     'sha256':
-        'f15c86b1d83bd1706b81426a6d11c3274044b4838abfb5d313954c65282162a9'
+        '87f57efb365dab3b5f4230518198cf0505476a6a8376842d41403ff0e7aa13ec'
 }, {
     'arch':
         'android-arm64',
     'file_name':
         'traceconv',
     'file_size':
-        7401672,
+        7528648,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-arm64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-arm64/traceconv',
     'sha256':
-        '8e98e30a8e137116e74390bcb9d662f0a3f22f9d38fe3fd7ef305d1051bdf19d'
+        '896d7af7632179a05ad4278482ec00ede09806d6d4c5e07d2cc7a802bc672b5b'
 }, {
     'arch':
         'android-x86',
     'file_name':
         'traceconv',
     'file_size':
-        8238268,
+        8393916,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-x86/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-x86/traceconv',
     'sha256':
-        '8ce56de90b18cc01d94b26f521292d71326552f8b4fb29b919f4b2b80c3eb2ec'
+        '6ce14e83af5a4e93d8dc7d39635ccb1cd7fffe988541b94960e167d33b5c5281'
 }, {
     'arch':
         'android-x64',
     'file_name':
         'traceconv',
     'file_size':
-        8397056,
+        8528128,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-x64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-x64/traceconv',
     'sha256':
-        'e5f31569261b3f201e2cc13b8eea510627d555767272373d9196e83ddaefa3f0'
+        '11aeb6293736175c09aacff155f793eb5508ab627f612cdecf7fec7e60485d78'
 }, {
     'arch':
         'windows-amd64',
     'file_name':
         'traceconv.exe',
     'file_size':
-        7867904,
+        8034304,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/windows-amd64/traceconv.exe',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/windows-amd64/traceconv.exe',
     'sha256':
-        '74c24b2a74ae2a490ac5f918ab079a7713af07e9a36e70a2cc8536040d7df099',
+        'd53e20465cf326b5d9f5f3513cc5cd387889024ed940ec243f56dcf6fe178279',
     'platform':
         'win32',
     'machine': ['amd64']
diff --git a/tools/record_android_trace b/tools/record_android_trace
index f91496c..6401ed8 100755
--- a/tools/record_android_trace
+++ b/tools/record_android_trace
@@ -33,18 +33,18 @@
 
 
 # ----- Amalgamator: begin of python/perfetto/prebuilts/manifests/tracebox.py
-# This file has been generated by: tools/roll-prebuilts v38.0
+# This file has been generated by: tools/roll-prebuilts v39.0
 TRACEBOX_MANIFEST = [{
     'arch':
         'mac-amd64',
     'file_name':
         'tracebox',
     'file_size':
-        1498560,
+        1498680,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/mac-amd64/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/mac-amd64/tracebox',
     'sha256':
-        'b760c7ed682d23f8d268174a939f1b8cb130ffb0d52f42b4cc4499a25423e782',
+        '07285ce963cb77212e580fe7034f6c380933c982a31272de47c7e0311d9144a1',
     'platform':
         'darwin',
     'machine': ['x86_64']
@@ -54,11 +54,11 @@
     'file_name':
         'tracebox',
     'file_size':
-        1376008,
+        1376136,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/mac-arm64/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/mac-arm64/tracebox',
     'sha256':
-        '2835127a5fc42e501e29a685a1cbcd98c26f977ee845bb1bd60a43008fd48161',
+        'f56e47303fde2de737d73bc0aebddb81a624a1130ab79ca22fb9aa4f41a4e662',
     'platform':
         'darwin',
     'machine': ['arm64']
@@ -68,11 +68,11 @@
     'file_name':
         'tracebox',
     'file_size':
-        2212088,
+        2218840,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-amd64/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-amd64/tracebox',
     'sha256':
-        '0b4a61a3e45f4e1b6111ca0b440f9e4a0b0726df912542373f69b6821a3113bc',
+        '6a23cdbae7ecdf77b2c1f72b33350c6e4a2098627454cff4af42c027808e2be8',
     'platform':
         'linux',
     'machine': ['x86_64']
@@ -82,11 +82,11 @@
     'file_name':
         'tracebox',
     'file_size':
-        1327204,
+        1332292,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-arm/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-arm/tracebox',
     'sha256':
-        '43c20d80e5b40cebe5b26579319be6d57796b04155ffc90f133b6a13c2de25ab',
+        '4732def5d23a3c66c3c286387488c9043d4f68d535d22af8374c3e1b9a9a61f5',
     'platform':
         'linux',
     'machine': ['armv6l', 'armv7l', 'armv8l']
@@ -96,11 +96,11 @@
     'file_name':
         'tracebox',
     'file_size':
-        2139928,
+        2147464,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-arm64/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-arm64/tracebox',
     'sha256':
-        '261cd7912dd69e8d82ce61b66a78f098eba46f6f492f6ec6bf73124d40a9a202',
+        'c9e83bc7b3d9059d3444392e509f96cbb242d45b0a0a27594a6b371c1a85e67f',
     'platform':
         'linux',
     'machine': ['aarch64']
@@ -110,44 +110,44 @@
     'file_name':
         'tracebox',
     'file_size':
-        1202132,
+        1230804,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-arm/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-arm/tracebox',
     'sha256':
-        '43874c4d187e3da5820ae3988d16608a8bf89d04282b8ab3e1486c6e57cd891f'
+        '2def9ce29483c8e368cc7aa3e49ff2da60555444e6cb25c5acaec7c570b06f57'
 }, {
     'arch':
         'android-arm64',
     'file_name':
         'tracebox',
     'file_size':
-        1825448,
+        1854120,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-arm64/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-arm64/tracebox',
     'sha256':
-        '9264d8f23ea3988f2952696668d3d572669134e4ca5b3e25a3209d3bfdb7d015'
+        '2484ee8210620a1dd9044610b75874302245d12aca7b59f6b7c3d55fe7ebcdde'
 }, {
     'arch':
         'android-x86',
     'file_name':
         'tracebox',
     'file_size':
-        1820588,
+        1853356,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-x86/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-x86/tracebox',
     'sha256':
-        'd591e903b1e2b0e4b270f0510c24992aac68167c80e61450ebf6c36cc780cd21'
+        '7b9f8f8eb98343bf645582439c4deb9785e6b63724ff9470a703e3bf7e2522c2'
 }, {
     'arch':
         'android-x64',
     'file_name':
         'tracebox',
     'file_size':
-        2108072,
+        2149032,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-x64/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-x64/tracebox',
     'sha256':
-        'd3e4278e17764b605236c568202eb8d94f3f7e7593b0be9eba09f670a987acba'
+        'f81afa4516b96c3ff66cfe65b9c64567771efeef3bcb2b518a6846d358c0b93c'
 }]
 
 # ----- Amalgamator: end of python/perfetto/prebuilts/manifests/tracebox.py
diff --git a/tools/trace_processor b/tools/trace_processor
index f88419c..90eae44 100755
--- a/tools/trace_processor
+++ b/tools/trace_processor
@@ -30,18 +30,18 @@
 
 
 # ----- Amalgamator: begin of python/perfetto/prebuilts/manifests/trace_processor_shell.py
-# This file has been generated by: tools/roll-prebuilts v38.0
+# This file has been generated by: tools/roll-prebuilts v39.0
 TRACE_PROCESSOR_SHELL_MANIFEST = [{
     'arch':
         'mac-amd64',
     'file_name':
         'trace_processor_shell',
     'file_size':
-        9682976,
+        9814280,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/mac-amd64/trace_processor_shell',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/mac-amd64/trace_processor_shell',
     'sha256':
-        '74b097836f16d788edce11bfda46f52e6499d8ec546d10f8dbab182612407b3b',
+        'd3b61b97f2e18aa8e6ece06b3167a012d23f895a97ed12e1f400e3f0480b72af',
     'platform':
         'darwin',
     'machine': ['x86_64']
@@ -51,11 +51,11 @@
     'file_name':
         'trace_processor_shell',
     'file_size':
-        8180008,
+        8295768,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/mac-arm64/trace_processor_shell',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/mac-arm64/trace_processor_shell',
     'sha256':
-        '9a96a2f9ef81f210fcba4a08b21db6f2f57fb1d325e91924043ae066327c29a8',
+        '32560ee9eb8d86397fd8daec24e5e1e091e760c8cec708a1340cc7259cfd8f07',
     'platform':
         'darwin',
     'machine': ['arm64']
@@ -65,11 +65,11 @@
     'file_name':
         'trace_processor_shell',
     'file_size':
-        9533320,
+        9660152,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-amd64/trace_processor_shell',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-amd64/trace_processor_shell',
     'sha256':
-        'ee0ccae766aad09f0135efa83cc3a1cd78bd0e86824a7b1245e013d32e61d820',
+        'efbbb42291eecd0bd658694c6e60f3c7df5eee8b6e23ca6a1438059ddbd65667',
     'platform':
         'linux',
     'machine': ['x86_64']
@@ -79,11 +79,11 @@
     'file_name':
         'trace_processor_shell',
     'file_size':
-        6963584,
+        7066080,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-arm/trace_processor_shell',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-arm/trace_processor_shell',
     'sha256':
-        '2c69d2016dd18b6d42bf6c2a5b4398e29e4fd294950882387942272dd25a045a',
+        'c62db9a9be13fefc114301e5a42714e400201bbf3a90d4f35c46494fc91ac230',
     'platform':
         'linux',
     'machine': ['armv6l', 'armv7l', 'armv8l']
@@ -93,11 +93,11 @@
     'file_name':
         'trace_processor_shell',
     'file_size':
-        8950112,
+        9069000,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-arm64/trace_processor_shell',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-arm64/trace_processor_shell',
     'sha256':
-        'a10a7a9a6614461beb1f32ee16da3290e2770bb6f3a506269defbdbf7e8803af',
+        'f2f5c4de02d9bd8505bcea931de8605d93485c5479130835e49b3d6ecf23fc4a',
     'platform':
         'linux',
     'machine': ['aarch64']
@@ -107,55 +107,55 @@
     'file_name':
         'trace_processor_shell',
     'file_size':
-        6580152,
+        6707128,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-arm/trace_processor_shell',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-arm/trace_processor_shell',
     'sha256':
-        '994a038b932accf5796550207a4e7d80c7612fd25e6eee414324e7e4f3ae14f2'
+        '5a9a5b8965f7b923444cb3ec9dea10df322a22d82765335be3191314aea48bf5'
 }, {
     'arch':
         'android-arm64',
     'file_name':
         'trace_processor_shell',
     'file_size':
-        8115560,
+        8234344,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-arm64/trace_processor_shell',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-arm64/trace_processor_shell',
     'sha256':
-        '42426b12ad60894aee37e502e4d023cfded53e706d990abf5c70c4556c2b73ff'
+        'e6033a8928bc7b3ef6a5b4e56040219824dbba858b101241eb03513b39868829'
 }, {
     'arch':
         'android-x86',
     'file_name':
         'trace_processor_shell',
     'file_size':
-        9009020,
+        9148284,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-x86/trace_processor_shell',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-x86/trace_processor_shell',
     'sha256':
-        'af982ad7897d8cafb29a9f1303e32df20486a92eb07930db8b1898a75e84a667'
+        '38348a3295540e3c10d6622910d42844f37d7e849d3fbd8910b734df5c09f817'
 }, {
     'arch':
         'android-x64',
     'file_name':
         'trace_processor_shell',
     'file_size':
-        9270696,
+        9397672,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-x64/trace_processor_shell',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-x64/trace_processor_shell',
     'sha256':
-        '081be392ddccdf37da80dd888277ea9215cfa8d05ddf6f90d9bff13a0a72f672'
+        '2f91b3c32dd48891c0979c546074b208ea7c0aa46b8ef543835d8361cb962070'
 }, {
     'arch':
         'windows-amd64',
     'file_name':
         'trace_processor_shell.exe',
     'file_size':
-        8898560,
+        9078272,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/windows-amd64/trace_processor_shell.exe',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/windows-amd64/trace_processor_shell.exe',
     'sha256':
-        '2e66e5b6ab9c0f7ecad98c3b5b822133c9aa34f137b4007c228c78672fdea5a7',
+        '65e2e29e2b6c76388af17f268cf5e597896a6e135a0bbbd224174f25715f0a32',
     'platform':
         'win32',
     'machine': ['amd64']
diff --git a/tools/tracebox b/tools/tracebox
index 4425edd..6fc1a86 100755
--- a/tools/tracebox
+++ b/tools/tracebox
@@ -30,18 +30,18 @@
 
 
 # ----- Amalgamator: begin of python/perfetto/prebuilts/manifests/tracebox.py
-# This file has been generated by: tools/roll-prebuilts v38.0
+# This file has been generated by: tools/roll-prebuilts v39.0
 TRACEBOX_MANIFEST = [{
     'arch':
         'mac-amd64',
     'file_name':
         'tracebox',
     'file_size':
-        1498560,
+        1498680,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/mac-amd64/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/mac-amd64/tracebox',
     'sha256':
-        'b760c7ed682d23f8d268174a939f1b8cb130ffb0d52f42b4cc4499a25423e782',
+        '07285ce963cb77212e580fe7034f6c380933c982a31272de47c7e0311d9144a1',
     'platform':
         'darwin',
     'machine': ['x86_64']
@@ -51,11 +51,11 @@
     'file_name':
         'tracebox',
     'file_size':
-        1376008,
+        1376136,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/mac-arm64/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/mac-arm64/tracebox',
     'sha256':
-        '2835127a5fc42e501e29a685a1cbcd98c26f977ee845bb1bd60a43008fd48161',
+        'f56e47303fde2de737d73bc0aebddb81a624a1130ab79ca22fb9aa4f41a4e662',
     'platform':
         'darwin',
     'machine': ['arm64']
@@ -65,11 +65,11 @@
     'file_name':
         'tracebox',
     'file_size':
-        2212088,
+        2218840,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-amd64/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-amd64/tracebox',
     'sha256':
-        '0b4a61a3e45f4e1b6111ca0b440f9e4a0b0726df912542373f69b6821a3113bc',
+        '6a23cdbae7ecdf77b2c1f72b33350c6e4a2098627454cff4af42c027808e2be8',
     'platform':
         'linux',
     'machine': ['x86_64']
@@ -79,11 +79,11 @@
     'file_name':
         'tracebox',
     'file_size':
-        1327204,
+        1332292,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-arm/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-arm/tracebox',
     'sha256':
-        '43c20d80e5b40cebe5b26579319be6d57796b04155ffc90f133b6a13c2de25ab',
+        '4732def5d23a3c66c3c286387488c9043d4f68d535d22af8374c3e1b9a9a61f5',
     'platform':
         'linux',
     'machine': ['armv6l', 'armv7l', 'armv8l']
@@ -93,11 +93,11 @@
     'file_name':
         'tracebox',
     'file_size':
-        2139928,
+        2147464,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-arm64/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-arm64/tracebox',
     'sha256':
-        '261cd7912dd69e8d82ce61b66a78f098eba46f6f492f6ec6bf73124d40a9a202',
+        'c9e83bc7b3d9059d3444392e509f96cbb242d45b0a0a27594a6b371c1a85e67f',
     'platform':
         'linux',
     'machine': ['aarch64']
@@ -107,44 +107,44 @@
     'file_name':
         'tracebox',
     'file_size':
-        1202132,
+        1230804,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-arm/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-arm/tracebox',
     'sha256':
-        '43874c4d187e3da5820ae3988d16608a8bf89d04282b8ab3e1486c6e57cd891f'
+        '2def9ce29483c8e368cc7aa3e49ff2da60555444e6cb25c5acaec7c570b06f57'
 }, {
     'arch':
         'android-arm64',
     'file_name':
         'tracebox',
     'file_size':
-        1825448,
+        1854120,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-arm64/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-arm64/tracebox',
     'sha256':
-        '9264d8f23ea3988f2952696668d3d572669134e4ca5b3e25a3209d3bfdb7d015'
+        '2484ee8210620a1dd9044610b75874302245d12aca7b59f6b7c3d55fe7ebcdde'
 }, {
     'arch':
         'android-x86',
     'file_name':
         'tracebox',
     'file_size':
-        1820588,
+        1853356,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-x86/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-x86/tracebox',
     'sha256':
-        'd591e903b1e2b0e4b270f0510c24992aac68167c80e61450ebf6c36cc780cd21'
+        '7b9f8f8eb98343bf645582439c4deb9785e6b63724ff9470a703e3bf7e2522c2'
 }, {
     'arch':
         'android-x64',
     'file_name':
         'tracebox',
     'file_size':
-        2108072,
+        2149032,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-x64/tracebox',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-x64/tracebox',
     'sha256':
-        'd3e4278e17764b605236c568202eb8d94f3f7e7593b0be9eba09f670a987acba'
+        'f81afa4516b96c3ff66cfe65b9c64567771efeef3bcb2b518a6846d358c0b93c'
 }]
 
 # ----- Amalgamator: end of python/perfetto/prebuilts/manifests/tracebox.py
diff --git a/tools/traceconv b/tools/traceconv
index 7ba7d3e..624e8d7 100755
--- a/tools/traceconv
+++ b/tools/traceconv
@@ -30,18 +30,18 @@
 
 
 # ----- Amalgamator: begin of python/perfetto/prebuilts/manifests/traceconv.py
-# This file has been generated by: tools/roll-prebuilts v38.0
+# This file has been generated by: tools/roll-prebuilts v39.0
 TRACECONV_MANIFEST = [{
     'arch':
         'mac-amd64',
     'file_name':
         'traceconv',
     'file_size':
-        8889568,
+        9004496,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/mac-amd64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/mac-amd64/traceconv',
     'sha256':
-        'e45d08f7050553f77c87764823c6ca26e877d0b3865f2764b33dcab6dfd0b9ee',
+        '11586dade97edf07d5b10fd5248127507fca16537f595d6530b81cbc266d1b12',
     'platform':
         'darwin',
     'machine': ['x86_64']
@@ -51,11 +51,11 @@
     'file_name':
         'traceconv',
     'file_size':
-        7447928,
+        7563688,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/mac-arm64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/mac-arm64/traceconv',
     'sha256':
-        '19cabe8789566e6383632bbe79e360b8bf05465f8bb156788c8c957aba77f224',
+        '48568604b4ad119f88d847d9b306102f47a5760b923ca574dfb08b3f49bdf253',
     'platform':
         'darwin',
     'machine': ['arm64']
@@ -65,11 +65,11 @@
     'file_name':
         'traceconv',
     'file_size':
-        8633416,
+        8757640,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-amd64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-amd64/traceconv',
     'sha256':
-        'a7a309c667a3e6a4c0268252540e3fc8052ebbd0abc30faf8f1783df411cf559',
+        'b263b7d4a63c923aad46940bde87063a647bb506667d857336f379d858d20646',
     'platform':
         'linux',
     'machine': ['x86_64']
@@ -79,11 +79,11 @@
     'file_name':
         'traceconv',
     'file_size':
-        6505268,
+        6605348,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-arm/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-arm/traceconv',
     'sha256':
-        '3ff0f9d4ef43e9e76d27c69827e508f4504d2d1fcfb4dac9d739023cd72106d7',
+        'c9454182a9e53b563511e1625533644829933cec13839a6fd3f08677a0e927c0',
     'platform':
         'linux',
     'machine': ['armv6l', 'armv7l', 'armv8l']
@@ -93,11 +93,11 @@
     'file_name':
         'traceconv',
     'file_size':
-        8108432,
+        8224984,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/linux-arm64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/linux-arm64/traceconv',
     'sha256':
-        '1f4641b341f2c8bf36faf8d4befedc01bd414c8f778a5b314c99c2d42c42c068',
+        '78cd7bfa0507c43c6ab728b691c5b885e18097d761c608a31388d3f8f7d84857',
     'platform':
         'linux',
     'machine': ['aarch64']
@@ -107,55 +107,55 @@
     'file_name':
         'traceconv',
     'file_size':
-        6096120,
+        6231288,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-arm/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-arm/traceconv',
     'sha256':
-        'f15c86b1d83bd1706b81426a6d11c3274044b4838abfb5d313954c65282162a9'
+        '87f57efb365dab3b5f4230518198cf0505476a6a8376842d41403ff0e7aa13ec'
 }, {
     'arch':
         'android-arm64',
     'file_name':
         'traceconv',
     'file_size':
-        7401672,
+        7528648,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-arm64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-arm64/traceconv',
     'sha256':
-        '8e98e30a8e137116e74390bcb9d662f0a3f22f9d38fe3fd7ef305d1051bdf19d'
+        '896d7af7632179a05ad4278482ec00ede09806d6d4c5e07d2cc7a802bc672b5b'
 }, {
     'arch':
         'android-x86',
     'file_name':
         'traceconv',
     'file_size':
-        8238268,
+        8393916,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-x86/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-x86/traceconv',
     'sha256':
-        '8ce56de90b18cc01d94b26f521292d71326552f8b4fb29b919f4b2b80c3eb2ec'
+        '6ce14e83af5a4e93d8dc7d39635ccb1cd7fffe988541b94960e167d33b5c5281'
 }, {
     'arch':
         'android-x64',
     'file_name':
         'traceconv',
     'file_size':
-        8397056,
+        8528128,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/android-x64/traceconv',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/android-x64/traceconv',
     'sha256':
-        'e5f31569261b3f201e2cc13b8eea510627d555767272373d9196e83ddaefa3f0'
+        '11aeb6293736175c09aacff155f793eb5508ab627f612cdecf7fec7e60485d78'
 }, {
     'arch':
         'windows-amd64',
     'file_name':
         'traceconv.exe',
     'file_size':
-        7867904,
+        8034304,
     'url':
-        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v38.0/windows-amd64/traceconv.exe',
+        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v39.0/windows-amd64/traceconv.exe',
     'sha256':
-        '74c24b2a74ae2a490ac5f918ab079a7713af07e9a36e70a2cc8536040d7df099',
+        'd53e20465cf326b5d9f5f3513cc5cd387889024ed940ec243f56dcf6fe178279',
     'platform':
         'win32',
     'machine': ['amd64']
diff --git a/ui/src/base/object_utils.ts b/ui/src/base/object_utils.ts
index 65bd95e..b4269c8 100644
--- a/ui/src/base/object_utils.ts
+++ b/ui/src/base/object_utils.ts
@@ -65,3 +65,9 @@
 export function isString(s: unknown): s is string {
   return typeof s === 'string' || s instanceof String;
 }
+
+// Given a string enum |enum|, check that |value| is a valid member of |enum|.
+export function isEnumValue<T extends {}>(
+    enm: T, value: unknown): value is T[keyof T] {
+  return Object.values(enm).includes(value);
+}
diff --git a/ui/src/base/time.ts b/ui/src/base/time.ts
index c8e5837..47c66fc 100644
--- a/ui/src/base/time.ts
+++ b/ui/src/base/time.ts
@@ -166,6 +166,24 @@
   static MAX = BigintMath.INT64_MAX;
   static ZERO = 0n;
 
+  // Cast a bigint to a |duration|. Supports potentially |undefined| values.
+  // I.e. it performs the following conversions:
+  // - `bigint` -> `duration`
+  // - `bigint|undefined` -> `duration|undefined`
+  //
+  // Use this function with caution. The function is effectively a no-op in JS,
+  // but using it tells TypeScript that "this value is a duration value". It's
+  // up to the caller to ensure the value is in the correct units.
+  //
+  // If you're reaching for this function after doing some maths on a |duration|
+  // value and it's decayed to a |bigint| consider using the static math methods
+  // in |duration| instead, as they will do the appropriate casting for you.
+  static fromRaw(v: bigint): duration;
+  static fromRaw(v?: bigint): duration|undefined;
+  static fromRaw(v?: bigint): duration|undefined {
+    return v as (duration | undefined);
+  }
+
   static min(a: duration, b: duration): duration {
     return BigintMath.min(a, b);
   }
@@ -226,6 +244,10 @@
     });
     return result.slice(0, -1);
   }
+
+  static formatSeconds(dur: duration): string {
+    return Duration.toSeconds(dur).toString() + ' s';
+  }
 }
 
 // This class takes a time and converts it to a set of strings representing a
diff --git a/ui/src/common/timestamp_format.ts b/ui/src/common/timestamp_format.ts
index 08f5223..c416a63 100644
--- a/ui/src/common/timestamp_format.ts
+++ b/ui/src/common/timestamp_format.ts
@@ -12,6 +12,8 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+import {isEnumValue} from '../base/object_utils';
+
 export enum TimestampFormat {
   Timecode = 'timecode',
   Raw = 'raw',
@@ -25,13 +27,9 @@
 const TIMESTAMP_FORMAT_KEY = 'timestampFormat';
 const DEFAULT_TIMESTAMP_FORMAT = TimestampFormat.Timecode;
 
-function isTimestampFormat(value: unknown): value is TimestampFormat {
-  return Object.values(TimestampFormat).includes(value as TimestampFormat);
-}
-
 export function timestampFormat(): TimestampFormat {
   const storedFormat = localStorage.getItem(TIMESTAMP_FORMAT_KEY);
-  if (storedFormat && isTimestampFormat(storedFormat)) {
+  if (storedFormat && isEnumValue(TimestampFormat, storedFormat)) {
     timestampFormatCached = storedFormat;
   } else {
     timestampFormatCached = DEFAULT_TIMESTAMP_FORMAT;
@@ -43,3 +41,28 @@
   timestampFormatCached = format;
   localStorage.setItem(TIMESTAMP_FORMAT_KEY, format);
 }
+
+export enum DurationPrecision {
+  Full = 'full',
+  HumanReadable = 'human_readable',
+}
+
+let durationFormatCached: DurationPrecision|undefined;
+
+const DURATION_FORMAT_KEY = 'durationFormat';
+const DEFAULT_DURATION_FORMAT = DurationPrecision.Full;
+
+export function durationPrecision(): DurationPrecision {
+  const storedFormat = localStorage.getItem(DURATION_FORMAT_KEY);
+  if (storedFormat && isEnumValue(DurationPrecision, storedFormat)) {
+    durationFormatCached = storedFormat;
+  } else {
+    durationFormatCached = DEFAULT_DURATION_FORMAT;
+  }
+  return durationFormatCached;
+}
+
+export function setDurationPrecision(format: DurationPrecision) {
+  durationFormatCached = format;
+  localStorage.setItem(DURATION_FORMAT_KEY, format);
+}
diff --git a/ui/src/frontend/aggregation_panel.ts b/ui/src/frontend/aggregation_panel.ts
index edeeda3..ea90a3f 100644
--- a/ui/src/frontend/aggregation_panel.ts
+++ b/ui/src/frontend/aggregation_panel.ts
@@ -14,7 +14,6 @@
 
 import m from 'mithril';
 
-import {Duration} from '../base/time';
 import {Actions} from '../common/actions';
 import {
   AggregateData,
@@ -25,6 +24,8 @@
 import {translateState} from '../common/thread_state';
 
 import {globals} from './globals';
+import {DurationWidget} from './widgets/duration';
+
 export interface AggregationPanelAttrs {
   data: AggregateData;
   kind: string;
@@ -112,7 +113,8 @@
     if (selection === null || selection.kind !== 'AREA') return undefined;
     const selectedArea = globals.state.areas[selection.areaId];
     const duration = selectedArea.end - selectedArea.start;
-    return m('.time-range', `Selected range: ${Duration.humanise(duration)}`);
+    return m(
+        '.time-range', 'Selected range: ', m(DurationWidget, {dur: duration}));
   }
 
   // Thread state aggregation panel only
diff --git a/ui/src/frontend/app.ts b/ui/src/frontend/app.ts
index a62cbf1..500db72 100644
--- a/ui/src/frontend/app.ts
+++ b/ui/src/frontend/app.ts
@@ -29,7 +29,12 @@
 } from '../base/time';
 import {Actions} from '../common/actions';
 import {pluginManager} from '../common/plugins';
-import {setTimestampFormat, TimestampFormat} from '../common/timestamp_format';
+import {
+  DurationPrecision,
+  setDurationPrecision,
+  setTimestampFormat,
+  TimestampFormat,
+} from '../common/timestamp_format';
 import {raf} from '../core/raf_scheduler';
 import {Command} from '../public';
 import {HotkeyConfig, HotkeyContext} from '../widgets/hotkey_context';
@@ -187,7 +192,7 @@
   private cmds: Command[] = [
     {
       id: 'perfetto.SetTimestampFormat',
-      name: 'Set timestamp format',
+      name: 'Set timestamp and duration format',
       callback:
           async () => {
             const options: PromptOption[] = [
@@ -200,7 +205,7 @@
                 displayName: 'Raw (with locale-specific formatting)',
               },
             ];
-            const promptText = 'Select timecode format...';
+            const promptText = 'Select format...';
 
             try {
               const result = await this.prompt(promptText, options);
@@ -212,6 +217,29 @@
           },
     },
     {
+      id: 'perfetto.SetDurationPrecision',
+      name: 'Set duration precision',
+      callback:
+          async () => {
+            const options: PromptOption[] = [
+              {key: DurationPrecision.Full, displayName: 'Full'},
+              {
+                key: DurationPrecision.HumanReadable,
+                displayName: 'Human readable',
+              },
+            ];
+            const promptText = 'Select duration precision mode...';
+
+            try {
+              const result = await this.prompt(promptText, options);
+              setDurationPrecision(result as DurationPrecision);
+              raf.scheduleFullRedraw();
+            } catch {
+              // Prompt was probably cancelled - do nothing.
+            }
+          },
+    },
+    {
       id: 'perfetto.ShowSliceTable',
       name: 'Show slice table',
       callback:
diff --git a/ui/src/frontend/chrome_slice_details_tab.ts b/ui/src/frontend/chrome_slice_details_tab.ts
index 91eb840..7f83b36 100644
--- a/ui/src/frontend/chrome_slice_details_tab.ts
+++ b/ui/src/frontend/chrome_slice_details_tab.ts
@@ -24,7 +24,6 @@
 import {addDebugSliceTrack} from '../tracks/debug/slice_track';
 import {Button} from '../widgets/button';
 import {DetailsShell} from '../widgets/details_shell';
-import {DurationWidget} from '../widgets/duration';
 import {GridLayout, GridLayoutColumn} from '../widgets/grid_layout';
 import {MenuItem, PopupMenu2} from '../widgets/menu';
 import {Section} from '../widgets/section';
@@ -44,6 +43,7 @@
   breakDownIntervalByThreadState,
 } from './sql/thread_state';
 import {asSliceSqlId} from './sql_types';
+import {DurationWidget} from './widgets/duration';
 
 interface ContextMenuItem {
   name: string;
diff --git a/ui/src/frontend/counter_panel.ts b/ui/src/frontend/counter_panel.ts
index 3d9e8c7..9c53288 100644
--- a/ui/src/frontend/counter_panel.ts
+++ b/ui/src/frontend/counter_panel.ts
@@ -15,12 +15,12 @@
 import m from 'mithril';
 
 import {DetailsShell} from '../widgets/details_shell';
-import {DurationWidget} from '../widgets/duration';
 import {GridLayout} from '../widgets/grid_layout';
 import {Section} from '../widgets/section';
 import {Tree, TreeNode} from '../widgets/tree';
 
 import {globals} from './globals';
+import {DurationWidget} from './widgets/duration';
 import {Timestamp} from './widgets/timestamp';
 
 export class CounterDetailsPanel implements m.ClassComponent {
diff --git a/ui/src/frontend/flamegraph_panel.ts b/ui/src/frontend/flamegraph_panel.ts
index bfed701..4abc362 100644
--- a/ui/src/frontend/flamegraph_panel.ts
+++ b/ui/src/frontend/flamegraph_panel.ts
@@ -27,7 +27,6 @@
 import {profileType} from '../controller/flamegraph_controller';
 import {raf} from '../core/raf_scheduler';
 import {Button} from '../widgets/button';
-import {DurationWidget} from '../widgets/duration';
 import {Icon} from '../widgets/icon';
 import {Popup} from '../widgets/popup';
 
@@ -38,6 +37,7 @@
 import {Router} from './router';
 import {getCurrentTrace} from './sidebar';
 import {convertTraceToPprofAndDownload} from './trace_converter';
+import {DurationWidget} from './widgets/duration';
 
 const HEADER_HEIGHT = 30;
 
diff --git a/ui/src/frontend/flow_events_panel.ts b/ui/src/frontend/flow_events_panel.ts
index af17ae7..7b3a006 100644
--- a/ui/src/frontend/flow_events_panel.ts
+++ b/ui/src/frontend/flow_events_panel.ts
@@ -17,9 +17,9 @@
 import {Icons} from '../base/semantic_icons';
 import {Actions} from '../common/actions';
 import {raf} from '../core/raf_scheduler';
-import {DurationWidget} from '../widgets/duration';
 
 import {Flow, globals} from './globals';
+import {DurationWidget} from './widgets/duration';
 
 export const ALL_CATEGORIES = '_all_';
 
diff --git a/ui/src/frontend/pivot_table.ts b/ui/src/frontend/pivot_table.ts
index 2a56f8f..5880fd9 100644
--- a/ui/src/frontend/pivot_table.ts
+++ b/ui/src/frontend/pivot_table.ts
@@ -28,7 +28,6 @@
 } from '../common/state';
 import {raf} from '../core/raf_scheduler';
 import {ColumnType} from '../trace_processor/query_result';
-import {DurationWidget} from '../widgets/duration';
 
 import {addTab} from './bottom_tab';
 import {globals} from './globals';
@@ -51,6 +50,7 @@
 import {SqlTableTab} from './sql_table/tab';
 import {SqlTables} from './sql_table/well_known_tables';
 import {AttributeModalHolder} from './tables/attribute_modal_holder';
+import {DurationWidget} from './widgets/duration';
 
 interface PathItem {
   tree: PivotTree;
diff --git a/ui/src/frontend/query_table.ts b/ui/src/frontend/query_table.ts
index a19a0a6..2e675a3 100644
--- a/ui/src/frontend/query_table.ts
+++ b/ui/src/frontend/query_table.ts
@@ -18,7 +18,7 @@
 import {BigintMath} from '../base/bigint_math';
 import {copyToClipboard} from '../base/clipboard';
 import {isString} from '../base/object_utils';
-import {Duration, Time} from '../base/time';
+import {Time} from '../base/time';
 import {Actions} from '../common/actions';
 import {QueryResponse} from '../common/queries';
 import {Row} from '../trace_processor/query_result';
@@ -229,8 +229,7 @@
       return 'Query - running';
     }
     const result = resp.error ? 'error' : `${resp.rows.length} rows`;
-    const dur = Duration.humanise(Duration.fromMillis(resp.durationMs));
-    return `Query result (${result}) - ${dur}`;
+    return `Query result (${result}) - ${resp.durationMs.toLocaleString()}ms`;
   }
 
   renderButtons(
diff --git a/ui/src/frontend/slice_details.ts b/ui/src/frontend/slice_details.ts
index 6056bbc..310d55c 100644
--- a/ui/src/frontend/slice_details.ts
+++ b/ui/src/frontend/slice_details.ts
@@ -16,10 +16,9 @@
 
 import {BigintMath} from '../base/bigint_math';
 import {sqliteString} from '../base/string_utils';
-import {Duration, duration, time} from '../base/time';
+import {duration, time} from '../base/time';
 import {exists} from '../base/utils';
 import {Anchor} from '../widgets/anchor';
-import {DurationWidget} from '../widgets/duration';
 import {MenuItem, PopupMenu2} from '../widgets/menu';
 import {Section} from '../widgets/section';
 import {SqlRef} from '../widgets/sql_ref';
@@ -35,12 +34,13 @@
 import {SqlTableTab} from './sql_table/tab';
 import {SqlTables} from './sql_table/well_known_tables';
 import {getProcessName, getThreadName} from './thread_and_process_info';
+import {DurationWidget} from './widgets/duration';
 import {Timestamp} from './widgets/timestamp';
 
 function computeDuration(ts: time, dur: duration): m.Children {
   if (dur === -1n) {
     const minDuration = globals.state.traceTime.end - ts;
-    return `${Duration.format(minDuration)} (Did not end)`;
+    return [m(DurationWidget, {dur: minDuration}), ' (Did not end)'];
   } else {
     return m(DurationWidget, {dur});
   }
diff --git a/ui/src/frontend/slice_details_panel.ts b/ui/src/frontend/slice_details_panel.ts
index c212249..0590184 100644
--- a/ui/src/frontend/slice_details_panel.ts
+++ b/ui/src/frontend/slice_details_panel.ts
@@ -20,7 +20,6 @@
 import {THREAD_STATE_TRACK_KIND} from '../tracks/thread_state';
 import {Anchor} from '../widgets/anchor';
 import {DetailsShell} from '../widgets/details_shell';
-import {DurationWidget} from '../widgets/duration';
 import {GridLayout} from '../widgets/grid_layout';
 import {Section} from '../widgets/section';
 import {SqlRef} from '../widgets/sql_ref';
@@ -29,6 +28,7 @@
 import {globals, SliceDetails, ThreadDesc} from './globals';
 import {scrollToTrackAndTs} from './scroll_helper';
 import {SlicePanel} from './slice_panel';
+import {DurationWidget} from './widgets/duration';
 import {Timestamp} from './widgets/timestamp';
 
 export class SliceDetailsPanel extends SlicePanel {
diff --git a/ui/src/frontend/slice_panel.ts b/ui/src/frontend/slice_panel.ts
index 24f8c2b..5f80ab7 100644
--- a/ui/src/frontend/slice_panel.ts
+++ b/ui/src/frontend/slice_panel.ts
@@ -15,9 +15,9 @@
 import m from 'mithril';
 
 import {duration, time} from '../base/time';
-import {DurationWidget} from '../widgets/duration';
 
 import {globals, SliceDetails} from './globals';
+import {DurationWidget} from './widgets/duration';
 
 // To display process or thread, we want to concatenate their name with ID, but
 // either can be undefined and all the cases need to be considered carefully to
diff --git a/ui/src/frontend/sql/thread_state.ts b/ui/src/frontend/sql/thread_state.ts
index d832372..e6c28d0 100644
--- a/ui/src/frontend/sql/thread_state.ts
+++ b/ui/src/frontend/sql/thread_state.ts
@@ -14,7 +14,7 @@
 
 import m from 'mithril';
 
-import {Duration, duration, TimeSpan} from '../../base/time';
+import {duration, TimeSpan} from '../../base/time';
 import {EngineProxy} from '../../public';
 import {
   LONG,
@@ -24,6 +24,7 @@
 } from '../../trace_processor/query_result';
 import {TreeNode} from '../../widgets/tree';
 import {Utid} from '../sql_types';
+import {DurationWidget} from '../widgets/duration';
 
 // An individual node of the thread state breakdown tree.
 class Node {
@@ -124,7 +125,10 @@
       TreeNode,
       {
         left: name,
-        right: `${Duration.humanise(node.dur)} (${durPercent.toFixed(2)}%)`,
+        right: [
+          m(DurationWidget, {dur: node.dur}),
+          ` (${durPercent.toFixed(2)}%)`,
+        ],
         startsCollapsed: node.startsCollapsed,
       },
       renderChildren(node, totalDur));
diff --git a/ui/src/frontend/sql_table/render_cell.ts b/ui/src/frontend/sql_table/render_cell.ts
index beeacea..d029544 100644
--- a/ui/src/frontend/sql_table/render_cell.ts
+++ b/ui/src/frontend/sql_table/render_cell.ts
@@ -18,7 +18,7 @@
 import {isString} from '../../base/object_utils';
 import {Icons} from '../../base/semantic_icons';
 import {sqliteString} from '../../base/string_utils';
-import {duration, Duration, Time} from '../../base/time';
+import {Duration, Time} from '../../base/time';
 import {Row, SqlValue} from '../../trace_processor/query_result';
 import {Anchor} from '../../widgets/anchor';
 import {Err} from '../../widgets/error';
@@ -26,6 +26,7 @@
 import {SliceRef} from '../sql/slice';
 import {asSliceSqlId} from '../sql_types';
 import {sqlValueToString} from '../sql_utils';
+import {DurationWidget} from '../widgets/duration';
 import {Timestamp} from '../widgets/timestamp';
 
 import {Column} from './column';
@@ -84,23 +85,8 @@
   return sqlValueToString(value);
 }
 
-function displayDuration(value: duration): string;
-function displayDuration(value: SqlValue): m.Children;
-function displayDuration(value: SqlValue): m.Children {
-  if (typeof value !== 'bigint') return displayValue(value);
-  return Duration.format(value);
-}
-
 function display(column: Column, row: Row): m.Children {
   const value = row[column.alias];
-
-  // Handle all cases when we have non-trivial formatting.
-  switch (column.display?.type) {
-    case 'duration':
-    case 'thread_duration':
-      return displayDuration(value);
-  }
-
   return displayValue(value);
 }
 
@@ -119,13 +105,6 @@
   const result: m.Child[] = [];
   const value = row[column.alias];
 
-  if ((column.display?.type === 'duration' ||
-       column.display?.type === 'thread_duration') &&
-      typeof value === 'bigint') {
-    result.push(copyMenuItem('Copy raw duration', `${value}`));
-    result.push(
-        copyMenuItem('Copy formatted duration', displayDuration(value)));
-  }
   if (isString(value)) {
     result.push(copyMenuItem('Copy', value));
   }
@@ -165,6 +144,19 @@
   });
 }
 
+function renderDurationColumn(
+    column: Column, row: Row, state: SqlTableState): m.Children {
+  const value = row[column.alias];
+  if (typeof value !== 'bigint') {
+    return renderStandardColumn(column, row, state);
+  }
+
+  return m(DurationWidget, {
+    dur: Duration.fromRaw(value),
+    extraMenuItems: getContextMenuItems(column, row, state),
+  });
+}
+
 function renderSliceIdColumn(
     column: {alias: string, display: SliceIdDisplayConfig},
     row: Row): m.Children {
@@ -205,11 +197,17 @@
 
 export function renderCell(
     column: Column, row: Row, state: SqlTableState): m.Children {
-  if (column.display && column.display.type === 'slice_id') {
-    return renderSliceIdColumn(
-        {alias: column.alias, display: column.display}, row);
-  } else if (column.display && column.display.type === 'timestamp') {
-    return renderTimestampColumn(column, row, state);
+  if (column.display) {
+    switch (column.display?.type) {
+      case 'slice_id':
+        return renderSliceIdColumn(
+            {alias: column.alias, display: column.display}, row);
+      case 'timestamp':
+        return renderTimestampColumn(column, row, state);
+      case 'duration':
+      case 'thread_duration':
+        return renderDurationColumn(column, row, state);
+    }
   }
   return renderStandardColumn(column, row, state);
 }
diff --git a/ui/src/frontend/thread_state_tab.ts b/ui/src/frontend/thread_state_tab.ts
index a75ca4b..8f43379 100644
--- a/ui/src/frontend/thread_state_tab.ts
+++ b/ui/src/frontend/thread_state_tab.ts
@@ -14,14 +14,13 @@
 
 import m from 'mithril';
 
-import {Duration, time} from '../base/time';
+import {Time, time} from '../base/time';
 import {runQuery} from '../common/queries';
 import {raf} from '../core/raf_scheduler';
 import {addDebugSliceTrack} from '../tracks/debug/slice_track';
 import {Anchor} from '../widgets/anchor';
 import {Button} from '../widgets/button';
 import {DetailsShell} from '../widgets/details_shell';
-import {DurationWidget} from '../widgets/duration';
 import {GridLayout} from '../widgets/grid_layout';
 import {Section} from '../widgets/section';
 import {SqlRef} from '../widgets/sql_ref';
@@ -42,6 +41,7 @@
   ThreadState,
   ThreadStateRef,
 } from './thread_state';
+import {DurationWidget, renderDuration} from './widgets/duration';
 import {Timestamp} from './widgets/timestamp';
 
 interface ThreadStateTabConfig {
@@ -252,7 +252,7 @@
     ];
 
     const nameForNextOrPrev = (state: ThreadState) =>
-        `${state.state} for ${Duration.humanise(state.dur)}`;
+        `${state.state} for ${renderDuration(state.dur)}`;
     return [m(
         Tree,
         this.relatedStates.waker && m(TreeNode, {
@@ -278,15 +278,15 @@
               {
                 left: 'Woken threads',
               },
-              this.relatedStates.wakee.map(
-                  (state) => m(TreeNode, ({
-                                 left: m(Timestamp, {
-                                   ts: state.ts,
-                                   display: `Start+${
-                                       Duration.humanise(state.ts - startTs)}`,
-                                 }),
-                                 right: renderRef(
-                                     state, getFullThreadName(state.thread)),
+              this.relatedStates.wakee.map((state) => m(TreeNode, ({
+                  left: m(Timestamp, {
+                    ts: state.ts,
+                    display: [
+                      'Start+',
+                      m(DurationWidget, {dur: Time.sub(state.ts, startTs)}),
+                    ],
+                  }),
+                  right: renderRef(state, getFullThreadName(state.thread)),
                   })))),
       ), m(Button,
            {
diff --git a/ui/src/frontend/time_selection_panel.ts b/ui/src/frontend/time_selection_panel.ts
index fcbe7c0..8137c6f 100644
--- a/ui/src/frontend/time_selection_panel.ts
+++ b/ui/src/frontend/time_selection_panel.ts
@@ -15,7 +15,6 @@
 import m from 'mithril';
 
 import {
-  Duration,
   duration,
   Span,
   time,
@@ -37,6 +36,7 @@
   timeScaleForVisibleWindow,
 } from './gridline_helper';
 import {Panel, PanelSize} from './panel';
+import {renderDuration} from './widgets/duration';
 
 export interface BBox {
   x: number;
@@ -203,7 +203,7 @@
     const {visibleTimeScale} = globals.frontendLocalState;
     const xLeft = visibleTimeScale.timeToPx(span.start);
     const xRight = visibleTimeScale.timeToPx(span.end);
-    const label = Duration.humanise(span.duration);
+    const label = renderDuration(span.duration);
     drawHBar(
         ctx,
         {
diff --git a/ui/src/frontend/widgets/duration.ts b/ui/src/frontend/widgets/duration.ts
new file mode 100644
index 0000000..6102707
--- /dev/null
+++ b/ui/src/frontend/widgets/duration.ts
@@ -0,0 +1,134 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import m from 'mithril';
+
+import {copyToClipboard} from '../../base/clipboard';
+import {Icons} from '../../base/semantic_icons';
+import {Duration, duration} from '../../base/time';
+import {
+  DurationPrecision,
+  durationPrecision,
+  setDurationPrecision,
+  TimestampFormat,
+  timestampFormat,
+} from '../../common/timestamp_format';
+import {raf} from '../../core/raf_scheduler';
+import {Anchor} from '../../widgets/anchor';
+import {MenuDivider, MenuItem, PopupMenu2} from '../../widgets/menu';
+
+import {menuItemForFormat} from './timestamp';
+
+interface DurationWidgetAttrs {
+  dur: duration;
+  extraMenuItems?: m.Child[];
+}
+
+export class DurationWidget implements m.ClassComponent<DurationWidgetAttrs> {
+  view({attrs}: m.Vnode<DurationWidgetAttrs>) {
+    const {dur} = attrs;
+    return m(
+        PopupMenu2,
+        {
+          trigger: m(Anchor, renderDuration(dur)),
+        },
+        m(MenuItem, {
+          icon: Icons.Copy,
+          label: `Copy raw value`,
+          onclick: () => {
+            copyToClipboard(dur.toString());
+          },
+        }),
+        m(
+            MenuItem,
+            {
+              label: 'Set time format',
+            },
+            menuItemForFormat(TimestampFormat.Timecode, 'Timecode'),
+            menuItemForFormat(TimestampFormat.UTC, 'Realtime (UTC)'),
+            menuItemForFormat(TimestampFormat.Seconds, 'Seconds'),
+            menuItemForFormat(TimestampFormat.Raw, 'Raw'),
+            menuItemForFormat(
+                TimestampFormat.RawLocale,
+                'Raw (with locale-specific formatting)'),
+            ),
+        m(
+            MenuItem,
+            {
+              label: 'Duration precision',
+              disabled: !durationPrecisionHasEffect(),
+              title: 'Not configurable with current time format',
+            },
+            menuItemForPrecision(DurationPrecision.Full, 'Full'),
+            menuItemForPrecision(
+                DurationPrecision.HumanReadable, 'Human readable'),
+            ),
+        attrs.extraMenuItems ? [m(MenuDivider), attrs.extraMenuItems] : null,
+    );
+  }
+}
+
+function menuItemForPrecision(
+    value: DurationPrecision, label: string): m.Children {
+  return m(MenuItem, {
+    label,
+    active: value === durationPrecision(),
+    onclick: () => {
+      setDurationPrecision(value);
+      raf.scheduleFullRedraw();
+    },
+  });
+}
+
+function durationPrecisionHasEffect(): boolean {
+  switch (timestampFormat()) {
+    case TimestampFormat.Timecode:
+    case TimestampFormat.UTC:
+      return true;
+    default:
+      return false;
+  }
+}
+
+
+export function renderDuration(dur: duration): string {
+  const fmt = timestampFormat();
+  switch (fmt) {
+    case TimestampFormat.UTC:
+    case TimestampFormat.Timecode:
+      return renderFormattedDuration(dur);
+    case TimestampFormat.Raw:
+      return dur.toString();
+    case TimestampFormat.RawLocale:
+      return dur.toLocaleString();
+    case TimestampFormat.Seconds:
+      return Duration.formatSeconds(dur);
+    default:
+      const x: never = fmt;
+      throw new Error(`Invalid format ${x}`);
+  }
+}
+
+function renderFormattedDuration(dur: duration): string {
+  const fmt = durationPrecision();
+  switch (fmt) {
+    case DurationPrecision.HumanReadable:
+      return Duration.humanise(dur);
+    case DurationPrecision.Full:
+      return Duration.format(dur);
+    default:
+      const x: never = fmt;
+      throw new Error(`Invalid format ${x}`);
+  }
+}
diff --git a/ui/src/frontend/widgets/timestamp.ts b/ui/src/frontend/widgets/timestamp.ts
index a4abc38..81d2fa8 100644
--- a/ui/src/frontend/widgets/timestamp.ts
+++ b/ui/src/frontend/widgets/timestamp.ts
@@ -18,9 +18,14 @@
 import {Icons} from '../../base/semantic_icons';
 import {time, Time} from '../../base/time';
 import {Actions} from '../../common/actions';
-import {TimestampFormat, timestampFormat} from '../../common/timestamp_format';
+import {
+  setTimestampFormat,
+  TimestampFormat,
+  timestampFormat,
+} from '../../common/timestamp_format';
+import {raf} from '../../core/raf_scheduler';
 import {Anchor} from '../../widgets/anchor';
-import {MenuItem, PopupMenu2} from '../../widgets/menu';
+import {MenuDivider, MenuItem, PopupMenu2} from '../../widgets/menu';
 import {globals} from '../globals';
 
 // import {MenuItem, PopupMenu2} from './menu';
@@ -61,11 +66,36 @@
             copyToClipboard(ts.toString());
           },
         }),
-        ...(attrs.extraMenuItems ?? []),
+        m(
+            MenuItem,
+            {
+              label: 'Time format',
+            },
+            menuItemForFormat(TimestampFormat.Timecode, 'Timecode'),
+            menuItemForFormat(TimestampFormat.UTC, 'Realtime (UTC)'),
+            menuItemForFormat(TimestampFormat.Seconds, 'Seconds'),
+            menuItemForFormat(TimestampFormat.Raw, 'Raw'),
+            menuItemForFormat(
+                TimestampFormat.RawLocale,
+                'Raw (with locale-specific formatting)'),
+            ),
+        attrs.extraMenuItems ? [m(MenuDivider), attrs.extraMenuItems] : null,
     );
   }
 }
 
+export function menuItemForFormat(
+    value: TimestampFormat, label: string): m.Children {
+  return m(MenuItem, {
+    label,
+    active: value === timestampFormat(),
+    onclick: () => {
+      setTimestampFormat(value);
+      raf.scheduleFullRedraw();
+    },
+  });
+}
+
 function renderTimestamp(time: time): m.Children {
   const fmt = timestampFormat();
   const domainTime = globals.toDomainTime(time);
diff --git a/ui/src/tracks/chrome_critical_user_interactions/page_load_details_panel.ts b/ui/src/tracks/chrome_critical_user_interactions/page_load_details_panel.ts
index 6808f39..bc2a8a4 100644
--- a/ui/src/tracks/chrome_critical_user_interactions/page_load_details_panel.ts
+++ b/ui/src/tracks/chrome_critical_user_interactions/page_load_details_panel.ts
@@ -25,11 +25,12 @@
 import {
   GenericSliceDetailsTabConfig,
 } from '../../frontend/generic_slice_details_tab';
+import {asUpid, Upid} from '../../frontend/sql_types';
+import {DurationWidget} from '../../frontend/widgets/duration';
 import {Timestamp} from '../../frontend/widgets/timestamp';
 import {LONG, LONG_NULL, NUM, STR} from '../../trace_processor/query_result';
 import {Anchor} from '../../widgets/anchor';
 import {DetailsShell} from '../../widgets/details_shell';
-import {DurationWidget} from '../../widgets/duration';
 import {GridLayout, GridLayoutColumn} from '../../widgets/grid_layout';
 import {Section} from '../../widgets/section';
 import {SqlRef} from '../../widgets/sql_ref';
@@ -38,7 +39,12 @@
 interface Data {
   ts: time;
   url: string;
+  // The row id in the chrome_page_loads table is the unique identifier of the
+  // combination of navigation id and browser upid; otherwise, navigation id
+  // is not guaranteed to be unique in a trace.
+  id: number;
   navigationId: number;
+  upid: Upid;
   fcpDuration: duration;
   lcpDuration?: duration;
   fcpTs: time;
@@ -68,7 +74,9 @@
   private async loadData() {
     const queryResult = await this.engine.query(`
       SELECT
+        id,
         navigation_id AS navigationId,
+        browser_upid AS upid,
         navigation_start_ts AS ts,
         url,
         fcp AS fcpDuration,
@@ -81,10 +89,12 @@
         mark_fully_visible_ts AS markFullyVisibleTs,
         mark_interactive_ts AS markInteractiveTs
       FROM chrome_page_loads
-      WHERE navigation_id = ${this.config.id};`);
+      WHERE id = ${this.config.id};`);
 
     const iter = queryResult.firstRow({
+      id: NUM,
       navigationId: NUM,
+      upid: NUM,
       ts: LONG,
       url: STR,
       fcpDuration: LONG,
@@ -99,10 +109,12 @@
     });
 
     this.data = {
+      id: iter.id,
       ts: Time.fromRaw(iter.ts),
       fcpTs: Time.fromRaw(iter.fcpTs),
       fcpDuration: iter.fcpDuration,
       navigationId: iter.navigationId,
+      upid: asUpid(iter.upid),
       url: iter.url,
       lcpTs: Time.fromRaw(iter.lcpTs ?? undefined),
       lcpDuration: iter.lcpDuration ?? undefined,
@@ -157,12 +169,13 @@
       }
 
       details['Navigation ID'] = this.data.navigationId;
+      details['Browser Upid'] = this.data.upid;
       details['URL'] =
           m(Anchor,
             {href: this.data.url, target: '_blank', icon: 'open_in_new'},
             this.data.url);
       details['SQL ID'] =
-          m(SqlRef, {table: 'chrome_page_loads', id: this.data.navigationId});
+          m(SqlRef, {table: 'chrome_page_loads', id: this.data.id});
     }
     return details;
   }
diff --git a/ui/src/tracks/chrome_scroll_jank/scroll_details_panel.ts b/ui/src/tracks/chrome_scroll_jank/scroll_details_panel.ts
index c659f20..63e913f 100644
--- a/ui/src/tracks/chrome_scroll_jank/scroll_details_panel.ts
+++ b/ui/src/tracks/chrome_scroll_jank/scroll_details_panel.ts
@@ -32,10 +32,10 @@
   Table,
   TableData,
 } from '../../frontend/tables/table';
+import {DurationWidget} from '../../frontend/widgets/duration';
 import {Timestamp} from '../../frontend/widgets/timestamp';
 import {LONG, NUM, STR} from '../../trace_processor/query_result';
 import {DetailsShell} from '../../widgets/details_shell';
-import {DurationWidget} from '../../widgets/duration';
 import {GridLayout, GridLayoutColumn} from '../../widgets/grid_layout';
 import {Section} from '../../widgets/section';
 import {SqlRef} from '../../widgets/sql_ref';
diff --git a/ui/src/tracks/chrome_scroll_jank/scroll_jank_v3_details_panel.ts b/ui/src/tracks/chrome_scroll_jank/scroll_jank_v3_details_panel.ts
index 13c908b..d130151 100644
--- a/ui/src/tracks/chrome_scroll_jank/scroll_jank_v3_details_panel.ts
+++ b/ui/src/tracks/chrome_scroll_jank/scroll_jank_v3_details_panel.ts
@@ -28,11 +28,11 @@
 import {getSlice, SliceDetails} from '../../frontend/sql/slice';
 import {asSliceSqlId} from '../../frontend/sql_types';
 import {sqlValueToString} from '../../frontend/sql_utils';
+import {DurationWidget} from '../../frontend/widgets/duration';
 import {Timestamp} from '../../frontend/widgets/timestamp';
 import {EngineProxy} from '../../trace_processor/engine';
 import {LONG, NUM, STR} from '../../trace_processor/query_result';
 import {DetailsShell} from '../../widgets/details_shell';
-import {DurationWidget} from '../../widgets/duration';
 import {GridLayout, GridLayoutColumn} from '../../widgets/grid_layout';
 import {Section} from '../../widgets/section';
 import {SqlRef} from '../../widgets/sql_ref';
diff --git a/ui/src/tracks/debug/details_tab.ts b/ui/src/tracks/debug/details_tab.ts
index 8c9bc33..3523f4f 100644
--- a/ui/src/tracks/debug/details_tab.ts
+++ b/ui/src/tracks/debug/details_tab.ts
@@ -43,6 +43,7 @@
   ThreadState,
   threadStateRef,
 } from '../../frontend/thread_state';
+import {DurationWidget} from '../../frontend/widgets/duration';
 import {Timestamp} from '../../frontend/widgets/timestamp';
 import {
   ColumnType,
@@ -52,7 +53,6 @@
   timeFromSql,
 } from '../../trace_processor/query_result';
 import {DetailsShell} from '../../widgets/details_shell';
-import {DurationWidget} from '../../widgets/duration';
 import {GridLayout} from '../../widgets/grid_layout';
 import {Section} from '../../widgets/section';
 import {
diff --git a/ui/src/widgets/duration.ts b/ui/src/widgets/duration.ts
deleted file mode 100644
index 2ae19cb..0000000
--- a/ui/src/widgets/duration.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2023 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-import m from 'mithril';
-
-import {Duration, duration} from '../base/time';
-
-interface DurationWidgetAttrs {
-  dur: duration;
-}
-
-export class DurationWidget implements m.ClassComponent<DurationWidgetAttrs> {
-  view(vnode: m.Vnode<DurationWidgetAttrs>) {
-    return Duration.format(vnode.attrs.dur);
-  }
-}