linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* perf bpf-output example program
@ 2016-10-23 17:10 Vince Weaver
  2016-10-25  3:20 ` Wangnan (F)
  0 siblings, 1 reply; 3+ messages in thread
From: Vince Weaver @ 2016-10-23 17:10 UTC (permalink / raw)
  To: linux-perf-users; +Cc: Wang Nan


Does anyone have a working perf bpf-output example program?

The one from the original commit to the kernel 
03e0a7df3efd959e40cd7ff40b1fabddc234ec5a
does not work for me:

sudo perf record -a -e bpf-output/no-inherit,name=evt/ -e 
./test_bpf_output.c/map:channel:event=evt/ ls /

WARNING:	unable to get correct kernel building directory.
Hint:	Set correct kbuild directory using 'kbuild-dir' option in [llvm]
     	section of ~/.perfconfig or set it to "" to suppress kbuild
     	detection.

event syntax error: './test_bpf_output.c/map:channel:event=evt/'
                     \___ Failed to load program for unknown reason

Vince

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: perf bpf-output example program
  2016-10-23 17:10 perf bpf-output example program Vince Weaver
@ 2016-10-25  3:20 ` Wangnan (F)
  2016-10-25  5:37   ` Vince Weaver
  0 siblings, 1 reply; 3+ messages in thread
From: Wangnan (F) @ 2016-10-25  3:20 UTC (permalink / raw)
  To: Vince Weaver, linux-perf-users



On 2016/10/24 1:10, Vince Weaver wrote:
> Does anyone have a working perf bpf-output example program?
>
> The one from the original commit to the kernel
> 03e0a7df3efd959e40cd7ff40b1fabddc234ec5a
> does not work for me:
>
> sudo perf record -a -e bpf-output/no-inherit,name=evt/ -e
> ./test_bpf_output.c/map:channel:event=evt/ ls /

Sorry. the API has changed. You should use map:channel.event=evt,
not ...channel:event...

> WARNING:	unable to get correct kernel building directory.
> Hint:	Set correct kbuild directory using 'kbuild-dir' option in [llvm]
>       	section of ~/.perfconfig or set it to "" to suppress kbuild
>       	detection.
>
> event syntax error: './test_bpf_output.c/map:channel:event=evt/'
>                       \___ Failed to load program for unknown reason
>
> Vince
>

This is my test result:
  $ cat ~/.perfconfig
  [llvm]
    clang-path = "/tmp/oxygen_root/usr/bin/clang"
  $ sudo ./perf record -a -e bpf-output/no-inherit,name=evt/ -e 
./test_bpf_output.c/map:channel.event=evt/ ls /
  bin   cdrom  etc   initrd.img  lib32  libx32      media  opt root  
sbin  sys    usr  vmlinuz
  boot  dev    home  lib           lib64  lost+found  mnt     proc run   
srv   tmp    var
  [ perf record: Woken up 0 times to write data ]
  [ perf record: Captured and wrote 0.772 MB perf.data (501 samples) ]

  $ sudo ~/perf script
             perf 15478 [001] 6571474.169705: 0                       
evt:  ffffffff81238c41 sys_write+0x1 (/lib/module
       BPF output: 0000: 23 b3 78 d3 b6 58 17 00  #.x..X..
                   0008: 01 00 00 00
  ....


But in your case it reports can't locate kbuild dir. Please fix it, or the
  #include <uapi/linux/bpf.h>
at the head of test-bpf-output.c causes failure.

Thank you.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: perf bpf-output example program
  2016-10-25  3:20 ` Wangnan (F)
@ 2016-10-25  5:37   ` Vince Weaver
  0 siblings, 0 replies; 3+ messages in thread
From: Vince Weaver @ 2016-10-25  5:37 UTC (permalink / raw)
  To: Wangnan (F); +Cc: linux-perf-users

On Tue, 25 Oct 2016, Wangnan (F) wrote:

> But in your case it reports can't locate kbuild dir. Please fix it, or the
>  #include <uapi/linux/bpf.h>
> at the head of test-bpf-output.c causes failure.

It looks like the problem was trying to run on 4.7 kernel, which just 
didn't work.  I tried running on 4.9-rc1 and it seems to work.

Thanks for the help

Vince

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-25  5:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-23 17:10 perf bpf-output example program Vince Weaver
2016-10-25  3:20 ` Wangnan (F)
2016-10-25  5:37   ` Vince Weaver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).