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 7/9] scripts: python: implement get or create frame function
Date: Thu, 6 Jul 2023 01:31:40 +0530 [thread overview]
Message-ID: <ZKXMJFckLMcGcVkP@yoga> (raw)
In-Reply-To: <CAM9d7cgAfvzrGiU0QiEigTAYKMe+OEP0b3o3Xd-0VhXX5Wkx1g@mail.gmail.com>
On Fri, Jun 23, 2023 at 05:04:56PM -0700, Namhyung Kim wrote:
> On Wed, Jun 21, 2023 at 12:45 PM Anup Sharma <anupnewsmail@gmail.com> wrote:
> >
> > The CATEGORIES list and the USER_CATEGORY_INDEX and
> > KERNEL_CATEGORY_INDEX constants has been introduced.
> >
> > The get_or_create_frame function is responsible for retrieving or
> > creating a frame based on the provided frameString. If the frame
> > corresponding to the frameString is found in the frameMap, it is
> > returned. Otherwise, a new frame is created by appending relevant
> > information to the frameTable's 'data' array and adding the
> > frameString to the stringTable.
> >
> > The index of the newly created frame is added to the frameMap.
> >
> > Signed-off-by: Anup Sharma <anupnewsmail@gmail.com>
> > ---
> > .../scripts/python/firefox-gecko-converter.py | 38 +++++++++++++++++++
> > 1 file changed, 38 insertions(+)
> >
> > diff --git a/tools/perf/scripts/python/firefox-gecko-converter.py b/tools/perf/scripts/python/firefox-gecko-converter.py
> > index 30fc542cfdeb..866751e5d1ce 100644
> > --- a/tools/perf/scripts/python/firefox-gecko-converter.py
> > +++ b/tools/perf/scripts/python/firefox-gecko-converter.py
> > @@ -15,6 +15,13 @@ def isPerfScriptFormat(profile):
> > firstLine = profile[:profile.index('\n')]
> > return bool(re.match(r'^\S.*?\s+(?:\d+/)?\d+\s+(?:\d+\d+\s+)?[\d.]+:', firstLine))
> >
> > +CATEGORIES = [
> > +{'name': 'User', 'color': 'yellow', 'subcategories': ['Other']},
> > +{'name': 'Kernel', 'color': 'orange', 'subcategories': ['Other']}
> > +]
> > +USER_CATEGORY_INDEX = 0
> > +KERNEL_CATEGORY_INDEX = 1
> > +
> > def convertPerfScriptProfile(profile):
> > def _createtread(name, pid, tid):
> > markers = {
> > @@ -70,6 +77,37 @@ def convertPerfScriptProfile(profile):
> > stackMap[key] = stack
> > return stack
> >
> > + frameMap = dict()
> > + def get_or_create_frame(frameString):
> > + frame = frameMap.get(frameString)
> > + if frame is None:
> > + frame = len(frameTable['data'])
> > + location = len(stringTable)
> > + stringTable.append(frameString)
> > +
> > + category = KERNEL_CATEGORY_INDEX if frameString.find('kallsyms') != -1 or frameString.find('/vmlinux') != -1 or frameString.endswith('.ko)') else USER_CATEGORY_INDEX
>
> This line is too long, we usually don't allow long lines
> over 100 characters.
Thanks for your suggestion. I have taken care in latest version.
Is there any way to add such checks in editor itself ? I used checkpatch.pl
scripts, however it didnt catch this.
> Thanks,
> Namhyung
>
>
> > + implementation = None
> > + optimizations = None
> > + line = None
> > + relevantForJS = False
> > + subcategory = None
> > + innerWindowID = 0
> > + column = None
> > +
> > + frameTable['data'].append([
> > + location,
> > + relevantForJS,
> > + innerWindowID,
> > + implementation,
> > + optimizations,
> > + line,
> > + column,
> > + category,
> > + subcategory,
> > + ])
> > + frameMap[frameString] = frame
> > + return frame
> > +
> > def addSample(threadName, stackArray, time):
> > nonlocal name
> > if name != threadName:
> > --
> > 2.34.1
> >
next prev parent reply other threads:[~2023-07-05 20:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-21 19:35 [PATCH 0/9] Add support for Firefox's gecko profile format Anup Sharma
2023-06-21 19:37 ` [PATCH 1/9] scripts: python: Add check for correct perf script format Anup Sharma
2023-06-21 19:39 ` [PATCH 2/9] scripts: python: implement add sample function and return finish function Anup Sharma
2023-06-21 19:40 ` [PATCH 3/9] scripts: python: Introduce thread sample processing in convertPerfScriptProfile Anup Sharma
2023-06-21 19:41 ` [PATCH 4/9] scripts: python: Implement parsing of input data " Anup Sharma
2023-06-24 0:03 ` Namhyung Kim
2023-07-05 19:56 ` Anup Sharma
2023-06-21 19:43 ` [PATCH 5/9] scripts: python: implement function for thread creation Anup Sharma
2023-06-21 19:44 ` [PATCH 6/9] scripts: python: implement get or create stack function Anup Sharma
2023-06-21 19:45 ` [PATCH 7/9] scripts: python: implement get or create frame function Anup Sharma
2023-06-24 0:04 ` Namhyung Kim
2023-07-05 20:01 ` Anup Sharma [this message]
2023-07-06 15:57 ` Ian Rogers
2023-06-21 19:46 ` [PATCH 8/9] scripts: python: Finalize convertPerfScriptProfile and return profile data Anup Sharma
2023-06-21 19:46 ` [PATCH 9/9] scripts: python: Add temporary main function for testing purposes Anup Sharma
2023-06-22 4:43 ` [PATCH 0/9] Add support for Firefox's gecko profile format Adrian Hunter
2023-06-22 20:03 ` 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=ZKXMJFckLMcGcVkP@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox