2020-09-21 20:21:05

by Hagen Paul Pfeifer

[permalink] [raw]
Subject: [PATCH 2/2] perf script: add min, max to futex-contention

Average is quite informative, but the outliners - especially max - are
also of interest.

Before:

mutex-locker[793299] lock 5637ec61e080 contended 3400 times, 446 avg ns
mutex-locker[793301] lock 5637ec61e080 contended 3563 times, 385 avg ns
mutex-locker[793300] lock 5637ec61e080 contended 3110 times, 1855 avg ns

After:

mutex-locker[795251] lock 55b14e6dd080 contended 3853 times, 1279 avg ns [max: 12270 us, min 340 us]
mutex-locker[795253] lock 55b14e6dd080 contended 2911 times, 518 avg ns [max: 51660261 us, min 347 us]
mutex-locker[795252] lock 55b14e6dd080 contended 3843 times, 385 avg ns [max: 24323998 us, min 338 us]

Signed-off-by: Hagen Paul Pfeifer <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/scripts/python/futex-contention.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/scripts/python/futex-contention.py b/tools/perf/scripts/python/futex-contention.py
index c440f02627dd..e8a02aecabd9 100644
--- a/tools/perf/scripts/python/futex-contention.py
+++ b/tools/perf/scripts/python/futex-contention.py
@@ -53,5 +53,5 @@ def trace_begin():
def trace_end():
for (tid, lock) in lock_waits:
min, max, avg, count = lock_waits[tid, lock]
- print("%s[%d] lock %x contended %d times, %d avg ns" %
- (process_names[tid], tid, lock, count, avg))
+ print("%s[%d] lock %x contended %d times, %d avg ns [max: %d us, min %d us]" %
+ (process_names[tid], tid, lock, count, avg, max, min))
--
2.28.0


2020-09-22 20:11:49

by Hagen Paul Pfeifer

[permalink] [raw]
Subject: [PATCH v2] perf script: add min, max to futex-contention

Average is quite informative, but the outliners - especially max - are
also of interest.

Before:

mutex-locker[793299] lock 5637ec61e080 contended 3400 times, 446 avg ns
mutex-locker[793301] lock 5637ec61e080 contended 3563 times, 385 avg ns
mutex-locker[793300] lock 5637ec61e080 contended 3110 times, 1855 avg ns

After:

mutex-locker[795251] lock 55b14e6dd080 contended 3853 times, 1279 avg ns [max: 12270 ns, min 340 ns]
mutex-locker[795253] lock 55b14e6dd080 contended 2911 times, 518 avg ns [max: 51660261 ns, min 347 ns]
mutex-locker[795252] lock 55b14e6dd080 contended 3843 times, 385 avg ns [max: 24323998 ns, min 338 ns]

Signed-off-by: Hagen Paul Pfeifer <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
---

v2: nanosecond, not microseconds

tools/perf/scripts/python/futex-contention.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/scripts/python/futex-contention.py b/tools/perf/scripts/python/futex-contention.py
index c440f02627dd..7e884d46f920 100644
--- a/tools/perf/scripts/python/futex-contention.py
+++ b/tools/perf/scripts/python/futex-contention.py
@@ -53,5 +53,5 @@ def trace_begin():
def trace_end():
for (tid, lock) in lock_waits:
min, max, avg, count = lock_waits[tid, lock]
- print("%s[%d] lock %x contended %d times, %d avg ns" %
- (process_names[tid], tid, lock, count, avg))
+ print("%s[%d] lock %x contended %d times, %d avg ns [max: %d ns, min %d ns]" %
+ (process_names[tid], tid, lock, count, avg, max, min))
--
2.28.0

2020-09-23 12:33:28

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH v2] perf script: add min, max to futex-contention

