2023-07-05 19:58:38

by Anup Sharma

[permalink] [raw]
Subject: [PATCH v2 3/7] scripts: python: create threads with schemas

The markers structure defines the schema and data for
thread markers, including fields such as 'name',
'startTime', 'endTime', 'phase', 'category', and 'data'.

The samples structure defines the schema and data for thread
samples, including fields such as 'stack', 'time', and
'responsiveness'.

The frameTable structure defines the schema and data for frame
information, including fields such as 'location', 'relevantForJS',
'innerWindowID', 'implementation', 'optimizations', 'line',
'column', 'category', and 'subcategory'.

The purpose of this function is to create a new thread structure
These structures provide a framework for storing and organizing
information related to thread markers, samples, frame details,
and stack information.

Signed-off-by: Anup Sharma <[email protected]>
---
.../scripts/python/firefox-gecko-converter.py | 41 +++++++++++++++++++
1 file changed, 41 insertions(+)

diff --git a/tools/perf/scripts/python/firefox-gecko-converter.py b/tools/perf/scripts/python/firefox-gecko-converter.py
index 95b061a97cbc..e56864e78dc1 100644
--- a/tools/perf/scripts/python/firefox-gecko-converter.py
+++ b/tools/perf/scripts/python/firefox-gecko-converter.py
@@ -24,6 +24,47 @@ start_time = None
def process_event(param_dict):
global start_time
global thread_map
+ def _createtread(name, pid, tid):
+ markers = {
+ 'schema': {
+ 'name': 0,
+ 'startTime': 1,
+ 'endTime': 2,
+ 'phase': 3,
+ 'category': 4,
+ 'data': 5,
+ },
+ 'data': [],
+ }
+ samples = {
+ 'schema': {
+ 'stack': 0,
+ 'time': 1,
+ 'responsiveness': 2,
+ },
+ 'data': [],
+ }
+ frameTable = {
+ 'schema': {
+ 'location': 0,
+ 'relevantForJS': 1,
+ 'innerWindowID': 2,
+ 'implementation': 3,
+ 'optimizations': 4,
+ 'line': 5,
+ 'column': 6,
+ 'category': 7,
+ 'subcategory': 8,
+ },
+ 'data': [],
+ }
+ stackTable = {
+ 'schema': {
+ 'prefix': 0,
+ 'frame': 1,
+ },
+ 'data': [],
+ }

def _addThreadSample(pid, tid, threadName, time_stamp, stack):
thread = thread_map.get(tid)
--
2.34.1



2023-07-06 06:12:50

by Namhyung Kim

[permalink] [raw]
Subject: Re: [PATCH v2 3/7] scripts: python: create threads with schemas

On Wed, Jul 5, 2023 at 12:47 PM Anup Sharma <[email protected]> wrote:
>
> The markers structure defines the schema and data for
> thread markers, including fields such as 'name',
> 'startTime', 'endTime', 'phase', 'category', and 'data'.
>
> The samples structure defines the schema and data for thread
> samples, including fields such as 'stack', 'time', and
> 'responsiveness'.
>
> The frameTable structure defines the schema and data for frame
> information, including fields such as 'location', 'relevantForJS',
> 'innerWindowID', 'implementation', 'optimizations', 'line',
> 'column', 'category', and 'subcategory'.
>
> The purpose of this function is to create a new thread structure
> These structures provide a framework for storing and organizing
> information related to thread markers, samples, frame details,
> and stack information.
>
> Signed-off-by: Anup Sharma <[email protected]>
> ---
> .../scripts/python/firefox-gecko-converter.py | 41 +++++++++++++++++++
> 1 file changed, 41 insertions(+)
>
> diff --git a/tools/perf/scripts/python/firefox-gecko-converter.py b/tools/perf/scripts/python/firefox-gecko-converter.py
> index 95b061a97cbc..e56864e78dc1 100644
> --- a/tools/perf/scripts/python/firefox-gecko-converter.py
> +++ b/tools/perf/scripts/python/firefox-gecko-converter.py
> @@ -24,6 +24,47 @@ start_time = None
> def process_event(param_dict):
> global start_time
> global thread_map
> + def _createtread(name, pid, tid):
> + markers = {
> + 'schema': {
> + 'name': 0,
> + 'startTime': 1,
> + 'endTime': 2,
> + 'phase': 3,
> + 'category': 4,
> + 'data': 5,
> + },
> + 'data': [],
> + }
> + samples = {
> + 'schema': {
> + 'stack': 0,
> + 'time': 1,
> + 'responsiveness': 2,
> + },
> + 'data': [],
> + }
> + frameTable = {
> + 'schema': {
> + 'location': 0,
> + 'relevantForJS': 1,
> + 'innerWindowID': 2,
> + 'implementation': 3,
> + 'optimizations': 4,
> + 'line': 5,
> + 'column': 6,
> + 'category': 7,
> + 'subcategory': 8,
> + },
> + 'data': [],
> + }
> + stackTable = {
> + 'schema': {
> + 'prefix': 0,
> + 'frame': 1,
> + },
> + 'data': [],
> + }

