Hi all,
TL;DR: I created a command-line tool for merging traces. This allows you to compare multiple traces in a single Trace Viewer instance.
One of the most frequently requested Trace Viewer features is the ability to open multiple traces simultaneously. Implementing this feature would probably require a complete overhaul of the tool and, consequently, take several months to ship.
To address this need, I created a Python script for merging traces. Given an arbitrary number of trace files, it combines all of them into a single trace file. Instead of just concatenating the underlying lists of trace events, the tool:
- matches processes and threads from different input traces by common process/thread names, ids and labels,
- shifts the timestamps of events within each input trace so that they don't overlap with the other input traces' events,
- updates ids so that stack frames and type names from different input traces do not clash and
- injects thread slices marking the ranges of input traces within the output trace.
Below is a screenshot of a trace generated using the script. It shows how the merged trace can be used to compare the memory usage of two different Chrome runs.
The script can be found in the Catapult repository (tracing/bin/merge_traces.py). Given input traces input1.json, input2.json, ..., inputN.json, the following command merges them into a single trace output.json (gzip compression is supported for both input and output traces files):
tracing/bin/merge_traces.py input1.json input2.json ... inputN.json -o output.json
I hope people will find this useful. Please let me know if you encounter any issues or have any feedback.
Thanks,
Petr