[PATCH 00/22] perf tools: Add traceevent plugins support

From: Jiri Olsa
Date: Thu Nov 21 2013 - 06:01:59 EST


hi,
backporting traceevent plugin support from trace-cmd.

Backported from Steven Rostedt's trace-cmd repo (HEAD 0f2c2fb):
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git

Initial RFC is here:
http://marc.info/?l=linux-kernel&m=137803257921043&w=2

Having plugins allow traceevent to properly parse 'print fmt'
line of tracepoint format and display proper/additional data
in perf script command (check examples below).

Plugins backported from trace-cmd:
plugin_function.c
plugin_hrtimer.c
plugin_jbd2.c
plugin_kmem.c
plugin_kvm.c
plugin_mac80211.c
plugin_sched_switch.c

Plugins newly added:
plugin_cfg80211.c
plugin_scsi.c
plugin_xen.c

Changes from RFC:
- added comment about repo/HEAD of the backport source
- ommited options plugin support
- change plugins installation path to:
$(perfexecdir)/traceevent/plugins

The code is available in here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/core_plugins

thanks,
jirka

Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Corey Ashford <cjashfor@xxxxxxxxxxxxxxxxxx>
Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: David Ahern <dsahern@xxxxxxxxx>


Examples (diffs of 'perf script' output):

