[PATCH v1 00/11] Python improvements for a real use of parse_events

Ian Rogers posted 11 patches 11 months, 2 weeks ago
There is a newer version of this series
tools/perf/python/tracepoint.py |  23 +++---
tools/perf/util/debug.c         |   2 +-
tools/perf/util/evlist.c        |  13 ++--
tools/perf/util/evsel.c         |  16 +++-
tools/perf/util/python.c        | 127 ++++++++++++++++++++++++++++----
5 files changed, 145 insertions(+), 36 deletions(-)
[PATCH v1 00/11] Python improvements for a real use of parse_events
Posted by Ian Rogers 11 months, 2 weeks ago
While parse_events access in python was added, it wasn't used by any
python script. In enabling this for the tracepoint.py script a number
of latent bugs and necessary improvements were discovered.

Ian Rogers (11):
  perf debug: Avoid stack overflow in recursive error message
  perf evlist: Add success path to evlist__create_syswide_maps
  perf evsel: tp_format accessing improvements
  perf python: Add evlist enable and disable methods
  perf python: Add member access to a number of evsel variables
  perf python: Add optional cpus and threads arguments to parse_events
  perf python: Update ungrouped evsel leader in clone
  perf python: Avoid duplicated code in get_tracepoint_field
  perf python: Add evlist all_cpus accessor
  perf python: Add evlist.config to set up record options
  perf python tracepoint: Switch to using parse_events

 tools/perf/python/tracepoint.py |  23 +++---
 tools/perf/util/debug.c         |   2 +-
 tools/perf/util/evlist.c        |  13 ++--
 tools/perf/util/evsel.c         |  16 +++-
 tools/perf/util/python.c        | 127 ++++++++++++++++++++++++++++----
 5 files changed, 145 insertions(+), 36 deletions(-)

-- 
2.47.1.613.gc27f4b7a9f-goog
Re: [PATCH v1 00/11] Python improvements for a real use of parse_events
Posted by Howard Chu 9 months, 3 weeks ago
Hello Ian,

Sorry for the late reply—I just recovered from a nasty flu.

perf $ git log --oneline | head -n 11
0c1d18794589 perf python tracepoint: Switch to using parse_events
94dc6574ff24 perf python: Add evlist.config to set up record options
ebc33f96a37d perf python: Add evlist all_cpus accessor
c1ff82e366ee perf python: Avoid duplicated code in get_tracepoint_field
5293474151de perf python: Update ungrouped evsel leader in clone
47f66c784109 perf python: Add optional cpus and threads arguments to
parse_events
d4f592ec635e perf python: Add member access to a number of evsel variables
f4a3006a2c87 perf python: Add evlist enable and disable methods
2e040a422d0a perf evsel: tp_format accessing improvements
d79fd699f99a perf evlist: Add success path to evlist__create_syswide_maps
054b63706989 perf debug: Avoid stack overflow in recursive error message


perf $ sudo python python/tracepoint.py
libperf: mmap_per_cpu: nr cpu values 4 nr threads 1
libperf: idx 0: mmapping fd 3
libperf: idx 1: mmapping fd 4
libperf: idx 2: mmapping fd 5
libperf: idx 3: mmapping fd 6
time 35749194145330 prev_comm=python prev_pid=233668 prev_prio=120
prev_state=0x100 ==> next_comm=migration/0 next_pid=20 next_prio=0
time 35749196508397 prev_comm=python prev_pid=233668 prev_prio=120
prev_state=0x100 ==> next_comm=migration/1 next_pid=25 next_prio=0
time 35749196575872 prev_comm=python prev_pid=233668 prev_prio=120
prev_state=0x100 ==> next_comm=migration/2 next_pid=31 next_prio=0
time 35749194158623 prev_comm=migration/0 prev_pid=20 prev_prio=0
prev_state=0x1 ==> next_comm=swapper/0 next_pid=0 next_prio=120

Worked very well.

On Wed, Jan 8, 2025 at 11:51 PM Ian Rogers <irogers@google.com> wrote:
>
> While parse_events access in python was added, it wasn't used by any
> python script. In enabling this for the tracepoint.py script a number
> of latent bugs and necessary improvements were discovered.
>
> Ian Rogers (11):
>   perf debug: Avoid stack overflow in recursive error message
>   perf evlist: Add success path to evlist__create_syswide_maps
>   perf evsel: tp_format accessing improvements
>   perf python: Add evlist enable and disable methods
>   perf python: Add member access to a number of evsel variables
>   perf python: Add optional cpus and threads arguments to parse_events
>   perf python: Update ungrouped evsel leader in clone
>   perf python: Avoid duplicated code in get_tracepoint_field
>   perf python: Add evlist all_cpus accessor
>   perf python: Add evlist.config to set up record options
>   perf python tracepoint: Switch to using parse_events

Not an expert in this but:

Reviewed-by: Howard Chu <howardchu95@gmail.com>

Thanks,
Howard
>
>  tools/perf/python/tracepoint.py |  23 +++---
>  tools/perf/util/debug.c         |   2 +-
>  tools/perf/util/evlist.c        |  13 ++--
>  tools/perf/util/evsel.c         |  16 +++-
>  tools/perf/util/python.c        | 127 ++++++++++++++++++++++++++++----
>  5 files changed, 145 insertions(+), 36 deletions(-)
>
> --
> 2.47.1.613.gc27f4b7a9f-goog
>
Re: [PATCH v1 00/11] Python improvements for a real use of parse_events
Posted by Ian Rogers 10 months, 2 weeks ago
On Wed, Jan 8, 2025 at 11:51 PM Ian Rogers <irogers@google.com> wrote:
>
> While parse_events access in python was added, it wasn't used by any
> python script. In enabling this for the tracepoint.py script a number
> of latent bugs and necessary improvements were discovered.

Ping.

Thanks,
Ian
Re: [PATCH v1 00/11] Python improvements for a real use of parse_events
Posted by Ian Rogers 10 months, 1 week ago
On Tue, Feb 4, 2025 at 2:23 PM Ian Rogers <irogers@google.com> wrote:
>
> On Wed, Jan 8, 2025 at 11:51 PM Ian Rogers <irogers@google.com> wrote:
> >
> > While parse_events access in python was added, it wasn't used by any
> > python script. In enabling this for the tracepoint.py script a number
> > of latent bugs and necessary improvements were discovered.
>
> Ping.

Ping.

Thanks,
Ian
Re: [PATCH v1 00/11] Python improvements for a real use of parse_events
Posted by Namhyung Kim 10 months, 1 week ago
Hi Ian,

On Mon, Feb 10, 2025 at 08:06:34AM -0800, Ian Rogers wrote:
> On Tue, Feb 4, 2025 at 2:23 PM Ian Rogers <irogers@google.com> wrote:
> >
> > On Wed, Jan 8, 2025 at 11:51 PM Ian Rogers <irogers@google.com> wrote:
> > >
> > > While parse_events access in python was added, it wasn't used by any
> > > python script. In enabling this for the tracepoint.py script a number
> > > of latent bugs and necessary improvements were discovered.
> >
> > Ping.
> 
> Ping.

Thanks for the reminder.  I'll review pending patches this week.

Arnaldo, can you please help reviewing this series?

Thanks,
Namhyung