From patchwork Wed Sep 30 11:20:23 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: 11808839 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 6B8E3112E for ; Wed, 30 Sep 2020 11:20:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4C58C20708 for ; Wed, 30 Sep 2020 11:20:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DL+OOTzW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729285AbgI3LU2 (ORCPT ); Wed, 30 Sep 2020 07:20:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729268AbgI3LU1 (ORCPT ); Wed, 30 Sep 2020 07:20:27 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C6AEC061755; Wed, 30 Sep 2020 04:20:27 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id e2so1330243wme.1; Wed, 30 Sep 2020 04:20:27 -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=FHqS4T2vGgN4ivt95AoBTsDaPfnjn41/2ahIzPZ2LPg=; b=DL+OOTzWysHURoloxs3LkplMURrusLwQkaocQ3+iV6I7ytApFrLd412iAvdWUiD/XT ibbltAMMIYIqUwjtL7FShLkfh2qjFSW8eMV1SedB0gbWwOpwBehMoaUb8rnio2Ej5TyY kCjEA4oamvfOzg6wzFpevxxXBQua2i9S4OgPedtRMEBVNNH0CW/14sVrcgi3wvu66yKu jHKsCT9/RMk21fzj9FX8byD4dODC7nhI0rJ/GEB5tLqlXSFziybW5p29ApSwAGvKLhZB hMFF1DlGhFzCFnioxElyQOkYIbOaWKQTXn5PYR0Oxqiw5TsvPLKK5C1yE0ZHAcKcEBS3 2MDA== 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=FHqS4T2vGgN4ivt95AoBTsDaPfnjn41/2ahIzPZ2LPg=; b=QCIPvd6BCmXYBT5Rp2jD5SCJXhfZkF5pYegBU2SKPC8nEBtb49NhXLrYRcdW4Sf8FX MNRSTzn50AydOCNRTmA9/bYBHWBJBiT2EJS1tVouq3YBaDgym28OEVd7wlfbYwWvWC36 JnRer1AnHf2cbp/iobUeVc/A9pHPA6M8c0YVeC7PtlejyyxJn7wxcS7L8tQypmGoXaBT LATTPybwihraS/FG4MZ3HKVnA0eH/pphYFiT9ET6KsutpWvXkchmSiO5HL4XYF+7SpPg vXjAJvmXBD5l2Nig2JuHLtHNWKO0byCZONBm8vvi++CBZxBtGl4P5KrxKgiHd3U094F/ ggyw== X-Gm-Message-State: AOAM531VRn3gLzZBExD6RZQPM40F4Jz5PynhMFazXZKTMsukbeqJB9+f kw34OYZWLdqbFBbNVnXYUZs= X-Google-Smtp-Source: ABdhPJw6unAiTppXW1wLC3ZYUCQMnPg0I0+3kVB6mW4b5fmm8JAHgoZ7OarBMUqFneta+sHOx1K9cA== X-Received: by 2002:a05:600c:22cf:: with SMTP id 15mr2487729wmg.146.1601464826096; Wed, 30 Sep 2020 04:20:26 -0700 (PDT) Received: from oberon.zico.biz ([83.222.187.186]) by smtp.gmail.com with ESMTPSA id i16sm2387553wrq.73.2020.09.30.04.20.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 04:20:25 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: arnaldo.melo@gmail.com Cc: rostedt@goodmis.org, mtk.manpages@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] tools lib traceevent: Man page for tep_add_plugin_path() API Date: Wed, 30 Sep 2020 14:20:23 +0300 Message-Id: <20200930112023.281975-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) --- v2 changes: - Fixed grammar mistakes, found by Steven Rostedt. .../Documentation/libtraceevent-plugins.txt | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/tools/lib/traceevent/Documentation/libtraceevent-plugins.txt b/tools/lib/traceevent/Documentation/libtraceevent-plugins.txt index 4d6394397d92..4b7ac5c5217b 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,33 @@ _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 +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. + 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 +90,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 Wed Sep 30 11:20:35 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: 11808841 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 2CABF6CA for ; Wed, 30 Sep 2020 11:20:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F378120709 for ; Wed, 30 Sep 2020 11:20:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MvLdxP7q" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729322AbgI3LUj (ORCPT ); Wed, 30 Sep 2020 07:20:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729268AbgI3LUj (ORCPT ); Wed, 30 Sep 2020 07:20:39 -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 E1E1FC061755; Wed, 30 Sep 2020 04:20:38 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id e16so1364916wrm.2; Wed, 30 Sep 2020 04:20:38 -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=aWakhOKPKz2znU9O5s7AkKsRQAEAed3GLRNCcxW+1kw=; b=MvLdxP7qR07tHcwn/U9tovrPst13k0lc4hWyk0Zadwzu11NUatr5+T2KdXMqg66zsF 2Ob9GvxRo2dUuGEnoOQVAzgRaHP6OJCAOaZGFwzgT1h2dEzonad/ac7MwuR8n8Xp16v3 DAcPiZn+RxTfwG/4llBL5s8Mk/M5Ttzp9UYdzTYVPtGHPsGdRwOKYRHrMCFF0L6M5Y8U D6YSXAcRi7IF6Y/5J8MGe6PE9Fy7vo9S4Gm1GCf3r7U6nt/Y9V6rzvAsxX9yxAyuZZR8 rV/P9tB5iGhndalpDI8lp1jmDWgrfoP6nE93Egf8mePpqilJI0X51NtvWg6ktbI8RhRh 7ntg== 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=aWakhOKPKz2znU9O5s7AkKsRQAEAed3GLRNCcxW+1kw=; b=XnSlKl/nbc+TRvcKA/jGkepTkHHOW1QUkArETzW1EG5b1VImo7bB+2qtBcXq5IjCE9 zK7WBucrA8x4zoqioKkpNxR090zKC1387In84CygRTENs7Xtdy5gjK+fyRB5I1fnJ4lj QXjh98sdEKuUByCuJHsOzzQBKinaR00kEkLdi/BG1QbieOijFBU5xYxI6UzdL07NRYTe W4047iCMtJACyGcUAtJaiJjuCj/iAJrMX4JZt4Gyi4WvwbRhWKpFCRhXK6vFnCfJ3I4P Hcv9/rz7DvFeEKuN+ZEY3TcV/QU3e4sAik+J0XQsg8WZ6+VFKqlruEY9Iel1uGiyDZPq 8JYg== X-Gm-Message-State: AOAM530BgD9zSD8bJwHKlotTZnSH6SbwZ+ZdiNQFzgCiVKGbGBjZgmnB IrkGN3pUezNszgCOhDviq/g= X-Google-Smtp-Source: ABdhPJxWbuEkKLpDBnEhzMLnI+C16F+pwjR4st/g8a0IWVUiWgawaAI/yqL9f57WMcejjFi/kFzqtg== X-Received: by 2002:a5d:40c4:: with SMTP id b4mr2583546wrq.151.1601464837599; Wed, 30 Sep 2020 04:20:37 -0700 (PDT) Received: from oberon.zico.biz ([83.222.187.186]) by smtp.gmail.com with ESMTPSA id k6sm2195594wmf.30.2020.09.30.04.20.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 04:20:36 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: arnaldo.melo@gmail.com Cc: rostedt@goodmis.org, mtk.manpages@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] tools lib traceevent: Man page libtraceevent debug APIs Date: Wed, 30 Sep 2020 14:20:35 +0300 Message-Id: <20200930112035.282039-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) --- v2 changes: - Removed an extra interval from the example's code. .../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..a0be84fe8990 --- /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, "sched/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