#!/usr/bin/env python3 # Copyright 2024 The Chromium Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import sys from collections import defaultdict DESCRIPTION = \ '''This script takes in a Chromium trace file and extracts info about Mojo messages that were sent/received. Trace files can be created using chrome://tracing or from passing '--enable-tracing' to a Chrome or browser test executable. In the chrome://tracing UI, ensure that the 'mojom' and 'toplevel' categories are selected when setting up a new trace. Also, the trace events available will have much more information (including message contents and return values) if the executable generating the trace file is built with the `extended_tracing_enabled = true` gn arg. ''' PERFETTO_NOT_FOUND_HELP_TEXT = \ '''Error: perfetto module not found. This script requires the perfetto Python module. To install it, use something like `pip install perfetto`, or for Googlers on gLinux use the following (in a Chromium checkout): ``` sudo apt-get install python3-venv python3 -m venv venv ./venv/bin/python3 -mpip install perfetto ./venv/bin/python3 tools/mojo_messages_log.py