Back to home page

OSCL-LXR

 
 

    


0001 libtraceevent(3)
0002 ================
0003 
0004 NAME
0005 ----
0006 tep_load_plugins, tep_unload_plugins, tep_load_plugins_hook - Load / unload traceevent plugins.
0007 
0008 SYNOPSIS
0009 --------
0010 [verse]
0011 --
0012 *#include <event-parse.h>*
0013 
0014 struct tep_plugin_list pass:[*]*tep_load_plugins*(struct tep_handle pass:[*]_tep_);
0015 void *tep_unload_plugins*(struct tep_plugin_list pass:[*]_plugin_list_, struct tep_handle pass:[*]_tep_);
0016 void *tep_load_plugins_hook*(struct tep_handle pass:[*]_tep_, const char pass:[*]_suffix_,
0017                            void (pass:[*]_load_plugin_)(struct tep_handle pass:[*]tep,
0018                                                const char pass:[*]path,
0019                                                const char pass:[*]name,
0020                                                void pass:[*]data),
0021                            void pass:[*]_data_);
0022 --
0023 
0024 DESCRIPTION
0025 -----------
0026 The _tep_load_plugins()_ function loads all plugins, located in the plugin
0027 directories. The _tep_ argument is trace event parser context.
0028 The plugin directories are :
0029 [verse]
0030 --
0031         - Directories, specified in _tep_->plugins_dir with priority TEP_PLUGIN_FIRST
0032         - System's plugin directory, defined at the library compile time. It
0033           depends on the library installation prefix and usually is
0034           _(install_preffix)/lib/traceevent/plugins_
0035         - Directory, defined by the environment variable _TRACEEVENT_PLUGIN_DIR_
0036         - User's plugin directory, located at _~/.local/lib/traceevent/plugins_
0037         - Directories, specified in _tep_->plugins_dir with priority TEP_PLUGIN_LAST
0038 --
0039 Loading of plugins can be controlled by the _tep_flags_, using the
0040 _tep_set_flag()_ API:
0041 [verse]
0042 --
0043         _TEP_DISABLE_SYS_PLUGINS_       - do not load plugins, located in
0044                                         the system's plugin directory.
0045         _TEP_DISABLE_PLUGINS_           - do not load any plugins.
0046 --
0047 The _tep_set_flag()_ API needs to be called before _tep_load_plugins()_, if
0048 loading of all plugins is not the desired case.
0049 
0050 The _tep_unload_plugins()_ function unloads the plugins, previously loaded by
0051 _tep_load_plugins()_. The _tep_ argument is trace event parser context. The
0052 _plugin_list_ is the list of loaded plugins, returned by
0053 the _tep_load_plugins()_ function.
0054 
0055 The _tep_load_plugins_hook_ function walks through all directories with plugins
0056 and calls user specified _load_plugin()_ hook for each plugin file. Only files
0057 with given _suffix_ are considered to be plugins. The _data_ is a user specified
0058 context, passed to _load_plugin()_. Directories and the walk order are the same
0059 as in _tep_load_plugins()_ API.
0060 
0061 RETURN VALUE
0062 ------------
0063 The _tep_load_plugins()_ function returns a list of successfully loaded plugins,
0064 or NULL in case no plugins are loaded.
0065 
0066 EXAMPLE
0067 -------
0068 [source,c]
0069 --
0070 #include <event-parse.h>
0071 ...
0072 struct tep_handle *tep = tep_alloc();
0073 ...
0074 struct tep_plugin_list *plugins = tep_load_plugins(tep);
0075 if (plugins == NULL) {
0076         /* no plugins are loaded */
0077 }
0078 ...
0079 tep_unload_plugins(plugins, tep);
0080 ...
0081 void print_plugin(struct tep_handle *tep, const char *path,
0082                   const char *name, void *data)
0083 {
0084         pritnf("Found libtraceevent plugin %s/%s\n", path, name);
0085 }
0086 ...
0087 tep_load_plugins_hook(tep, ".so", print_plugin, NULL);
0088 ...
0089 --
0090 
0091 FILES
0092 -----
0093 [verse]
0094 --
0095 *event-parse.h*
0096         Header file to include in order to have access to the library APIs.
0097 *-ltraceevent*
0098         Linker switch to add when building a program that uses the library.
0099 --
0100 
0101 SEE ALSO
0102 --------
0103 _libtraceevent(3)_, _trace-cmd(1)_, _tep_set_flag(3)_
0104 
0105 AUTHOR
0106 ------
0107 [verse]
0108 --
0109 *Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
0110 *Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
0111 --
0112 REPORTING BUGS
0113 --------------
0114 Report bugs to  <linux-trace-devel@vger.kernel.org>
0115 
0116 LICENSE
0117 -------
0118 libtraceevent is Free Software licensed under the GNU LGPL 2.1
0119 
0120 RESOURCES
0121 ---------
0122 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git