It seems this function doesn't return anything.
Can we have a complete definition? Otherwise it's hard to
know how these tables are used.

Thanks,
Namhyung


>
> def _addThreadSample(pid, tid, threadName, time_stamp, stack):
> thread = thread_map.get(tid)
> --
> 2.34.1
>

2023-07-10 22:44:25

by Anup Sharma

[permalink] [raw]
Subject: Re: [PATCH v2 3/7] scripts: python: create threads with schemas

On Wed, Jul 05, 2023 at 10:46:51PM -0700, Namhyung Kim wrote:
> On Wed, Jul 5, 2023 at 12:47 PM Anup Sharma <[email protected]> wrote:
> >
> > The markers structure defines the schema and data for
> > thread markers, including fields such as 'name',
> > 'startTime', 'endTime', 'phase', 'category', and 'data'.
> >
> > The samples structure defines the schema and data for thread
> > samples, including fields such as 'stack', 'time', and
> > 'responsiveness'.
> >
> > The frameTable structure defines the schema and data for frame
> > information, including fields such as 'location', 'relevantForJS',
> > 'innerWindowID', 'implementation', 'optimizations', 'line',
> > 'column', 'category', and 'subcategory'.
> >
> > The purpose of this function is to create a new thread structure
> > These structures provide a framework for storing and organizing
> > information related to thread markers, samples, frame details,
> > and stack information.
> >
> > Signed-off-by: Anup Sharma <[email protected]>
> > ---
> > .../scripts/python/firefox-gecko-converter.py | 41 +++++++++++++++++++
> > 1 file changed, 41 insertions(+)
> >
> > diff --git a/tools/perf/scripts/python/firefox-gecko-converter.py b/tools/perf/scripts/python/firefox-gecko-converter.py
> > index 95b061a97cbc..e56864e78dc1 100644
> > --- a/tools/perf/scripts/python/firefox-gecko-converter.py
> > +++ b/tools/perf/scripts/python/firefox-gecko-converter.py
> > @@ -24,6 +24,47 @@ start_time = None
> > def process_event(param_dict):
> > global start_time
> > global thread_map
> > + def _createtread(name, pid, tid):
> > + markers = {
> > + 'schema': {
> > + 'name': 0,
> > + 'startTime': 1,
> > + 'endTime': 2,
> > + 'phase': 3,
> > + 'category': 4,
> > + 'data': 5,
> > + },
> > + 'data': [],
> > + }
> > + samples = {
> > + 'schema': {
> > + 'stack': 0,
> > + 'time': 1,
> > + 'responsiveness': 2,
> > + },
> > + 'data': [],
> > + }
> > + frameTable = {
> > + 'schema': {
> > + 'location': 0,
> > + 'relevantForJS': 1,
> > + 'innerWindowID': 2,
> > + 'implementation': 3,
> > + 'optimizations': 4,
> > + 'line': 5,
> > + 'column': 6,
> > + 'category': 7,
> > + 'subcategory': 8,
> > + },
> > + 'data': [],
> > + }
> > + stackTable = {
> > + 'schema': {
> > + 'prefix': 0,
> > + 'frame': 1,
> > + },
> > + 'data': [],
> > + }
>
> It seems this function doesn't return anything.
> Can we have a complete definition? Otherwise it's hard to
> know how these tables are used.

I will add the complete definition in the next version.

> Thanks,
> Namhyung
>
>
> >
> > def _addThreadSample(pid, tid, threadName, time_stamp, stack):
> > thread = thread_map.get(tid)
> > --
> > 2.34.1
> >