[PATCH v3 2/6] scripts: python: Extact necessary information from process event

From: Anup Sharma
Date: Mon Jul 10 2023 - 19:10:54 EST


The script takes in a sample event dictionary(param_dict) and retrieves
relevant data such as time stamp, PID, TID, thread name. Also start time
is defined.

Signed-off-by: Anup Sharma <anupnewsmail@xxxxxxxxx>
---
.../perf/scripts/python/firefox-gecko-converter.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/tools/perf/scripts/python/firefox-gecko-converter.py b/tools/perf/scripts/python/firefox-gecko-converter.py
index 5b342641925c..765f1775cee5 100644
--- a/tools/perf/scripts/python/firefox-gecko-converter.py
+++ b/tools/perf/scripts/python/firefox-gecko-converter.py
@@ -21,8 +21,19 @@ sys.path.append(os.environ['PERF_EXEC_PATH'] + \
from perf_trace_context import *
from Core import *

+start_time = None
+
def trace_end():
pass

def process_event(param_dict):
- pass
+ global start_time
+ # Extract relevant information from the event parameters. The event parameters
+ # are in a dictionary:
+ time_stamp = (param_dict['sample']['time'] // 1000) / 1000
+ pid = param_dict['sample']['pid']
+ tid = param_dict['sample']['tid']
+ thread_name = param_dict['comm']
+
+ # Assume that start time is the time of the first event.
+ start_time = time_stamp if not start_time else start_time
--
2.34.1