Commit Graph

6 Commits

Author SHA1 Message Date
Steven Rostedt (Red Hat) 49440828ad tools lib traceevent: Add options to function plugin
Add the options "parent" and "indent" to the function plugin.

When parent is set, the output looks like this:

function:             fsnotify_modify <-- vfs_write
function:             zone_statistics <-- get_page_from_freelist
function:                __inc_zone_state <-- zone_statistics
function:                inotify_inode_queue_event <-- fsnotify_modify
function:                fsnotify_parent <-- fsnotify_modify
function:                __inc_zone_state <-- zone_statistics
function:                   __fsnotify_parent <-- fsnotify_parent
function:                   inotify_dentry_parent_queue_event <-- fsnotify_parent
function:             add_to_page_cache_lru <-- do_read_cache_page

When it's not set, it looks like:

function:             fsnotify_modify
function:             zone_statistics
function:                __inc_zone_state
function:                inotify_inode_queue_event
function:                fsnotify_parent
function:                __inc_zone_state
function:                   __fsnotify_parent
function:                   inotify_dentry_parent_queue_event
function:             add_to_page_cache_lru

When the otpion "indent" is not set, it looks like this:

function:             fsnotify_modify <-- vfs_write
function:             zone_statistics <-- get_page_from_freelist
function:             __inc_zone_state <-- zone_statistics
function:             inotify_inode_queue_event <-- fsnotify_modify
function:             fsnotify_parent <-- fsnotify_modify
function:             __inc_zone_state <-- zone_statistics
function:             __fsnotify_parent <-- fsnotify_parent
function:             inotify_dentry_parent_queue_event <-- fsnotify_parent
function:             add_to_page_cache_lru <-- do_read_cache_page

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20140603032224.056940410@goodmis.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
2014-06-07 23:33:37 +02:00
Namhyung Kim ac668c7b7d tools lib traceevent: Unregister handler when function plugin is unloaded
The function handler should be unregistered when the plugin is unloaded
otherwise it'll try to access invalid memory.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1389839478-5887-4-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-01-16 16:26:24 -03:00
Namhyung Kim 8d0c2224ca tools lib traceevent: Make plugin unload function receive pevent
The PEVENT_PLUGIN_UNLOADER function might need some cleanup using pevent
like unregister some handlers.  So pass pevent as argument.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1389750340-15965-6-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-01-15 15:10:40 -03:00
Jiri Olsa d8e56c98b7 tools lib traceevent: Remove malloc_or_die from plugin_function.c
Removing malloc_or_die calls from plugin_function.c, replacing them and
factoring the code with standard realloc and error path.

Suggested-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386076182-14484-27-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-12-04 15:37:58 -03:00
Jiri Olsa 39956e7801 tools lib traceevent: Several cleanups for function plugin
Several cleanups suggested by Namhyung:

  * Remove index field from struct func_stack as it's not needed.

  * Rename get_index into add_and_get_index.

  * Use '%*X' format string capability instead of the loop

Suggested-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386076182-14484-26-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-12-04 15:37:24 -03:00
Jiri Olsa 07a180a0bf tools lib traceevent: Add function plugin
Backporting function plugin.

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

This plugin adds function and parent function fields resolving for
ftrace:function tracepoint event.

The diff of 'perf script' output generated by old and new code:
(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

Removing options support as it's not backported yet.
Currently this plugin supports 2 options:
 'parent' to display parent function
 'indent' to show function call indents

Enabling both of them by default.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386076182-14484-19-git-send-email-jolsa@redhat.com
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-12-04 15:32:00 -03:00