Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <anupnewsmail@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/19910fefcfe4be03cd5c2aa3fec11d3f86c0381b.1689961706.git.anupnewsmail@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Anup Sharma and committed by
Arnaldo Carvalho de Melo
0a02e44c 1699d3ef

+13 -1
+13 -1
tools/perf/scripts/python/gecko.py
··· 20 20 from perf_trace_context import * 21 21 from Core import * 22 22 23 + # start_time is intialiazed only once for the all event traces. 24 + start_time = None 25 + 23 26 # Uses perf script python interface to parse each 24 27 # event and store the data in the thread builder. 25 28 def process_event(param_dict: Dict) -> None: 26 - pass 29 + global start_time 30 + global tid_to_thread 31 + time_stamp = (param_dict['sample']['time'] // 1000) / 1000 32 + pid = param_dict['sample']['pid'] 33 + tid = param_dict['sample']['tid'] 34 + comm = param_dict['comm'] 35 + 36 + # Start time is the time of the first sample 37 + if not start_time: 38 + start_time = time_stamp 27 39 28 40 # Trace_end runs at the end and will be used to aggregate 29 41 # the data into the final json object and print it out to stdout.