[PATCH] perf scripts python: cs-etm: Restore first sample log in verbose mode

James Clark posted 1 patch 1 month, 2 weeks ago
tools/perf/scripts/python/arm-cs-trace-disasm.py | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
[PATCH] perf scripts python: cs-etm: Restore first sample log in verbose mode
Posted by James Clark 1 month, 2 weeks ago
The linked commit moved the early return on the first sample to before
the verbose log, so move the log earlier too. Now the first sample is
also logged and not skipped.

Fixes: 2d98dbb4c9c5 ("perf scripts python arm-cs-trace-disasm.py: Do not ignore disam first sample")
Signed-off-by: James Clark <james.clark@linaro.org>
---
 tools/perf/scripts/python/arm-cs-trace-disasm.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py b/tools/perf/scripts/python/arm-cs-trace-disasm.py
index d973c2baed1c..7aff02d84ffb 100755
--- a/tools/perf/scripts/python/arm-cs-trace-disasm.py
+++ b/tools/perf/scripts/python/arm-cs-trace-disasm.py
@@ -192,17 +192,16 @@ def process_event(param_dict):
 	ip = sample["ip"]
 	addr = sample["addr"]
 
+	if (options.verbose == True):
+		print("Event type: %s" % name)
+		print_sample(sample)
+
 	# Initialize CPU data if it's empty, and directly return back
 	# if this is the first tracing event for this CPU.
 	if (cpu_data.get(str(cpu) + 'addr') == None):
 		cpu_data[str(cpu) + 'addr'] = addr
 		return
 
-
-	if (options.verbose == True):
-		print("Event type: %s" % name)
-		print_sample(sample)
-
 	# If cannot find dso so cannot dump assembler, bail out
 	if (dso == '[unknown]'):
 		return
-- 
2.34.1
Re: [PATCH] perf scripts python: cs-etm: Restore first sample log in verbose mode
Posted by Leo Yan 1 month, 2 weeks ago
On 7/23/2024 2:28 PM, James Clark wrote:
> 
> The linked commit moved the early return on the first sample to before
> the verbose log, so move the log earlier too. Now the first sample is
> also logged and not skipped.
> 
> Fixes: 2d98dbb4c9c5 ("perf scripts python arm-cs-trace-disasm.py: Do not ignore disam first sample")
> Signed-off-by: James Clark <james.clark@linaro.org>

Reviewed-by: Leo Yan <leo.yan@arm.com>

> ---
>  tools/perf/scripts/python/arm-cs-trace-disasm.py | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py b/tools/perf/scripts/python/arm-cs-trace-disasm.py
> index d973c2baed1c..7aff02d84ffb 100755
> --- a/tools/perf/scripts/python/arm-cs-trace-disasm.py
> +++ b/tools/perf/scripts/python/arm-cs-trace-disasm.py
> @@ -192,17 +192,16 @@ def process_event(param_dict):
>         ip = sample["ip"]
>         addr = sample["addr"]
> 
> +       if (options.verbose == True):
> +               print("Event type: %s" % name)
> +               print_sample(sample)
> +
>         # Initialize CPU data if it's empty, and directly return back
>         # if this is the first tracing event for this CPU.
>         if (cpu_data.get(str(cpu) + 'addr') == None):
>                 cpu_data[str(cpu) + 'addr'] = addr
>                 return
> 
> -
> -       if (options.verbose == True):
> -               print("Event type: %s" % name)
> -               print_sample(sample)
> -
>         # If cannot find dso so cannot dump assembler, bail out
>         if (dso == '[unknown]'):
>                 return
> --
> 2.34.1
>
Re: [PATCH] perf scripts python: cs-etm: Restore first sample log in verbose mode
Posted by Arnaldo Carvalho de Melo 1 month, 1 week ago
On Tue, Jul 23, 2024 at 05:05:09PM +0100, Leo Yan wrote:
> On 7/23/2024 2:28 PM, James Clark wrote:
> > 
> > The linked commit moved the early return on the first sample to before
> > the verbose log, so move the log earlier too. Now the first sample is
> > also logged and not skipped.
> > 
> > Fixes: 2d98dbb4c9c5 ("perf scripts python arm-cs-trace-disasm.py: Do not ignore disam first sample")
> > Signed-off-by: James Clark <james.clark@linaro.org>
> 
> Reviewed-by: Leo Yan <leo.yan@arm.com>

Thanks, applied to tmp.perf-tools-next,

- Arnaldo
 
> > ---
> >  tools/perf/scripts/python/arm-cs-trace-disasm.py | 9 ++++-----
> >  1 file changed, 4 insertions(+), 5 deletions(-)
> > 
> > diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py b/tools/perf/scripts/python/arm-cs-trace-disasm.py
> > index d973c2baed1c..7aff02d84ffb 100755
> > --- a/tools/perf/scripts/python/arm-cs-trace-disasm.py
> > +++ b/tools/perf/scripts/python/arm-cs-trace-disasm.py
> > @@ -192,17 +192,16 @@ def process_event(param_dict):
> >         ip = sample["ip"]
> >         addr = sample["addr"]
> > 
> > +       if (options.verbose == True):
> > +               print("Event type: %s" % name)
> > +               print_sample(sample)
> > +
> >         # Initialize CPU data if it's empty, and directly return back
> >         # if this is the first tracing event for this CPU.
> >         if (cpu_data.get(str(cpu) + 'addr') == None):
> >                 cpu_data[str(cpu) + 'addr'] = addr
> >                 return
> > 
> > -
> > -       if (options.verbose == True):
> > -               print("Event type: %s" % name)
> > -               print_sample(sample)
> > -
> >         # If cannot find dso so cannot dump assembler, bail out
> >         if (dso == '[unknown]'):
> >                 return
> > --
> > 2.34.1
> >