• Ravi Bangoria's avatar
    perf sdt: Show proper hint when event not yet in place via 'perf probe' · 27cf5706
    Ravi Bangoria authored
    All events from 'perf list', except SDT events, can be directly recorded
    with 'perf record'. But, the flow is little different for SDT events.
    
    Probe points for SDT event needs to be created using 'perf probe' before
    recording it using 'perf record'.
    
    Perf shows misleading hint when a user tries to record SDT event without
    first creating a probe point. Show proper hint there.
    
    Before patch:
    
      $ perf record -a -e sdt_glib:idle__add
        event syntax error: 'sdt_glib:idle__add'
                             \___ unknown tracepoint
    
        Error: File /sys/kernel/debug/tracing/events/sdt_glib/idle__add not found.
        Hint:  Perhaps this kernel misses some CONFIG_ setting to enable this feature?.
        ...
    
    After patch:
    
      $ perf record -a -e sdt_glib:idle__add
        event syntax error: 'sdt_glib:idle__add'
                             \___ unknown tracepoint
    
        Error: File /sys/kernel/debug/tracing/events/sdt_glib/idle__add not found.
        Hint:  SDT event cannot be directly recorded on.
               Please first use 'perf probe sdt_glib:idle__add' before recording it.
        ...
    
      $ perf probe sdt_glib:idle__add
        Added new event:
          sdt_glib:idle__add   (on %idle__add in /usr/lib64/libglib-2.0.so.0.5000.2)
    
        You can now use it in all perf tools, such as:
    
            perf record -e sdt_glib:idle__add -aR sleep 1
    
      $ perf record -a -e sdt_glib:idle__add
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.175 MB perf.data ]
    Suggested-and-Acked-by: default avatarIngo Molnar <mingo@redhat.com>
    Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
    Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
    Cc: Michael Ellerman <mpe@ellerman.id.au>
    Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: http://lkml.kernel.org/r/20170203102642.17258-1-ravi.bangoria@linux.vnet.ibm.com
    [ s/Please use/Please first use/ and break the Hint line in two ]
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    27cf5706
tracing_path.c 3.11 KB