1
0
Fork 0
Commit Graph

14 Commits (d207ea8e74ff45be0838afa12bdd2492fa9dc8bc)

Author SHA1 Message Date
Tzvetomir Stoyanov (VMware) 610e1e4ff0 tools lib traceevent: Rename pevent_find_* APIs
In order to make libtraceevent into a proper library, variables, data
structures and functions require a unique prefix to prevent name space
conflicts. That prefix will be "tep_" and not "pevent_". This changes
APIs: pevent_find_function, pevent_find_function_address,
pevent_find_event_by_name, pevent_find_event_by_record

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Link: http://lkml.kernel.org/r/20180808180702.966965051@goodmis.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-08-13 15:31:28 -03:00
Tzvetomir Stoyanov (VMware) 8b3e08722e tools lib traceevent: Rename pevent field APIs
In order to make libtraceevent into a proper library, variables, data
structures and functions require a unique prefix to prevent name space
conflicts. That prefix will be "tep_" and not "pevent_". This changes
APIs: pevent_free_format, pevent_free_format_field, pevent_get_field_raw,
pevent_get_field_val, pevent_get_common_field_val, pevent_get_any_field_val

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Link: http://lkml.kernel.org/r/20180808180702.821244942@goodmis.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-08-13 15:30:30 -03:00
Tzvetomir Stoyanov (VMware) b843e9c3a2 tools lib traceevent: Rename pevent_register / unregister APIs
In order to make libtraceevent into a proper library, variables, data
structures and functions require a unique prefix to prevent name space
conflicts. That prefix will be "tep_" and not "pevent_". This changes
APIs: pevent_register_print_function, pevent_unregister_print_function,
pevent_register_event_handler, pevent_unregister_event_handler,
pevent_register_function, pevent_register_trace_clock

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Link: http://lkml.kernel.org/r/20180808180702.524813185@goodmis.org
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-08-13 15:27:35 -03:00
Tzvetomir Stoyanov (VMware) ca2921dd90 tools lib traceevent, perf tools: Rename traceevent_plugin_* APIs
In order to make libtraceevent into a proper library, variables, data
structures and functions require a unique prefix to prevent name space
conflicts. That prefix will be "tep_" and not "traceevent_". This changes
APIs: traceevent_plugin_list_options, traceevent_plugin_free_options_list,
traceevent_plugin_add_options, traceevent_plugin_remove_options,
traceevent_print_plugins

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Link: http://lkml.kernel.org/r/20180808180702.089951638@goodmis.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-08-13 15:25:36 -03:00
Tzvetomir Stoyanov (VMware) c32d52b464 tools lib traceevent, perf tools: Rename pevent plugin related APIs
In order to make libtraceevent into a proper library, variables, data
structures and functions require a unique prefix to prevent name space
conflicts. That prefix will be "tep_" and not "pevent_". This changes
the pevent plugin related API.

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Link: http://lkml.kernel.org/r/20180808180700.005287044@goodmis.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-08-13 15:21:39 -03:00
Tzvetomir Stoyanov (VMware) cbc49b25b9 tools lib traceevent, perf tools: Rename 'struct pevent_record' to 'struct tep_record'
In order to make libtraceevent into a proper library, variables, data
structures and functions require a unique prefix to prevent name space
conflicts. That prefix will be "tep_" and not "pevent_". This changes
the 'struct pevent_record' to 'struct tep_record'.

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Link: http://lkml.kernel.org/r/20180808180659.866021298@goodmis.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-08-13 15:21:13 -03:00
Tzvetomir Stoyanov (VMware) 096177a8b5 tools lib traceevent, perf tools: Rename struct pevent to struct tep_handle
In order to make libtraceevent into a proper library, variables, data
structures and functions require a unique prefix to prevent name space
conflicts. That prefix will be "tep_" and not "pevent_". This changes
the struct pevent to struct tep_handle.

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Link: http://lkml.kernel.org/r/20180808180659.706175783@goodmis.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-08-10 15:29:35 -03:00
Arnaldo Carvalho de Melo e8c6f437fd tools lib traceevent plugin function: Initialize 'index' variable
Detected with clang:

    CC       /tmp/build/perf/plugin_function.o
  plugin_function.c:145:6: warning: variable 'index' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
          if (parent && ftrace_indent->set)
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  plugin_function.c:148:29: note: uninitialized use occurs here
          trace_seq_printf(s, "%*s", index*3, "");
                                     ^~~~~
  plugin_function.c:145:2: note: remove the 'if' if its condition is always true
          if (parent && ftrace_indent->set)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  plugin_function.c:145:6: warning: variable 'index' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
          if (parent && ftrace_indent->set)
              ^~~~~~
  plugin_function.c:148:29: note: uninitialized use occurs here
          trace_seq_printf(s, "%*s", index*3, "");
                                     ^~~~~
  plugin_function.c:145:6: note: remove the '&&' if its condition is always true
          if (parent && ftrace_indent->set)
              ^~~~~~~~~
  plugin_function.c:133:11: note: initialize the variable 'index' to silence this warning
          int index;
                   ^
                    = 0
  2 warnings generated.

Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-b5wyjocel55gorl2jq2cbxrr@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2017-02-13 17:22:33 -03:00
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