* [PATCH] tools:perf:scripts:python:intel-pt-events del unusedvar
@ 2023-01-06 21:56 Alexander Pantyukhin
2023-01-14 7:24 ` Adrian Hunter
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Pantyukhin @ 2023-01-06 21:56 UTC (permalink / raw
To: peterz, akpm
Cc: mingo, namhyung, jolsa, acme, linux-perf-users, linux-kernel,
Alexander Pantyukhin
The event_attr is never used later, the var is ok be deleted.
Additional code simplification is to substitute string slice comparison
with "substring" function. This case no need to know the length specific
words.
Signed-off-by: Alexander Pantyukhin <apantykhin@gmail.com>
---
tools/perf/scripts/python/intel-pt-events.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/tools/perf/scripts/python/intel-pt-events.py b/tools/perf/scripts/python/intel-pt-events.py
index 08862a2582f4..28d08e2fb7cd 100644
--- a/tools/perf/scripts/python/intel-pt-events.py
+++ b/tools/perf/scripts/python/intel-pt-events.py
@@ -340,7 +340,6 @@ def print_srccode(comm, param_dict, sample, symbol, dso, with_insn):
print(start_str, src_str)
def do_process_event(param_dict):
- event_attr = param_dict["attr"]
sample = param_dict["sample"]
raw_buf = param_dict["raw_buf"]
comm = param_dict["comm"]
@@ -359,13 +358,13 @@ def do_process_event(param_dict):
print(glb_switch_str[cpu])
del glb_switch_str[cpu]
- if name[0:12] == "instructions":
+ if name.startswith("instructions"):
if glb_src:
print_srccode(comm, param_dict, sample, symbol, dso, True)
else:
print_instructions_start(comm, sample)
print_common_ip(param_dict, sample, symbol, dso)
- elif name[0:8] == "branches":
+ elif name.startswith("branches"):
if glb_src:
print_srccode(comm, param_dict, sample, symbol, dso, False)
else:
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tools:perf:scripts:python:intel-pt-events del unusedvar
2023-01-06 21:56 [PATCH] tools:perf:scripts:python:intel-pt-events del unusedvar Alexander Pantyukhin
@ 2023-01-14 7:24 ` Adrian Hunter
2023-01-14 13:10 ` Alexander Pantyukhin
0 siblings, 1 reply; 3+ messages in thread
From: Adrian Hunter @ 2023-01-14 7:24 UTC (permalink / raw
To: Alexander Pantyukhin, peterz, akpm
Cc: mingo, namhyung, jolsa, acme, linux-perf-users, linux-kernel
On 6/01/23 23:56, Alexander Pantyukhin wrote:
> The event_attr is never used later, the var is ok be deleted.
> Additional code simplification is to substitute string slice comparison
> with "substring" function. This case no need to know the length specific
> words.
>
> Signed-off-by: Alexander Pantyukhin <apantykhin@gmail.com>
> ---
> tools/perf/scripts/python/intel-pt-events.py | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/scripts/python/intel-pt-events.py b/tools/perf/scripts/python/intel-pt-events.py
> index 08862a2582f4..28d08e2fb7cd 100644
> --- a/tools/perf/scripts/python/intel-pt-events.py
> +++ b/tools/perf/scripts/python/intel-pt-events.py
> @@ -340,7 +340,6 @@ def print_srccode(comm, param_dict, sample, symbol, dso, with_insn):
> print(start_str, src_str)
>
> def do_process_event(param_dict):
> - event_attr = param_dict["attr"]
Should really be moved to the "Unused fields:" comment
section a few lines below.
> sample = param_dict["sample"]
> raw_buf = param_dict["raw_buf"]
> comm = param_dict["comm"]
> @@ -359,13 +358,13 @@ def do_process_event(param_dict):
> print(glb_switch_str[cpu])
> del glb_switch_str[cpu]
>
> - if name[0:12] == "instructions":
> + if name.startswith("instructions"):
> if glb_src:
> print_srccode(comm, param_dict, sample, symbol, dso, True)
> else:
> print_instructions_start(comm, sample)
> print_common_ip(param_dict, sample, symbol, dso)
> - elif name[0:8] == "branches":
> + elif name.startswith("branches"):
> if glb_src:
> print_srccode(comm, param_dict, sample, symbol, dso, False)
> else:
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tools:perf:scripts:python:intel-pt-events del unusedvar
2023-01-14 7:24 ` Adrian Hunter
@ 2023-01-14 13:10 ` Alexander Pantyukhin
0 siblings, 0 replies; 3+ messages in thread
From: Alexander Pantyukhin @ 2023-01-14 13:10 UTC (permalink / raw
To: Adrian Hunter
Cc: peterz, akpm, mingo, namhyung, jolsa, acme, linux-perf-users,
linux-kernel
Hello!
>
> On 6/01/23 23:56, Alexander Pantyukhin wrote:
> > The event_attr is never used later, the var is ok be deleted.
> > Additional code simplification is to substitute string slice comparison
> > with "substring" function. This case no need to know the length specific
> > words.
> >
> > Signed-off-by: Alexander Pantyukhin <apantykhin@gmail.com>
> > ---
> > tools/perf/scripts/python/intel-pt-events.py | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/tools/perf/scripts/python/intel-pt-events.py b/tools/perf/scripts/python/intel-pt-events.py
> > index 08862a2582f4..28d08e2fb7cd 100644
> > --- a/tools/perf/scripts/python/intel-pt-events.py
> > +++ b/tools/perf/scripts/python/intel-pt-events.py
> > @@ -340,7 +340,6 @@ def print_srccode(comm, param_dict, sample, symbol, dso, with_insn):
> > print(start_str, src_str)
> >
> > def do_process_event(param_dict):
> > - event_attr = param_dict["attr"]
>
> Should really be moved to the "Unused fields:" comment
> section a few lines below.
Fixed in the patch v2.
>
> > sample = param_dict["sample"]
> > raw_buf = param_dict["raw_buf"]
> > comm = param_dict["comm"]
> > @@ -359,13 +358,13 @@ def do_process_event(param_dict):
> > print(glb_switch_str[cpu])
> > del glb_switch_str[cpu]
> >
> > - if name[0:12] == "instructions":
> > + if name.startswith("instructions"):
> > if glb_src:
> > print_srccode(comm, param_dict, sample, symbol, dso, True)
> > else:
> > print_instructions_start(comm, sample)
> > print_common_ip(param_dict, sample, symbol, dso)
> > - elif name[0:8] == "branches":
> > + elif name.startswith("branches"):
> > if glb_src:
> > print_srccode(comm, param_dict, sample, symbol, dso, False)
> > else:
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-14 13:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-06 21:56 [PATCH] tools:perf:scripts:python:intel-pt-events del unusedvar Alexander Pantyukhin
2023-01-14 7:24 ` Adrian Hunter
2023-01-14 13:10 ` Alexander Pantyukhin
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 read-only IMAP folder(s) and NNTP newsgroup(s).