Added necessary modules, including the Perf-Trace-Util library, and defines the required functions and variables for using perf script python. The perf_trace_context and Core modules for tracing and processing events has been also imported. Added usage information.
Showing the changes to tools/perf/scripts/python (1 of 1 file). Show all
Unified · Split
| @@ -0,0 +1,31 @@ | ||
| 1 | +# firefox-gecko-converter.py - Convert perf record output to Firefox's gecko profile format | |
| 2 | +# SPDX-License-Identifier: GPL-2.0 | |
| 3 | +# | |
| 4 | +# The script converts perf.data to Gecko Profile Format, | |
| 5 | +# which can be read by https://profiler.firefox.com/. | |
| 6 | +# | |
| 7 | +# Usage: | |
| 8 | +# | |
| 9 | +# perf record -a -g -F 99 sleep 60 | |
| 10 | +# perf script report gecko > output.json | |
| 11 | + | |
| 12 | +import os | |
| 13 | +import sys | |
| 14 | +from typing import Dict | |
| 15 | + | |
| 16 | +# Add the Perf-Trace-Util library to the Python path | |
| 17 | +sys.path.append(os.environ['PERF_EXEC_PATH'] + \ | |
| 18 | + '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') | |
| 19 | + | |
| 20 | +from perf_trace_context import * | |
| 21 | +from Core import * | |
| 22 | + | |
| 23 | +# Uses perf script python interface to parse each | |
| 24 | +# event and store the data in the thread builder. | |
| 25 | +def process_event(param_dict: Dict) -> None: | |
| 26 | + pass | |
| 27 | + | |
| 28 | +# Trace_end runs at the end and will be used to aggregate | |
| 29 | +# the data into the final json object and print it out to stdout. | |
| 30 | +def trace_end() -> None: | |
| 31 | + pass | |