Em Tue, Sep 22, 2020 at 10:09:22PM +0200, Hagen Paul Pfeifer escreveu:
> Average is quite informative, but the outliners - especially max - are
> also of interest.
>
> Before:
>
> mutex-locker[793299] lock 5637ec61e080 contended 3400 times, 446 avg ns
> mutex-locker[793301] lock 5637ec61e080 contended 3563 times, 385 avg ns
> mutex-locker[793300] lock 5637ec61e080 contended 3110 times, 1855 avg ns
>
> After:
>
> mutex-locker[795251] lock 55b14e6dd080 contended 3853 times, 1279 avg ns [max: 12270 ns, min 340 ns]
> mutex-locker[795253] lock 55b14e6dd080 contended 2911 times, 518 avg ns [max: 51660261 ns, min 347 ns]
> mutex-locker[795252] lock 55b14e6dd080 contended 3843 times, 385 avg ns [max: 24323998 ns, min 338 ns]
>
> Signed-off-by: Hagen Paul Pfeifer <[email protected]>
> Cc: Arnaldo Carvalho de Melo <[email protected]>
> ---

Didn't apply here, I did it by hand, please check, probably some
indentation artifact.

Thanks for the patch!

- Arnaldo

diff --git a/tools/perf/scripts/python/futex-contention.py b/tools/perf/scripts/python/futex-contention.py
index 0c4841acf75dadcb..ba044d20e8fff39b 100644
--- a/tools/perf/scripts/python/futex-contention.py
+++ b/tools/perf/scripts/python/futex-contention.py
@@ -47,6 +47,6 @@ def trace_begin():
def trace_end():
for (tid, lock) in lock_waits:
min, max, avg, count = lock_waits[tid, lock]
- print("%s[%d] lock %x contended %d times, %d avg ns" %
- (process_names[tid], tid, lock, count, avg))
+ print("%s[%d] lock %x contended %d times, %d avg ns [max: %d ns, min %d ns]" %
+ (process_names[tid], tid, lock, count, avg, max, min))



> v2: nanosecond, not microseconds
>
> tools/perf/scripts/python/futex-contention.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/scripts/python/futex-contention.py b/tools/perf/scripts/python/futex-contention.py
> index c440f02627dd..7e884d46f920 100644
> --- a/tools/perf/scripts/python/futex-contention.py
> +++ b/tools/perf/scripts/python/futex-contention.py
> @@ -53,5 +53,5 @@ def trace_begin():
> def trace_end():
> for (tid, lock) in lock_waits:
> min, max, avg, count = lock_waits[tid, lock]
> - print("%s[%d] lock %x contended %d times, %d avg ns" %
> - (process_names[tid], tid, lock, count, avg))
> + print("%s[%d] lock %x contended %d times, %d avg ns [max: %d ns, min %d ns]" %
> + (process_names[tid], tid, lock, count, avg, max, min))
> --
> 2.28.0
>

--

- Arnaldo

2020-09-23 12:41:56

by Hagen Paul Pfeifer

[permalink] [raw]
Subject: Re: [PATCH v2] perf script: add min, max to futex-contention

> On 09/23/2020 2:31 PM Arnaldo Carvalho de Melo <[email protected]> wrote:
>
> Didn't apply here, I did it by hand, please check, probably some
> indentation artifact.

Probably you missed patch one of the patchset - the autopep8 formatting
one for the lock contention script?

> Thanks for the patch!

You are welcome Arnaldo!

Hagen

2020-09-23 14:09:21

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH v2] perf script: add min, max to futex-contention

Em Wed, Sep 23, 2020 at 02:40:10PM +0200, Hagen Paul Pfeifer escreveu:
> > On 09/23/2020 2:31 PM Arnaldo Carvalho de Melo <[email protected]> wrote:
> >
> > Didn't apply here, I did it by hand, please check, probably some
> > indentation artifact.
>
> Probably you missed patch one of the patchset - the autopep8 formatting
> one for the lock contention script?

Right, I missed that, I'm removing my "fix", autopep'in and then
reapplying your verbatin 2/2 patch.

> > Thanks for the patch!
>
> You are welcome Arnaldo!
>
> Hagen

--

- Arnaldo