History

perf scripts python: Add initial script file with usage information

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.

Anup Sharma committed 3 years ago

Commit 1699d3e1 parent 1e372011 file · +31 −0Browse files

Showing the changes to tools/perf/scripts/python (1 of 1 file). Show all

Unified · Split

tools/perf/scripts/python/gecko.py+31−0
@@ -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
12import os
13import sys
14from typing import Dict
15
16# Add the Perf-Trace-Util library to the Python path
17sys.path.append(os.environ['PERF_EXEC_PATH'] + \
18 '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
19
20from perf_trace_context import *
21from Core import *
22
23# Uses perf script python interface to parse each
24# event and store the data in the thread builder.
25def 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.
30def trace_end() -> None:
31 pass