* data was generated by 'perf record -e 'cfg80211:*' -a'
--- script.cfg80211.old
+++ script.cfg80211.new
- ifconfig 2705 [003] 662.896560: cfg80211:cfg80211_tx_mlme_mgmt: [FAILED TO PARSE] name=wlan0 ifindex=3 frame=ARRAY[c0, 00,
+ ifconfig 2705 [003] 662.896560: cfg80211:cfg80211_tx_mlme_mgmt: netdev:wlan0(3), ftype:0xc0
- kworker/u16:0 1697 [002] 664.808210: cfg80211:cfg80211_rx_mlme_mgmt: [FAILED TO PARSE] name=wlan0 ifindex=3 frame=ARRAY[b0, 00,
+ kworker/u16:0 1697 [002] 664.808210: cfg80211:cfg80211_rx_mlme_mgmt: netdev:wlan0(3), ftype:0xb0


* data was generated by 'perf record -e sched:sched_switch -a'
--- script.sched_switch.old
+++ script.sched_switch.new
- perf 577 [002] 30965.311852: sched:sched_switch: prev_comm=perf prev_pid=577 prev_prio=120 prev_state=S ==> next_comm=sw
+ perf 577 [002] 30965.311852: sched:sched_switch: perf:577 [120] S ==> swapper/2:0 [120]


* data was generated by 'perf record -e ftrace:function ls'
--- script.function.old
+++ script.function.new
- ls 10781 [001] 32667.291379: ftrace:function: ffffffff811adb80 <-- ffffffff811afc48
- ls 10781 [001] 32667.291379: ftrace:function: ffffffff811b35d0 <-- ffffffff811adb9b
- ls 10781 [001] 32667.291380: ftrace:function: ffffffff811b3520 <-- ffffffff811b35e8
- ls 10781 [001] 32667.291380: ftrace:function: ffffffff811b2720 <-- ffffffff811b3549
- ls 10781 [001] 32667.291381: ftrace:function: ffffffff81297e10 <-- ffffffff811b356c
- ls 10781 [001] 32667.291381: ftrace:function: ffffffff81298f40 <-- ffffffff81297e2c
- ls 10781 [001] 32667.291382: ftrace:function: ffffffff81076160 <-- ffffffff811afbf0
- ls 10781 [001] 32667.291383: ftrace:function: ffffffff811c3eb0 <-- ffffffff811afbfc
- ls 10781 [001] 32667.291383: ftrace:function: ffffffff8164e100 <-- ffffffff811c3ed8
- ls 10781 [001] 32667.291384: ftrace:function: ffffffff811a5d10 <-- ffffffff811c3f53
- ls 10781 [001] 32667.291384: ftrace:function: ffffffff811e8e70 <-- ffffffff811a5d58
- ls 10781 [001] 32667.291385: ftrace:function: ffffffff811f38e0 <-- ffffffff811a5d63
- ls 10781 [001] 32667.291385: ftrace:function: ffffffff811a9ff0 <-- ffffffff811a5d6b
- ls 10781 [001] 32667.291386: ftrace:function: ffffffff811a9fa0 <-- ffffffff811aa015
- ls 10781 [001] 32667.291387: ftrace:function: ffffffff810851c0 <-- ffffffff811aa053
- ls 10781 [001] 32667.291387: ftrace:function: ffffffff81090e00 <-- ffffffff81085211
+ ls 10781 [001] 32667.291379: ftrace:function: would_dump <-- setup_new_exec
+ ls 10781 [001] 32667.291379: ftrace:function: inode_permission <-- would_dump
+ ls 10781 [001] 32667.291380: ftrace:function: __inode_permission <-- inode_permission
+ ls 10781 [001] 32667.291380: ftrace:function: generic_permission <-- __inode_permission
+ ls 10781 [001] 32667.291381: ftrace:function: security_inode_permission <-- __inode_permission
+ ls 10781 [001] 32667.291381: ftrace:function: cap_inode_permission <-- security_inode_permission
+ ls 10781 [001] 32667.291382: ftrace:function: flush_signal_handlers <-- setup_new_exec
+ ls 10781 [001] 32667.291383: ftrace:function: do_close_on_exec <-- setup_new_exec
+ ls 10781 [001] 32667.291383: ftrace:function: _raw_spin_lock <-- do_close_on_exec
+ ls 10781 [001] 32667.291384: ftrace:function: filp_close <-- do_close_on_exec
+ ls 10781 [001] 32667.291384: ftrace:function: dnotify_flush <-- filp_close
+ ls 10781 [001] 32667.291385: ftrace:function: locks_remove_posix <-- filp_close
+ ls 10781 [001] 32667.291385: ftrace:function: fput <-- filp_close
+ ls 10781 [001] 32667.291386: ftrace:function: file_sb_list_del <-- fput
+ ls 10781 [001] 32667.291387: ftrace:function: task_work_add <-- fput
+ ls 10781 [001] 32667.291387: ftrace:function: kick_process <-- task_work_add


* data was generated by 'perf record -e 'kvm:*,kvmmmu:*' -a'
--- script.kvm.old
+++ script.kvm.new
qemu-system-x86 17414 [000] 6868.995053: kvm:kvm_exit: reason EPT_VIOLATION rip 0xfff0 info 184 0
qemu-system-x86 17414 [000] 6868.995109: kvm:kvm_emulate_insn: f0000:c46b:e4 71 (real)
- qemu-system-x86 3006 [002] 10562.079422: kvmmmu:kvm_mmu_get_page: [FAILED TO PARSE] mmu_valid_gen=0x2 gfn=0 role=122884 root_count=0
+ qemu-system-x86 3006 [002] 10562.079422: kvmmmu:kvm_mmu_get_page: new sp gfn 0 0/4 q0 direct --- !pge !nxe root 0 sync
- qemu-system-x86 3006 [002] 10562.080502: kvmmmu:kvm_mmu_prepare_zap_page: [FAILED TO PARSE] mmu_valid_gen=0x2 gfn=0 role=122884 root
+ qemu-system-x86 3006 [002] 10562.080502: kvmmmu:kvm_mmu_prepare_zap_page: 0/4 q0 direct --- !pge !nxe root 1 sync
qemu-system-x86 3290 [002] 10708.755312: kvmmmu:fast_page_fault: [FAILED TO PARSE] vcpu_id=0 gva=4094486080 error_code=3 sptep=0xfff
- insmod 2576 [001] 781.731666: kvmmmu:kvm_mmu_sync_page: [FAILED TO PARSE] mmu_valid_gen=0x1 gfn=2 role=24624 root_count=1
+ insmod 2576 [001] 781.731666: kvmmmu:kvm_mmu_sync_page: 3/0 q0 --- !pge !nxe root 10 unsync
- insmod 2576 [001] 781.731668: kvmmmu:kvm_mmu_unsync_page: [FAILED TO PARSE] mmu_valid_gen=0x1 gfn=2 role=24624 root_count
+ insmod 2576 [001] 781.731668: kvmmmu:kvm_mmu_unsync_page: 3/0 q0 --- !pge !nxe root 10 unsync


---
Jiri Olsa (22):
tools lib traceevent: Add plugin support
tools lib traceevent: Add plugin build support
tools lib traceevent: Add traceevent_host_bigendian function
tools lib traceevent: Add jbd2 plugin
tools lib traceevent: Add hrtimer plugin
tools lib traceevent: Add kmem plugin
tools lib traceevent: Add kvm plugin
tools lib traceevent: Add mac80211 plugin
tools lib traceevent: Add sched_switch plugin
tools lib traceevent: Add function plugin
tools lib traceevent: Add xen plugin
tools lib traceevent: Add scsi plugin
tools lib traceevent: Add cfg80211 plugin
tools lib traceevent: Update kvm plugin with is_writable_pte helper
tools lib traceevent: Change pevent_parse_event to return event format
tools lib traceevent: Harmonize the install messages in lib-traceevent
perf tools: Add build and install plugins targets
perf tools: Add udis86 disassembler feature check
perf tools: Add filename__read_str util function
perf tools: Add trace-event object
perf tools: Add trace-event global object for tracepoint interface
perf tools: Overload pr_stat traceevent print function

tools/lib/traceevent/Makefile | 61 ++++++++++--
tools/lib/traceevent/event-parse.c | 32 +++----
tools/lib/traceevent/event-parse.h | 21 +++-
tools/lib/traceevent/event-plugin.c | 202 +++++++++++++++++++++++++++++++++++++++
tools/lib/traceevent/plugin_cfg80211.c | 23 +++++
tools/lib/traceevent/plugin_function.c | 151 +++++++++++++++++++++++++++++
tools/lib/traceevent/plugin_hrtimer.c | 93 ++++++++++++++++++
tools/lib/traceevent/plugin_jbd2.c | 66 +++++++++++++
tools/lib/traceevent/plugin_kmem.c | 72 ++++++++++++++
tools/lib/traceevent/plugin_kvm.c | 436 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/lib/traceevent/plugin_mac80211.c | 95 +++++++++++++++++++
tools/lib/traceevent/plugin_sched_switch.c | 148 +++++++++++++++++++++++++++++
tools/lib/traceevent/plugin_scsi.c | 423 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/lib/traceevent/plugin_xen.c | 130 +++++++++++++++++++++++++
tools/perf/Makefile.perf | 16 +++-
tools/perf/builtin-script.c | 2 +-
tools/perf/builtin-trace.c | 5 +-
tools/perf/config/Makefile | 10 ++
tools/perf/config/feature-checks/Makefile | 6 +-
tools/perf/config/feature-checks/test-all.c | 5 +
tools/perf/config/feature-checks/test-udis86.c | 11 +++
tools/perf/util/debug.c | 16 ++++
tools/perf/util/debug.h | 2 +
tools/perf/util/evsel.c | 44 +--------
tools/perf/util/header.c | 8 +-
tools/perf/util/python-ext-sources | 1 +
tools/perf/util/session.h | 3 +-
tools/perf/util/trace-event-parse.c | 17 +---
tools/perf/util/trace-event-read.c | 20 ++--
tools/perf/util/trace-event.c | 82 ++++++++++++++++
tools/perf/util/trace-event.h | 15 ++-
tools/perf/util/util.c | 41 ++++++++
tools/perf/util/util.h | 1 +
33 files changed, 2144 insertions(+), 114 deletions(-)
create mode 100644 tools/lib/traceevent/event-plugin.c
create mode 100644 tools/lib/traceevent/plugin_cfg80211.c
create mode 100644 tools/lib/traceevent/plugin_function.c
create mode 100644 tools/lib/traceevent/plugin_hrtimer.c
create mode 100644 tools/lib/traceevent/plugin_jbd2.c
create mode 100644 tools/lib/traceevent/plugin_kmem.c
create mode 100644 tools/lib/traceevent/plugin_kvm.c
create mode 100644 tools/lib/traceevent/plugin_mac80211.c
create mode 100644 tools/lib/traceevent/plugin_sched_switch.c
create mode 100644 tools/lib/traceevent/plugin_scsi.c
create mode 100644 tools/lib/traceevent/plugin_xen.c
create mode 100644 tools/perf/config/feature-checks/test-udis86.c
create mode 100644 tools/perf/util/trace-event.c
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/