aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorAnup Sharma <[email protected]>2023-07-21 23:22:56 +0530
committerArnaldo Carvalho de Melo <[email protected]>2023-07-28 19:01:16 -0300
commit0a02e44cc2fe1657af1f2740cb9a1dcd8a9338cc (patch)
tree30199acb87eb31bbfbc269e37973299d61fba30c /tools/perf/scripts/python
parent1699d3efe111e33e275ca7d4163c8b1470ba79b3 (diff)
perf scripts python: Extact necessary information from process event
The script takes in a sample event dictionary(param_dict) and retrieves relevant data such as time stamp, PID, TID, and comm for each event. Also start time is defined as a global variable as it need to be passed to trace_end for gecko meta information field creation. Signed-off-by: Anup Sharma <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/19910fefcfe4be03cd5c2aa3fec11d3f86c0381b.1689961706.git.anupnewsmail@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python')
-rw-r--r--tools/perf/scripts/python/gecko.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/perf/scripts/python/gecko.py b/tools/perf/scripts/python/gecko.py
index 7a62c1b411d9..a02b1e04ff52 100644
--- a/tools/perf/scripts/python/gecko.py
+++ b/tools/perf/scripts/python/gecko.py
@@ -20,10 +20,22 @@ sys.path.append(os.environ['PERF_EXEC_PATH'] + \
from perf_trace_context import *
from Core import *
+# start_time is intialiazed only once for the all event traces.
+start_time = None
+
# Uses perf script python interface to parse each
# event and store the data in the thread builder.
def process_event(param_dict: Dict) -> None:
- pass
+ global start_time
+ global tid_to_thread
+ time_stamp = (param_dict['sample']['time'] // 1000) / 1000
+ pid = param_dict['sample']['pid']
+ tid = param_dict['sample']['tid']
+ comm = param_dict['comm']
+
+ # Start time is the time of the first sample
+ if not start_time:
+ start_time = time_stamp
# Trace_end runs at the end and will be used to aggregate
# the data into the final json object and print it out to stdout.