From: Anup Sharma <anupnewsmail@gmail.com>
To: Namhyung Kim <namhyung@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>,
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>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 4/6] scripts: python: Add trace end processing and JSON output
Date: Mon, 17 Jul 2023 21:23:07 +0530 [thread overview]
Message-ID: <ZLVj49CufjImBnCf@yoga> (raw)
In-Reply-To: <CAM9d7cjRhOQfihjg9ddKBmNCkW7CAG3NMWPkJQOAs5MHUxQUuA@mail.gmail.com>
On Thu, Jul 13, 2023 at 07:31:36PM -0700, Namhyung Kim wrote:
> Hi Anup and Ian,
>
> On Wed, Jul 12, 2023 at 10:28 AM Ian Rogers <irogers@google.com> wrote:
> >
> > On Mon, Jul 10, 2023 at 4:13 PM Anup Sharma <anupnewsmail@gmail.com> wrote:
> > >
> > > Inside the trace end function the final output will be dumped
> > > to standard output in JSON gecko format. Additionally, constants
> > > such as USER_CATEGORY_INDEX, KERNEL_CATEGORY_INDEX, CATEGORIES, and
> > > PRODUCT are defined to provide contextual information.
> > >
> > > Signed-off-by: Anup Sharma <anupnewsmail@gmail.com>
> >
> > Acked-by: Ian Rogers <irogers@google.com>
>
> I'm ok with this change too but I think it can be squashed to
> patch 1/6 as I think it'd make it more self-contained. Of course
> you might change time and thread to have empty values.
>
> >
> > > ---
> > > .../scripts/python/firefox-gecko-converter.py | 34 ++++++++++++++++++-
> > > 1 file changed, 33 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/tools/perf/scripts/python/firefox-gecko-converter.py b/tools/perf/scripts/python/firefox-gecko-converter.py
> > > index 0b8a86bdcab1..39818a603265 100644
> > > --- a/tools/perf/scripts/python/firefox-gecko-converter.py
> > > +++ b/tools/perf/scripts/python/firefox-gecko-converter.py
> > > @@ -24,8 +24,40 @@ from Core import *
> > > thread_map = {}
> > > start_time = None
> > >
> > > +# Follow Brendan Gregg's Flamegraph convention: orange for kernel and yellow for user
> > > +CATEGORIES = [
> > > + {'name': 'User', 'color': 'yellow', 'subcategories': ['Other']},
> > > + {'name': 'Kernel', 'color': 'orange', 'subcategories': ['Other']}
> > > +]
> >
> > A follow up could be to make these command line options, defaulting to
> > orange and yellow.
>
> Sounds good.
Nice Idea, I have added this in the next version of patch.
> >
> > > +
> > > +# The product name is used by the profiler UI to show the Operating system and Processor.
> > > +PRODUCT = os.popen('uname -op').read().strip()
>
> I'm not against this but having a command name (or full
> command line) of the target process as a title might be better.
> But I'm not sure if the python scripting engine exposed the info
> (like in perf report --header-only) to the script.
I tried to get the command name or any sort of header information but it seems to
be not exposed to the perf-script-python interface. can anyone confirm
if there is any way to get the command name or any header information from the
perf-script-python interface?
> Thanks,
> Namhyung
>
>
> > > +
> > > def trace_end():
> > > - pass
> > > + thread_array = thread_map.values()))
> > > +
> > > + result = {
> > > + 'meta': {
> > > + 'interval': 1,
> > > + 'processType': 0,
> > > + 'product': PRODUCT,
> > > + 'stackwalk': 1,
> > > + 'debug': 0,
> > > + 'gcpoison': 0,
> > > + 'asyncstack': 1,
> > > + 'startTime': start_time,
> > > + 'shutdownTime': None,
> > > + 'version': 24,
> > > + 'presymbolicated': True,
> > > + 'categories': CATEGORIES,
> > > + 'markerSchema': []
> > > + },
> > > + 'libs': [],
> > > + 'threads': thread_array,
> > > + 'processes': [],
> > > + 'pausedRanges': []
> > > + }
> > > + json.dump(result, sys.stdout, indent=2)
> > >
> > > def process_event(param_dict):
> > > global start_time
> > > --
> > > 2.34.1
> > >
next prev parent reply other threads:[~2023-07-17 15:53 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-10 23:08 [PATCH v3 0/6] Add support for Firefox's gecko profile format Anup Sharma
2023-07-10 23:09 ` [PATCH v3 1/6] scripts: python: Add initial script file with imports Anup Sharma
2023-07-12 16:50 ` Ian Rogers
2023-07-17 15:20 ` Anup Sharma
2023-07-10 23:10 ` [PATCH v3 2/6] scripts: python: Extact necessary information from process event Anup Sharma
2023-07-12 17:01 ` Ian Rogers
2023-07-12 17:03 ` Ian Rogers
2023-07-17 15:31 ` Anup Sharma
2023-07-10 23:13 ` [PATCH v3 3/6] scripts: python: thread sample processing to create thread with schemas Anup Sharma
2023-07-12 17:25 ` Ian Rogers
2023-07-17 15:43 ` Anup Sharma
2023-07-10 23:13 ` [PATCH v3 4/6] scripts: python: Add trace end processing and JSON output Anup Sharma
2023-07-12 17:28 ` Ian Rogers
2023-07-14 2:31 ` Namhyung Kim
2023-07-17 15:53 ` Anup Sharma [this message]
2023-07-10 23:14 ` [PATCH v3 5/6] scripts: python: Implement add sample function and return finish Anup Sharma
2023-07-12 17:35 ` Ian Rogers
2023-07-17 15:59 ` Anup Sharma
2023-07-10 23:15 ` [PATCH v3 6/6] scripts: python: implement get or create frame and stack function Anup Sharma
2023-07-12 17:44 ` Ian Rogers
2023-07-17 16:12 ` Anup Sharma
2023-07-14 21:36 ` [PATCH v3 0/6] Add support for Firefox's gecko profile format 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=ZLVj49CufjImBnCf@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;
as well as URLs for NNTP newsgroup(s).