From: Anup Sharma <anupnewsmail@gmail.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Anup Sharma <anupnewsmail@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/7] scripts: python: Extact necessary information from process event
Date: Sat, 8 Jul 2023 02:42:29 +0530 [thread overview]
Message-ID: <ZKh/vWsn2EiRV/9E@yoga> (raw)
In-Reply-To: <CAM9d7ci_xuVVQM9h3TdT23PsyfM5iHa8x=58k8aPQ=FfaWw8iA@mail.gmail.com>
On Wed, Jul 05, 2023 at 10:35:02PM -0700, Namhyung Kim wrote:
> Hi Anup,
>
> On Wed, Jul 5, 2023 at 12:42 PM Anup Sharma <anupnewsmail@gmail.com> wrote:
> >
> > The script takes in a sample event dictionary(param_dict) and retrieves
> > relevant data such as time stamp, PID, TID, thread name, and call stack
> > information. If available, the call stack is parsed to include function
> > names and the associated DSO, which are requires for creating json schema.
> > Also few libaries has been included which will be used in later commit.
> >
> > Signed-off-by: Anup Sharma <anupnewsmail@gmail.com>
> > ---
> > .../scripts/python/firefox-gecko-converter.py | 37 +++++++++++++++++++
> > 1 file changed, 37 insertions(+)
> > create mode 100644 tools/perf/scripts/python/firefox-gecko-converter.py
> >
> > diff --git a/tools/perf/scripts/python/firefox-gecko-converter.py b/tools/perf/scripts/python/firefox-gecko-converter.py
> > new file mode 100644
> > index 000000000000..ce663840d212
> > --- /dev/null
> > +++ b/tools/perf/scripts/python/firefox-gecko-converter.py
> > @@ -0,0 +1,37 @@
> > +#!/usr/bin/env python3
I believe this is not needed as we are using perf-script-python interface.
> > +# SPDX-License-Identifier: GPL-2.0
> > +#
> > +# Usage:
> > +#
> > +# perf record -a -g -F 99 sleep 1
> > +# perf script firefox-gecko-converter.py
> > +
> > +from __future__ import print_function
>
> Is this needed for python3?
No, it is not needed. I will remove it.
>
> > +import os
> > +import sys
> > +import json
> > +from functools import reduce
> > +
> > +sys.path.append(os.environ['PERF_EXEC_PATH'] + \
> > + '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
> > +
> > +from perf_trace_context import *
> > +from Core import *
> > +
> > +def process_event(param_dict):
> > + time_stamp = (param_dict['sample']['time'] // 1000) / 1000
> > + pid = param_dict['sample']['pid']
> > + tid = param_dict['sample']['tid']
> > + thread_name = param_dict['comm']
> > + start_time = time_stamp if not start_time else start_time
> > + if param_dict['callchain']:
> > + stack = []
> > + for call in param_dict['callchain']:
> > + if 'sym' not in call:
> > + continue
> > + stack.append(call['sym']['name'] + f' (in {call["dso"]})')
> > + if len(stack) != 0:
> > + stack = stack[::-1]
> > + else:
> > + mod = param_dict['symbol'] if 'symbol' in param_dict else '[unknown]'
>
> Why is it 'mod' instead of 'sym' or 'func'?
I will change it to 'func'. It will be more meaningful.
>
> Thanks,
> Namhyung
>
>
> > + dso = param_dict['dso'] if 'dso' in param_dict else '[unknown]'
> > --
> > 2.34.1
> >
next prev parent reply other threads:[~2023-07-07 21:13 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-05 19:40 [PATCH v2 0/7] Add support for Firefox's gecko profile format Anup Sharma
2023-07-05 19:42 ` [PATCH v2 1/7] scripts: python: Extact necessary information from process event Anup Sharma
2023-07-06 5:35 ` Namhyung Kim
2023-07-07 21:12 ` Anup Sharma [this message]
2023-07-05 19:44 ` [PATCH v2 2/7] scripts: python: Introduce thread sample processing to create thread Anup Sharma
2023-07-06 5:42 ` Namhyung Kim
2023-07-10 21:51 ` Anup Sharma
2023-07-05 19:47 ` [PATCH v2 3/7] scripts: python: create threads with schemas Anup Sharma
2023-07-06 5:46 ` Namhyung Kim
2023-07-10 21:54 ` Anup Sharma
2023-07-05 19:48 ` [PATCH v2 4/7] scripts: python: implement get or create stack function Anup Sharma
2023-07-06 5:55 ` Namhyung Kim
2023-07-10 22:01 ` Anup Sharma
2023-07-05 19:48 ` [PATCH v2 5/7] scripts: python: implement get or create frame function Anup Sharma
2023-07-06 6:06 ` Namhyung Kim
2023-07-10 22:42 ` Anup Sharma
2023-07-05 19:49 ` [PATCH v2 6/7] scripts: python: implement add sample function and return finish Anup Sharma
2023-07-05 19:49 ` [PATCH v2 7/7] scripts: python: Add trace end processing and JSON output Anup Sharma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZKh/vWsn2EiRV/9E@yoga \
--to=anupnewsmail@gmail.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.