Re: [PATCH 0/3] perf tools: Minor improvements in event synthesis

2021-03-12 Thread Andi Kleen
On Mon, Dec 21, 2020 at 04:00:26PM +0900, Namhyung Kim wrote:
> Hello,
> 
> This is to optimize the event synthesis during perf record.
> 
> The first patch is to reduce memory usage when many threads are used.
> The second is to avoid unncessary syscalls for kernel threads.  And
> the last one is to reduce the number of threads to iterate when new
> threads are being created at the same time.
> 
> Unfortunately there's no dramatic improvement here but I can see ~5%
> gain in the 'perf bench internals synthesize' on a big machine.
> (The numbers are not stable though)

Looks all good to me. The VmPeak assumption might be slightly
fragile, but I guess there's nothing better currently.

Reviewed-by: Andi Kleen 

-Andi


[PATCH 0/3] perf tools: Minor improvements in event synthesis

2020-12-20 Thread Namhyung Kim
Hello,

This is to optimize the event synthesis during perf record.

The first patch is to reduce memory usage when many threads are used.
The second is to avoid unncessary syscalls for kernel threads.  And
the last one is to reduce the number of threads to iterate when new
threads are being created at the same time.

Unfortunately there's no dramatic improvement here but I can see ~5%
gain in the 'perf bench internals synthesize' on a big machine.
(The numbers are not stable though)


Before:
  # perf bench internals synthesize --mt -M1 -I 100
  # Running 'internals/synthesize' benchmark:
  Computing performance of multi threaded perf event synthesis by
  synthesizing events on CPU 0:
Number of synthesis threads: 1
  Average synthesis took: 68831.480 usec (+- 101.450 usec)
  Average num. events: 9982.000 (+- 0.000)
  Average time per event 6.896 usec


After:
  # perf bench internals synthesize --mt -M1 -I 100
  # Running 'internals/synthesize' benchmark:
  Computing performance of multi threaded perf event synthesis by
  synthesizing events on CPU 0:
Number of synthesis threads: 1
  Average synthesis took: 65036.370 usec (+- 158.121 usec)
  Average num. events: 9982.000 (+- 0.000)
  Average time per event 6.515 usec


Thanks,
Namhyung


Namhyung Kim (3):
  perf tools: Use /proc//task//status for synthesis
  perf tools: Skip MMAP record synthesis for kernel threads
  perf tools: Use scandir() to iterate threads

 tools/perf/util/synthetic-events.c | 88 --
 1 file changed, 58 insertions(+), 30 deletions(-)

-- 
2.29.2.684.gfbc64c5ab5-goog