From patchwork Tue Sep 29 17:36:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 11806413 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B6124112C for ; Tue, 29 Sep 2020 17:36:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8ADB32076A for ; Tue, 29 Sep 2020 17:36:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PgkQvlXi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727879AbgI2Rgf (ORCPT ); Tue, 29 Sep 2020 13:36:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727328AbgI2Rgf (ORCPT ); Tue, 29 Sep 2020 13:36:35 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51593C061755; Tue, 29 Sep 2020 10:36:35 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id v12so5680241wmh.3; Tue, 29 Sep 2020 10:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DD7DzH+1uZHiL1ja2Xj2Qul/zGwrkIhGowK81J16h9k=; b=PgkQvlXipDTpEnANT7Tzruij6z1vuJcMUPyUPhnqrDkQq9qvG1xRADMjx+7bxlOLuh oWRMOek/8yZ5FTzOVm2++La1fyr+YcTuWX6pV9jRu6ilFXZYKdnUo7IJ9T+RAYQlxIbB 3/I++f8hN+IhofkBp7YhXsX2wrcc1I+fHdJoScCtX6jzdWEgMnQnQ0AZO2ZSmMUWKl0b COeDzsPR4p2NXhQ4+wDfvvODbCqiSvEm/Wh/9ilF3gmQHB916Db3gsLr0e94AW1VJdLd UNkmW8Nk/0oxLBp77Ir1dqY6qO/KZvqhQxO3Kip2yVKcm6IyNxD7dZ5T9olBVH0kA9cO Ymgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DD7DzH+1uZHiL1ja2Xj2Qul/zGwrkIhGowK81J16h9k=; b=TDTH2k8JegIQIe4j0tfsUja+JuXWp7FxfoYhC9zifWD5utHSKZPIy+lrZjiHzpVf+a QYS7OhxfWaW1eoyAxN0WiRl+OeVfGdCPi6Hz+bHBiNhnpCB78NdsHtuj4+j2BhkVwgjb U+kKqykneEZAxAc5P0KY6xMwhoTq/1ujMzaIR4n/Odfr1garmk6IeXcMOGhGPQJHsqCO 5MfrGb+9il7pYmxXxhjPbiIZCE+Aj11GAANICyBdOyxV8bzju1HVhcmmd2pBx25RtSHa QQQYxtTO8LcShYT4JDGX6VENHPa5W0EjGDqs99PFjB6oEP2Qe9QpwbN3vWSApaZ8nkq6 VBjw== X-Gm-Message-State: AOAM533ElSz8jAkQunqHXcDv4HD2EBrLOR91/9uTXiUMfGBfxBT/VLju /JmUuUkWM0DTmaAOXt7XE9dYjI2bhSMaJBG+ X-Google-Smtp-Source: ABdhPJxznl1PXXAp2qD2o7ffI3O+KjVr+g0JtxlqvyMvGFJZU2zOaGBrg/RDhOs5wcOR6pa0RjYKmg== X-Received: by 2002:a1c:2c0a:: with SMTP id s10mr5762516wms.103.1601400994002; Tue, 29 Sep 2020 10:36:34 -0700 (PDT) Received: from oberon.zico.biz ([83.222.187.186]) by smtp.gmail.com with ESMTPSA id q20sm6197394wmj.5.2020.09.29.10.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:36:33 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: arnaldo.melo@gmail.com Cc: rostedt@goodmis.org, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] tools lib traceevent: Man page for tep_add_plugin_path() API Date: Tue, 29 Sep 2020 20:36:32 +0300 Message-Id: <20200929173632.252076-1-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Add documentation of tep_add_plugin_path() API in the libtraceevent plugin man page. Signed-off-by: Tzvetomir Stoyanov (VMware) --- .../Documentation/libtraceevent-plugins.txt | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tools/lib/traceevent/Documentation/libtraceevent-plugins.txt b/tools/lib/traceevent/Documentation/libtraceevent-plugins.txt index 4d6394397d92..e584b8c777ad 100644 --- a/tools/lib/traceevent/Documentation/libtraceevent-plugins.txt +++ b/tools/lib/traceevent/Documentation/libtraceevent-plugins.txt @@ -3,7 +3,7 @@ libtraceevent(3) NAME ---- -tep_load_plugins, tep_unload_plugins, tep_load_plugins_hook - Load / unload traceevent plugins. +tep_load_plugins, tep_unload_plugins, tep_load_plugins_hook, tep_add_plugin_path - Load / unload traceevent plugins. SYNOPSIS -------- @@ -19,6 +19,8 @@ void *tep_load_plugins_hook*(struct tep_handle pass:[*]_tep_, const char pass:[* 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); -- DESCRIPTION @@ -52,16 +54,30 @@ _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 +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 +the plugins from the new directories to be loaded. The _tep_ argument is trace event +parser context. The _path_ is the full path to the new plugin directory. The _prio_ +argument specifies the loading priority of plugins from the new directory. 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 +-- + 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 ------- @@ -71,6 +87,8 @@ EXAMPLE ... 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 */ From patchwork Tue Sep 29 17:36:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 11806415 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 790F9618 for ; Tue, 29 Sep 2020 17:36:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 547DF2076A for ; Tue, 29 Sep 2020 17:36:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lamdBrN+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727328AbgI2Rgt (ORCPT ); Tue, 29 Sep 2020 13:36:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725554AbgI2Rgt (ORCPT ); Tue, 29 Sep 2020 13:36:49 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52E56C061755; Tue, 29 Sep 2020 10:36:49 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id c18so6335069wrm.9; Tue, 29 Sep 2020 10:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=w90kD4riP0Fuf2IH9074v4Qu8q9n8nKw3Ed4EsETaIs=; b=lamdBrN+/ud0H6jv/YrRe61BDdQrbbbu5KF25h4zCNY6Qcopz/vs1rEHFawcceNf2D 7oXW3oD76OLS9F2TGNMjEp60ZC+cfhiW6+aR0stjkyb7NTsz1/wH+yNr7mXZ11sk/++I O1PfRRQhlBm9iPx7kydLwLsHSbvDA7VJmQ8e5JQmoZu3kCoV8kfo0YHy2QjxluxUrVhK OptKczWQKzELCMFsqMmdASOXmUOWp6O8IpnEw3CwqyI8w4aX8R2uzldxJAqEsinq1ynU kAU9RltA1J33mZhyRB5aCSF2HkXsfUX4fyF4UlqYFc8AadXCjL5OH8kndJs9OS4m+pK8 Mcjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=w90kD4riP0Fuf2IH9074v4Qu8q9n8nKw3Ed4EsETaIs=; b=UUnUXIz4dAwfu2oFbTv/vlA48ZftrXUmIOJ9J1i3VYB1FiYTgOQpTv55Ke5VoKi/JH jakuWa1xNltX/RaPnoH46YGgW60kAwKJARXHQZHkAkiiM7nPagPaWc/EFUu0IqkVgbw+ EIKV/pyy+JCTMqFG1yi3q6fTzjVU+UMpB7Vbm0QpFBe6JAldLFTX2ci9oSJ02/fNWG1P 88M0trRxZqY3bkGHVCu3GiHGZHPAjz96WJ5Pf6s4kN8U2LSBaMDR8A11qgqwtTrS+pja 5/PW3Wz0B7vIv+TW03ME98W4ICpdhw0I/UxIgPjQ9m6/YRSvzz/O1DyA9KbdPxlxQdJF XjvA== X-Gm-Message-State: AOAM532lXUamS6xokLW5zMvpDUYttbAUIBLWwDqabhAHjjmPf5ocHtGz ITtkOZXkA66vuSLlnahMAu6XeIn3bGHw6unB X-Google-Smtp-Source: ABdhPJxMFj1e/9H64nWtgJoqJN+fK8Ka4MfP3dN+OO0impoEun9+Y76Dtd6SU7Ad+q6BO/31lSUzZw== X-Received: by 2002:adf:f6c2:: with SMTP id y2mr5489885wrp.79.1601401007937; Tue, 29 Sep 2020 10:36:47 -0700 (PDT) Received: from oberon.zico.biz ([83.222.187.186]) by smtp.gmail.com with ESMTPSA id x16sm7070548wrq.62.2020.09.29.10.36.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:36:47 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: arnaldo.melo@gmail.com Cc: rostedt@goodmis.org, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] tools lib traceevent: Man page libtraceevent debug APIs Date: Tue, 29 Sep 2020 20:36:46 +0300 Message-Id: <20200929173646.252163-1-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Add a new libtraceevent man page with documentation of these debug APIs: tep_print_printk tep_print_funcs tep_set_test_filters tep_plugin_print_options Signed-off-by: Tzvetomir Stoyanov (VMware) Reviewed-by: Steven Rostedt (VMware) --- .../Documentation/libtraceevent-debug.txt | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 tools/lib/traceevent/Documentation/libtraceevent-debug.txt diff --git a/tools/lib/traceevent/Documentation/libtraceevent-debug.txt b/tools/lib/traceevent/Documentation/libtraceevent-debug.txt new file mode 100644 index 000000000000..9a2d1ffa2d72 --- /dev/null +++ b/tools/lib/traceevent/Documentation/libtraceevent-debug.txt @@ -0,0 +1,95 @@ +libtraceevent(3) +================ + +NAME +---- +tep_print_printk, tep_print_funcs, tep_set_test_filters, tep_plugin_print_options - +Print libtraceevent internal information. + +SYNOPSIS +-------- +[verse] +-- +*#include * +*#include * + +void *tep_print_printk*(struct tep_handle pass:[*]tep); +void *tep_print_funcs*(struct tep_handle pass:[*]tep); +void *tep_set_test_filters*(struct tep_handle pass:[*]tep, int test_filters); +void *tep_plugin_print_options*(struct trace_seq pass:[*]s); +-- + +DESCRIPTION +----------- +The _tep_print_printk()_ function prints the printk string formats that were +stored for this tracing session. The _tep_ argument is trace event parser context. + +The _tep_print_funcs()_ function prints the stored function name to address mapping +for this tracing session. The _tep_ argument is trace event parser context. + +The _tep_set_test_filters()_ function sets a flag to test a filter string. If this +flag is set, when _tep_filter_add_filter_str()_ API as called, it will print the filter +string instead of adding it. The _tep_ argument is trace event parser context. +The _test_filters_ argument is the test flag that will be set. + +The _tep_plugin_print_options()_ function writes a list of the registered plugin options +into _s_. + +EXAMPLE +------- +[source,c] +-- +#include +#include +... +struct tep_handle *tep = tep_alloc(); +... + tep_print_printk(tep); +... + tep_print_funcs(tep); +... +struct tep_event_filter *filter = tep_filter_alloc(tep); + tep_set_test_filters(tep, 1); + tep_filter_add_filter_str(filter, "sche d/sched_wakeup:target_cpu==1"); + tep_set_test_filters(tep, 0); + tep_filter_free(filter); +... +struct trace_seq seq; +trace_seq_init(&seq); + + tep_plugin_print_options(&s); +... +-- + +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)_ + +AUTHOR +------ +[verse] +-- +*Steven Rostedt* , author of *libtraceevent*. +*Tzvetomir Stoyanov* , author of this man page. +-- +REPORTING BUGS +-------------- +Report bugs to + +LICENSE +------- +libtraceevent is Free Software licensed under the GNU LGPL 2.1 + +RESOURCES +--------- +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git