Re: [PATCH v4 3/7] perf tools: Enable overwrite settings

From: Wangnan (F)
Date: Tue May 24 2016 - 22:21:27 EST




On 2016/5/25 2:40, Arnaldo Carvalho de Melo wrote:
Em Tue, May 24, 2016 at 02:29:00AM +0000, Wang Nan escreveu:
This patch allows following config terms and option:

Globally setting events to overwrite;

# perf record --overwrite ...

Set specific events to be overwrite or no-overwrite.

# perf record --event cycles/overwrite/ ...
# perf record --event cycles/no-overwrite/ ...
So, based on this chunk of documentation in this patch:

<quote>
Perf dumps data from overwritable ring buffer when switching output (see
--switch-output) and before terminate.
</>

I tried:

No --overwrite:

# perf record -e syscalls:*enter_nanosleep* usleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.019 MB perf.data (1 samples) ]
# perf evlist -v
syscalls:sys_enter_nanosleep: type: 2, size: 112, config: 0x132, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CPU|PERIOD|RAW, disabled: 1, inherit: 1, mmap: 1, comm: 1, enable_on_exec: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
# Tip: use 'perf evlist --trace-fields' to show fields for tracepoint events
# perf script
usleep 29416 [002] 220099.782982: syscalls:sys_enter_nanosleep: rqtp: 0x7ffc21f73cc0, rmtp: 0x00000000

Now I went on to try this new --overwrite thing:

# perf record --overwrite -e syscalls:*enter_nanosleep* usleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.019 MB perf.data ]
# perf evlist -v
syscalls:sys_enter_nanosleep: type: 2, size: 112, config: 0x132, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CPU|PERIOD|RAW, disabled: 1, inherit: 1, mmap: 1, comm: 1, enable_on_exec: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1, write_backward: 1
# Tip: use 'perf evlist --trace-fields' to show fields for tracepoint events
# perf script
#

So it hasn't recorded anything at anytime, i.e. I expected, based on the
documentation provided, that it would get what was in its buffer, to be written,
i.e. the single "syscalls:sys_enter_nanosleep" event that took place in that
workload.

So I'm now trying it together with --switch-output, but I just get one
timestamp suffixed perf.data file, empty, without that event that I know took
place.

Care to ellaborate here?

Sorry, you need to apply patch 3/7 - 5/7 to enable operations described here.

I'll reorder these patches and send again, but some important patch would become
untestable until patch 3/7 get applied. I'll try to add a test case for them.

Thank you.