Re: [RFC] perf record: Add option to print perf_event_open args and return value

From: Ravi Bangoria
Date: Fri Nov 08 2019 - 03:36:21 EST




On 11/8/19 1:34 PM, Jiri Olsa wrote:
On Fri, Nov 08, 2019 at 09:29:49AM +0530, Ravi Bangoria wrote:
Perf record with verbose=2 already prints this information along with
whole lot of other traces which requires lot of scrolling. I thought
to show this information in verbose=1 but I fear that it will be too
much for level 1. So finally created a new option specifically for
printing this.

Sample o/p:
$ ./perf record --peo-args -- ls > /dev/null
------------------------------------------------------------
perf_event_attr:
size 112
{ sample_period, sample_freq } 4000
sample_type IP|TID|TIME|PERIOD
read_format ID
disabled 1
inherit 1
exclude_kernel 1
mmap 1
comm 1
freq 1
enable_on_exec 1
task 1
precise_ip 3
sample_id_all 1
exclude_guest 1
mmap2 1
comm_exec 1
ksymbol 1
bpf_event 1
------------------------------------------------------------
sys_perf_event_open: pid 4308 cpu 0 group_fd -1 flags 0x8 = 4
sys_perf_event_open: pid 4308 cpu 1 group_fd -1 flags 0x8 = 5
sys_perf_event_open: pid 4308 cpu 2 group_fd -1 flags 0x8 = 6
sys_perf_event_open: pid 4308 cpu 3 group_fd -1 flags 0x8 = 8
sys_perf_event_open: pid 4308 cpu 4 group_fd -1 flags 0x8 = 9
sys_perf_event_open: pid 4308 cpu 5 group_fd -1 flags 0x8 = 10
sys_perf_event_open: pid 4308 cpu 6 group_fd -1 flags 0x8 = 11
sys_perf_event_open: pid 4308 cpu 7 group_fd -1 flags 0x8 = 12
------------------------------------------------------------
perf_event_attr:
type 1
size 112
config 0x9
watermark 1
sample_id_all 1
bpf_event 1
{ wakeup_events, wakeup_watermark } 1
------------------------------------------------------------
sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8
sys_perf_event_open failed, error -13
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.002 MB perf.data (9 samples) ]

Signed-off-by: Ravi Bangoria <ravi.bangoria@xxxxxxxxxxxxx>

right, -vv is already poluted ;-) but we have the perf --debug
option for specific debug:

--debug
Setup debug variable (see list below) in value range (0, 10). Use like: --debug verbose # sets verbose = 1 --debug verbose=2 # sets verbose = 2

List of debug variables allowed to set:
verbose - general debug messages
ordered-events - ordered events object debug messages
data-convert - data convert command debug messages
stderr - write debug output (option -v) to stderr
in browser mode

so I think something like this would fit better:

perf --debug event-open[=X] record ...
perf --debug perf-event-open[=X] record ...

Thanks Jiri. This looks better. Will respin.