151 lines
5.0 KiB
Plaintext
151 lines
5.0 KiB
Plaintext
libtraceevent(3)
|
|
================
|
|
|
|
NAME
|
|
----
|
|
tep_load_plugins, tep_unload_plugins, tep_load_plugins_hook, tep_add_plugin_path,
|
|
tep_plugin_add_option - Load / unload traceevent plugins.
|
|
|
|
SYNOPSIS
|
|
--------
|
|
[verse]
|
|
--
|
|
*#include <event-parse.h>*
|
|
|
|
struct tep_plugin_list pass:[*]*tep_load_plugins*(struct tep_handle pass:[*]_tep_);
|
|
void *tep_unload_plugins*(struct tep_plugin_list pass:[*]_plugin_list_, struct tep_handle pass:[*]_tep_);
|
|
void *tep_load_plugins_hook*(struct tep_handle pass:[*]_tep_, const char pass:[*]_suffix_,
|
|
void (pass:[*]_load_plugin_)(struct tep_handle pass:[*]tep,
|
|
const char pass:[*]path,
|
|
const char pass:[*]name,
|
|
void pass:[*]data),
|
|
void pass:[*]_data_);
|
|
int *tep_add_plugin_path*(struct tep_handle pass:[*]tep, char pass:[*]path,
|
|
enum tep_plugin_load_priority prio);
|
|
int *tep_plugin_add_option*(const char pass:[*]_name_, const char pass:[*]_val_);
|
|
--
|
|
|
|
DESCRIPTION
|
|
-----------
|
|
The *tep_load_plugins()* function loads all plugins, located in the plugin
|
|
directories. The _tep_ argument is trace event parser context.
|
|
The plugin directories are :
|
|
[verse]
|
|
--
|
|
- Directories, specified in _tep_->plugins_dir with priority TEP_PLUGIN_FIRST
|
|
- System's plugin directory, defined at the library compile time. It
|
|
depends on the library installation prefix and usually is
|
|
_(install_preffix)/lib/traceevent/plugins_
|
|
- Directory, defined by the environment variable _TRACEEVENT_PLUGIN_DIR_
|
|
- User's plugin directory, located at _~/.local/lib/traceevent/plugins_
|
|
- Directories, specified in _tep_->plugins_dir with priority TEP_PLUGIN_LAST
|
|
--
|
|
Loading of plugins can be controlled by the _tep_flags_, using the
|
|
*tep_set_flag()* API:
|
|
[verse]
|
|
--
|
|
_TEP_DISABLE_SYS_PLUGINS_ - do not load plugins, located in
|
|
the system's plugin directory.
|
|
_TEP_DISABLE_PLUGINS_ - do not load any plugins.
|
|
--
|
|
The *tep_set_flag()* API needs to be called before *tep_load_plugins()*, if
|
|
loading of all plugins is not the desired case.
|
|
|
|
The *tep_unload_plugins()* function unloads the plugins, previously loaded by
|
|
*tep_load_plugins()*. The _tep_ argument is trace event parser context. The
|
|
_plugin_list_ is the list of loaded plugins, returned by
|
|
the *tep_load_plugins()* function.
|
|
|
|
The *tep_load_plugins_hook()* function walks through all directories with plugins
|
|
and calls user specified *load_plugin()* hook for each plugin file. Only files
|
|
with given _suffix_ are considered to be plugins. The _data_ is a user specified
|
|
context, passed to *load_plugin()*. Directories and the walk order are the same
|
|
as in *tep_load_plugins()* API.
|
|
|
|
The *tep_add_plugin_path()* functions adds additional directories with plugins in
|
|
the _tep_->plugins_dir list. It must be called before *tep_load_plugins()* in order
|
|
for the plugins from the new directories to be loaded. The _tep_ argument is
|
|
the trace event parser context. The _path_ is the full path to the new plugin
|
|
directory. The _prio_ argument specifies the loading priority order for the
|
|
new directory of plugins. The loading priority is important in case of different
|
|
versions of the same plugin located in multiple plugin directories.The last loaded
|
|
plugin wins. The priority can be:
|
|
[verse]
|
|
--
|
|
_TEP_PLUGIN_FIRST_ - Load plugins from this directory first
|
|
_TEP_PLUGIN_LAST_ - Load plugins from this directory last
|
|
--
|
|
Where the plugins in TEP_PLUGIN_LAST" will take precedence over the
|
|
plugins in the other directories.
|
|
|
|
The *tep_plugin_add_option()* sets options defined by a plugin. The _name_ is the
|
|
name of the option to set to _val_. Plugins can add options to change its behavior
|
|
and *tep_plugin_add_option()* is used by the application to make those modifications.
|
|
|
|
|
|
RETURN VALUE
|
|
------------
|
|
The *tep_load_plugins()* function returns a list of successfully loaded plugins,
|
|
or NULL in case no plugins are loaded.
|
|
The *tep_add_plugin_path()* function returns -1 in case of an error, 0 otherwise.
|
|
|
|
EXAMPLE
|
|
-------
|
|
[source,c]
|
|
--
|
|
#include <event-parse.h>
|
|
...
|
|
struct tep_handle *tep = tep_alloc();
|
|
...
|
|
tep_add_plugin_path(tep, "~/dev_plugins", TEP_PLUGIN_LAST);
|
|
...
|
|
struct tep_plugin_list *plugins = tep_load_plugins(tep);
|
|
if (plugins == NULL) {
|
|
/* no plugins are loaded */
|
|
}
|
|
...
|
|
tep_unload_plugins(plugins, tep);
|
|
...
|
|
void print_plugin(struct tep_handle *tep, const char *path,
|
|
const char *name, void *data)
|
|
{
|
|
pritnf("Found libtraceevent plugin %s/%s\n", path, name);
|
|
}
|
|
...
|
|
tep_load_plugins_hook(tep, ".so", print_plugin, NULL);
|
|
...
|
|
--
|
|
|
|
FILES
|
|
-----
|
|
[verse]
|
|
--
|
|
*event-parse.h*
|
|
Header file to include in order to have access to the library APIs.
|
|
*-ltraceevent*
|
|
Linker switch to add when building a program that uses the library.
|
|
--
|
|
|
|
SEE ALSO
|
|
--------
|
|
*libtraceevent*(3), *trace-cmd*(1), *tep_set_flag*(3)
|
|
|
|
AUTHOR
|
|
------
|
|
[verse]
|
|
--
|
|
*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
|
|
*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
|
|
--
|
|
REPORTING BUGS
|
|
--------------
|
|
Report bugs to <linux-trace-devel@vger.kernel.org>
|
|
|
|
LICENSE
|
|
-------
|
|
libtraceevent is Free Software licensed under the GNU LGPL 2.1
|
|
|
|
RESOURCES
|
|
---------
|
|
https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
|