Re: [PATCH v15 0/3]: perf: reduce data loss when profiling highly parallel CPU bound workloads
From: Jiri Olsa
Date: Fri Nov 09 2018 - 03:22:48 EST
On Tue, Nov 06, 2018 at 11:53:02AM +0300, Alexey Budankov wrote:
>
> Currently in record mode the tool implements trace writing serially.
> The algorithm loops over mapped per-cpu data buffers and stores
> ready data chunks into a trace file using write() system call.
>
> At some circumstances the kernel may lack free space in a buffer
> because the other buffer's half is not yet written to disk due to
> some other buffer's data writing by the tool at the moment.
>
> Thus serial trace writing implementation may cause the kernel
> to loose profiling data and that is what observed when profiling
> highly parallel CPU bound workloads on machines with big number
> of cores.
>
> Experiment with profiling matrix multiplication code executing 128
> threads on Intel Xeon Phi (KNM) with 272 cores, like below,
> demonstrates data loss metrics value of 98%:
>
> /usr/bin/time perf record -o /tmp/perf-ser.data -a -N -B -T -R -g \
> --call-graph dwarf,1024 --user-regs=IP,SP,BP --switch-events \
> -e cycles,instructions,ref-cycles,software/period=1,name=cs,config=0x3/Duk -- \
> matrix.gcc
>
> Data loss metrics is the ratio lost_time/elapsed_time where
> lost_time is the sum of time intervals containing PERF_RECORD_LOST
> records and elapsed_time is the elapsed application run time
> under profiling.
>
> Applying asynchronous trace streaming thru Posix AIO API [1] lowers
> data loss metrics value providing 2x improvement (from 98% to ~1%)
>
> Asynchronous trace streaming is currently limited to glibc linkage.
> musl libc [5] also provides Posix AIO API implementation, however
> the patchkit is not tested with it. There may be other libc libraries
> linked by Perf tool that currently lack Posix AIO API support [2],
> [3], [4] so NO_AIO define may be used to limit Perf tool binary to
> serial streaming only.
>
> ---
> Alexey Budankov (3):
> perf util: map data buffer for preserving collected data
> perf record: enable asynchronous trace writing
> perf record: extend trace writing to multi AIO
FYI I was rebasing my threads branch on top of this and
first 2 won't apply anymore on Arnaldo's perf/core
Arnaldo,
could we get this merged soon? the world around is moving
fast and we don't want 20th revision on this ;-)
thanks,
jirka