From patchwork Thu Dec 17 09:46:18 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: 11979435 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1761C2BB48 for ; Thu, 17 Dec 2020 09:47:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9917523603 for ; Thu, 17 Dec 2020 09:47:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727382AbgLQJrN (ORCPT ); Thu, 17 Dec 2020 04:47:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727767AbgLQJrL (ORCPT ); Thu, 17 Dec 2020 04:47:11 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1F2AC061248 for ; Thu, 17 Dec 2020 01:46:30 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id a12so25864776wrv.8 for ; Thu, 17 Dec 2020 01:46:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M42Oik9qEiGU0kYEVyRqw70B360ZmiwtGKtLv1o1IG4=; b=XQgPOvAcwjw4rf+ZzQiVjK3HuL6A3igHIl8Jsxsl52nzCSrv2DGHhenV2klpASGpNs VJJMAwZIxTcKiMoGhFFCikGFLIUj7tYRwx+qRQ2qRL1mLWTUuhmvOIcsTVRIsX78QEGM zRrBR5k+U8KnPq3FMC9E4hmOnN4Aj5kKSt7OTMxkV7UZ6jeHZh18KvCtklbyXpLIMk9Q Q+wu+UVFnfKkfSRScPbUfTe1ygB745x7i/5Df+JMK5HJrY1tBFDMSxxewufWysL4ufrr eZMYmlwmXvZeZF+BF6W7eDUvEq/HynmewntkmfNZuP2P5vWqJhTlCIfY10TKH8EwB2IX cIsA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=M42Oik9qEiGU0kYEVyRqw70B360ZmiwtGKtLv1o1IG4=; b=AW2zr76FeZcu2JJoZGOpXwoF6iQREM0hFzOgiGoGtbenBsm5fSZ7Rfbuzgr4PrGHpn Fg8fnPXjPujczZONR2Jrxu+6vF3TMyyhENJgJIwjUGTv2dz6DmejH2tHDC3vp73Okb2+ kxxLkPO+EdM6GOAC1tL/gPHn7/1qnJoQw/VcC3CJgWKIyGjHQWv88rDhPloMykq26hI6 J1DXx2OjK69oM/jBnIoJx83avOrE7qOBxm+4oIpmBdK1A/BgbeP3dYCy3pFGn57kC2kt MQeb6if3u2aoNS7ahsWyRjnT3xAdINkp7avsseGVc3FnykdYgXJ0s1HUxkIAfNzvBBU1 0ygg== X-Gm-Message-State: AOAM532lLlhFmg8rt3lHikuxj/7Meo/0DaENpiE/gVjPYtXs4KsEVW6L LOHX+aT6k8SB4NbuaxVsehM= X-Google-Smtp-Source: ABdhPJyVC4sF5iREmtXVwnW3bAWZyFRZmqKskGKOXZeSNGUjRYvxyW0wj33aS5YtYvG3P3HBNGM+2A== X-Received: by 2002:a5d:6a4f:: with SMTP id t15mr11705237wrw.62.1608198389616; Thu, 17 Dec 2020 01:46:29 -0800 (PST) Received: from oberon.zico.biz ([83.222.187.186]) by smtp.gmail.com with ESMTPSA id o125sm6773164wmo.30.2020.12.17.01.46.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 01:46:29 -0800 (PST) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 1/9] libtracefs: Remove doc_gui targets Date: Thu, 17 Dec 2020 11:46:18 +0200 Message-Id: <20201217094626.1402191-2-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201217094626.1402191-1-tz.stoyanov@gmail.com> References: <20201217094626.1402191-1-tz.stoyanov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org There is no gui in libtracefs, removed forgotten targets for building gui documentation. Signed-off-by: Tzvetomir Stoyanov (VMware) --- Makefile | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Makefile b/Makefile index a7d5808..7460d4d 100644 --- a/Makefile +++ b/Makefile @@ -255,19 +255,10 @@ install_pkgconfig: $(PKG_CONFIG_FILE) doc: $(MAKE) -C $(src)/Documentation all -doc_gui: - $(MAKE) -C $(kshark-dir)/Documentation all - - doc_clean: $(MAKE) -C $(src)/Documentation clean -doc_gui_clean: - $(MAKE) -C $(kshark-dir)/Documentation clean - install_doc: $(MAKE) -C $(src)/Documentation install -install_doc_gui: - $(MAKE) -C $(kshark-dir)/Documentation install define build_uninstall_script $(Q)mkdir $(BUILD_OUTPUT)/tmp_build From patchwork Thu Dec 17 09:46:19 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: 11979447 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CC5BC2BB40 for ; Thu, 17 Dec 2020 09:47:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C21472360D for ; Thu, 17 Dec 2020 09:47:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727767AbgLQJrN (ORCPT ); Thu, 17 Dec 2020 04:47:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727739AbgLQJrM (ORCPT ); Thu, 17 Dec 2020 04:47:12 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20DEFC061257 for ; Thu, 17 Dec 2020 01:46:32 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id 3so5100641wmg.4 for ; Thu, 17 Dec 2020 01:46:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VFdNetmN7ITxyWUYJyx0xsFQ+qKI6Dx3bamkH9fsy/Y=; b=Sd5JlK1IGnsM+/DKDTIuAQhwy44V7tSqc8+tkizAHtvVJR1h3AOSqsXiskpTLXtFl8 6g33xCE4icDsyl17yQyztnq3REMo/Hp8o+nSUQXM6/8jy5a9XOvwN0p6rUip6w30IXVz Gb1WsdQc6yrcxW7liF+SX5DoRThhnHZggQM7HAB/fgGGv3jhuUfSBMnLpUMyeLdjEycf HTK4VBQpiohTkrySczkd13eGSzoqxcJ+tH0ydtr8HOqSSHO8hIoCSkrR4xQ9rnqQK3tZ Snmddab8mc4cTB/GDc26yX45J5EINI+v0NrFZzbeOHVF8xp66sRtrpPoRuw9upLIqbk2 pS7w== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=VFdNetmN7ITxyWUYJyx0xsFQ+qKI6Dx3bamkH9fsy/Y=; b=gM7IMEjjkqFkhgElFmmM66NYFnpIV5EX6UD2uNIVONqLUfKU0S6bcAZDgcQwQNN92C KxJohMnoDXojd6uzgWhT24nV4pYvZO6vho8ucLfYaZkRsT0aqXRHENYH1ux/5mzFRJmH gW/cehr/AJrk5AQKAiAxy/nhPUgSS8fXAabkAA0kMQNL1o+npmSmUyz6PqeDKMDGs2t9 rUdWQr4bf/otHW0phuYVS4S4rk/cgs/Sl9LvKH3ZFsvxHtl//nsUAmP3JlNUz2PTzsWA x7JqyUwrIOpHifcfInDWPTF8G+VNfI81xeoOpLrjc2Iydfg3u6yAO19z3U+TN4QZ4E7z yQ/g== X-Gm-Message-State: AOAM532yHydTHobJz6SXSlwFG3uwpVI4K7BgyEAS1Xgz4oJ+yUUCyIML wBxGUkfcDx5skECbO69hIqM= X-Google-Smtp-Source: ABdhPJwvNU6d7W4/NoiqV6uCbR+5O7H8XPb0tQM/wBsK8TQjCNSPBulV6EkFERKSqFx9Gxw/sID6tQ== X-Received: by 2002:a1c:4e0a:: with SMTP id g10mr7544727wmh.88.1608198390751; Thu, 17 Dec 2020 01:46:30 -0800 (PST) Received: from oberon.zico.biz ([83.222.187.186]) by smtp.gmail.com with ESMTPSA id o125sm6773164wmo.30.2020.12.17.01.46.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 01:46:30 -0800 (PST) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 2/9] libtracefs: Initial support for man pages Date: Thu, 17 Dec 2020 11:46:19 +0200 Message-Id: <20201217094626.1402191-3-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201217094626.1402191-1-tz.stoyanov@gmail.com> References: <20201217094626.1402191-1-tz.stoyanov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Basic infrastructure for libtracefs man pages and the first man page: man libtracefs with list of all library APIs. Signed-off-by: Tzvetomir Stoyanov (VMware) --- Documentation/Makefile | 211 +++++++++++++++++++++++++ Documentation/asciidoc.conf | 120 ++++++++++++++ Documentation/libtracefs.txt | 86 ++++++++++ Documentation/manpage-1.72.xsl | 14 ++ Documentation/manpage-base.xsl | 35 ++++ Documentation/manpage-bold-literal.xsl | 17 ++ Documentation/manpage-normal.xsl | 13 ++ Documentation/manpage-suppress-sp.xsl | 21 +++ 8 files changed, 517 insertions(+) create mode 100644 Documentation/Makefile create mode 100644 Documentation/asciidoc.conf create mode 100644 Documentation/libtracefs.txt create mode 100644 Documentation/manpage-1.72.xsl create mode 100644 Documentation/manpage-base.xsl create mode 100644 Documentation/manpage-bold-literal.xsl create mode 100644 Documentation/manpage-normal.xsl create mode 100644 Documentation/manpage-suppress-sp.xsl diff --git a/Documentation/Makefile b/Documentation/Makefile new file mode 100644 index 0000000..e9212df --- /dev/null +++ b/Documentation/Makefile @@ -0,0 +1,211 @@ +# SPDX-License-Identifier: LGPL-2.1 + +include $(src)/scripts/utils.mk + + +# This Makefile and manpage XSL files were taken from libtraceevent +# and modified for libtracefs. + +MAN3_TXT= \ + $(wildcard libtracefs-*.txt) \ + libtracefs.txt + +MAN_TXT = $(MAN3_TXT) +_MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT)) +_MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT)) +_DOC_MAN3=$(patsubst %.txt,%.3,$(MAN3_TXT)) + +MAN_XML=$(addprefix $(OUTPUT),$(_MAN_XML)) +MAN_HTML=$(addprefix $(OUTPUT),$(_MAN_HTML)) +DOC_MAN3=$(addprefix $(OUTPUT),$(_DOC_MAN3)) + +# Make the path relative to DESTDIR, not prefix +ifndef DESTDIR +prefix?=$(HOME) +endif +bindir?=$(prefix)/bin +htmldir?=$(prefix)/share/doc/libtracefs-doc +pdfdir?=$(prefix)/share/doc/libtracefs-doc +mandir?=$(prefix)/share/man +man3dir=$(mandir)/man3 + +ASCIIDOC=asciidoc +ASCIIDOC_EXTRA = --unsafe -f asciidoc.conf +ASCIIDOC_HTML = xhtml11 +MANPAGE_XSL = manpage-normal.xsl +XMLTO_EXTRA = +INSTALL?=install +RM ?= rm -f + +ifdef USE_ASCIIDOCTOR +ASCIIDOC = asciidoctor +ASCIIDOC_EXTRA = -a compat-mode +ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions +ASCIIDOC_EXTRA += -a mansource="libtracefs" -a manmanual="libtracefs Manual" +ASCIIDOC_HTML = xhtml5 +endif + +XMLTO=xmlto + +_tmp_tool_path := $(call get-executable,$(ASCIIDOC)) +ifeq ($(_tmp_tool_path),) + missing_tools = $(ASCIIDOC) +endif + +ifndef USE_ASCIIDOCTOR +_tmp_tool_path := $(call get-executable,$(XMLTO)) +ifeq ($(_tmp_tool_path),) + missing_tools += $(XMLTO) +endif +endif + +# +# For asciidoc ... +# -7.1.2, no extra settings are needed. +# 8.0-, set ASCIIDOC8. +# + +# +# For docbook-xsl ... +# -1.68.1, set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0) +# 1.69.0, no extra settings are needed? +# 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP? +# 1.71.1, no extra settings are needed? +# 1.72.0, set DOCBOOK_XSL_172. +# 1.73.0-, set ASCIIDOC_NO_ROFF +# + +# +# If you had been using DOCBOOK_XSL_172 in an attempt to get rid +# of 'the ".ft C" problem' in your generated manpages, and you +# instead ended up with weird characters around callouts, try +# using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8). +# + +ifdef ASCIIDOC8 +ASCIIDOC_EXTRA += -a asciidoc7compatible +endif +ifdef DOCBOOK_XSL_172 +ASCIIDOC_EXTRA += -a libtracefs-asciidoc-no-roff +MANPAGE_XSL = manpage-1.72.xsl +else + ifdef ASCIIDOC_NO_ROFF + # docbook-xsl after 1.72 needs the regular XSL, but will not + # pass-thru raw roff codes from asciidoc.conf, so turn them off. + ASCIIDOC_EXTRA += -a libtracefs-asciidoc-no-roff + endif +endif +ifdef MAN_BOLD_LITERAL +XMLTO_EXTRA += -m manpage-bold-literal.xsl +endif +ifdef DOCBOOK_SUPPRESS_SP +XMLTO_EXTRA += -m manpage-suppress-sp.xsl +endif + +SHELL_PATH ?= $(SHELL) +# Shell quote; +SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) + +DESTDIR ?= +DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))' + +export DESTDIR DESTDIR_SQ + +QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir +QUIET_SUBDIR1 = + +ifneq ($(findstring $(MAKEFLAGS),w),w) +PRINT_DIR = --no-print-directory +else # "make -w" +NO_SUBDIR = : +endif + +ifneq ($(findstring $(MAKEFLAGS),s),s) +ifneq ($(V),1) + QUIET_ASCIIDOC = @echo ' ASCIIDOC '$@; + QUIET_XMLTO = @echo ' XMLTO '$@; + QUIET_SUBDIR0 = +@subdir= + QUIET_SUBDIR1 = ;$(NO_SUBDIR) \ + echo ' SUBDIR ' $$subdir; \ + $(MAKE) $(PRINT_DIR) -C $$subdir + export V +endif +endif + +all: html man + +man: man3 +man3: $(DOC_MAN3) + +html: $(MAN_HTML) + +$(MAN_HTML) $(DOC_MAN3): asciidoc.conf + +install: install-man install-html + +check-man-tools: +ifdef missing_tools + $(error "You need to install $(missing_tools) for man pages") +endif + +do-install-man: man + $(call QUIET_INSTALL, Documentation-man) \ + $(INSTALL) -d -m 755 $(DESTDIR)$(man3dir); \ + $(INSTALL) -m 644 $(OUTPUT)*.3 $(DESTDIR)$(man3dir); + +install-man: check-man-tools man do-install-man + +do-install-html: html + $(call QUIET_INSTALL, Documentation-html) \ + $(INSTALL) -d -m 755 $(DESTDIR)$(htmldir); \ + $(INSTALL) -m 644 $(OUTPUT)*.html $(DESTDIR)$(htmldir); + +install-html: check-man-tools html do-install-html + +uninstall: uninstall-man uninstall-html + +uninstall-man: + $(call QUIET_UNINST, Documentation-man) \ + $(Q)$(RM) $(addprefix $(DESTDIR)$(man3dir)/,$(DOC_MAN3)) + +uninstall-html: + $(call QUIET_UNINST, Documentation-html) \ + $(Q)$(RM) $(addprefix $(DESTDIR)$(htmldir)/,$(MAN_HTML)) + +ifdef missing_tools + DO_INSTALL_MAN = $(warning Please install $(missing_tools) to have the man pages installed) +else + DO_INSTALL_MAN = do-install-man +endif + +CLEAN_FILES = \ + $(MAN_XML) $(addsuffix +,$(MAN_XML)) \ + $(MAN_HTML) $(addsuffix +,$(MAN_HTML)) \ + $(DOC_MAN3) *.3 + +clean: + $(call QUIET_CLEAN, Documentation) $(RM) $(CLEAN_FILES) + +ifdef USE_ASCIIDOCTOR +$(OUTPUT)%.3 : $(OUTPUT)%.txt + $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ + $(ASCIIDOC) -b manpage -d manpage \ + $(ASCIIDOC_EXTRA) -alibtraceevent_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \ + mv $@+ $@ +endif + +$(OUTPUT)%.3 : $(OUTPUT)%.xml + $(QUIET_XMLTO)$(RM) $@ && \ + $(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< + +$(OUTPUT)%.xml : %.txt + $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ + $(ASCIIDOC) -b docbook -d manpage \ + $(ASCIIDOC_EXTRA) -alibtraceevent_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \ + mv $@+ $@ + +$(MAN_HTML): $(OUTPUT)%.html : %.txt + $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ + $(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage \ + $(ASCIIDOC_EXTRA) -aperf_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \ + mv $@+ $@ diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf new file mode 100644 index 0000000..0759571 --- /dev/null +++ b/Documentation/asciidoc.conf @@ -0,0 +1,120 @@ +## linktep: macro +# +# Usage: linktep:command[manpage-section] +# +# Note, {0} is the manpage section, while {target} is the command. +# +# Show TEP link as: (
); if section is defined, else just show +# the command. + +[macros] +(?su)[\\]?(?Plinktep):(?P\S*?)\[(?P.*?)\]= + +[attributes] +asterisk=* +plus=+ +caret=^ +startsb=[ +endsb=] +tilde=~ + +ifdef::backend-docbook[] +[linktep-inlinemacro] +{0%{target}} +{0#} +{0#{target}{0}} +{0#} +endif::backend-docbook[] + +ifdef::backend-docbook[] +ifndef::tep-asciidoc-no-roff[] +# "unbreak" docbook-xsl v1.68 for manpages. v1.69 works with or without this. +# v1.72 breaks with this because it replaces dots not in roff requests. +[listingblock] +{title} + +ifdef::doctype-manpage[] + .ft C +endif::doctype-manpage[] +| +ifdef::doctype-manpage[] + .ft +endif::doctype-manpage[] + +{title#} +endif::tep-asciidoc-no-roff[] + +ifdef::tep-asciidoc-no-roff[] +ifdef::doctype-manpage[] +# The following two small workarounds insert a simple paragraph after screen +[listingblock] +{title} + +| + +{title#} + +[verseblock] +{title} +{title%} +{title#} +| + +{title#} +{title%} +endif::doctype-manpage[] +endif::tep-asciidoc-no-roff[] +endif::backend-docbook[] + +ifdef::doctype-manpage[] +ifdef::backend-docbook[] +[header] +template::[header-declarations] + + +{mantitle} +{manvolnum} +libtraceevent +{libtraceevent_version} +libtraceevent Manual + + + {manname1} + {manname2} + {manname3} + {manname4} + {manname5} + {manname6} + {manname7} + {manname8} + {manname9} + {manname10} + {manname11} + {manname12} + {manname13} + {manname14} + {manname15} + {manname16} + {manname17} + {manname18} + {manname19} + {manname20} + {manname21} + {manname22} + {manname23} + {manname24} + {manname25} + {manname26} + {manname27} + {manname28} + {manname29} + {manname30} + {manpurpose} + +endif::backend-docbook[] +endif::doctype-manpage[] + +ifdef::backend-xhtml11[] +[linktep-inlinemacro] +{target}{0?({0})} +endif::backend-xhtml11[] diff --git a/Documentation/libtracefs.txt b/Documentation/libtracefs.txt new file mode 100644 index 0000000..c7a4d54 --- /dev/null +++ b/Documentation/libtracefs.txt @@ -0,0 +1,86 @@ +libtracefs(3) +============= + +NAME +---- +libtracefs - Linux kernel trace file system library + +SYNOPSIS +-------- +[verse] +-- +*#include * +*#include * + +Locations of tracing files and directories: + char pass:[*]*tracefs_get_tracing_file*(const char pass:[*]_name_); + void *tracefs_put_tracing_file*(char pass:[*]_name_); + const char pass:[*]*tracefs_get_tracing_dir*(void); + char pass:[*]*tracefs_find_tracing_dir*(void); + +Trace instances: + struct tracefs_instance pass:[*]*tracefs_instance_create*(const char pass:[*]_name_); + int *tracefs_instance_destroy*(struct tracefs_instance pass:[*]_instance_); + void *tracefs_instance_free*(struct tracefs_instance pass:[*]_instance_); + bool *tracefs_instance_is_new*(struct tracefs_instance pass:[*]_instance_); + bool *tracefs_file_exists*(struct tracefs_instance pass:[*]_instance_, char pass:[*]_name_); + bool *tracefs_dir_exists*(struct tracefs_instance pass:[*]_instance_, char pass:[*]_name_); + char pass:[*]*tracefs_instance_get_file*(struct tracefs_instance pass:[*]_instance_, const char pass:[*]_file_); + char pass:[*]*tracefs_instance_get_dir*(struct tracefs_instance pass:[*]_instance_); + int *tracefs_instance_file_write*(struct tracefs_instance pass:[*]_instance_, const char pass:[*]_file_, const char pass:[*]_str_); + char pass:[*]*tracefs_instance_file_read*(struct tracefs_instance pass:[*]_instance_, char pass:[*]_file_, int pass:[*]_psize_); + const char pass:[*]*tracefs_instance_get_name*(struct tracefs_instance pass:[*]_instance_); + int *tracefs_instances_walk*(int (pass:[*]_callback_)(const char pass:[*], void pass:[*]), void pass:[*]_context)_; + bool *tracefs_instance_exists*(const char pass:[*]_name_); + +Trace events: + char pass:[*]pass:[*]*tracefs_event_systems*(const char pass:[*]_tracing_dir_); + char pass:[*]pass:[*]*tracefs_system_events*(const char pass:[*]_tracing_dir_, const char pass:[*]_system_); + int *tracefs_iterate_raw_events*(struct tep_handle pass:[*]_tep_, struct tracefs_instance pass:[*]_instance_, cpu_set_t pass:[*]_cpus_, int _cpu_size_, int (pass:[*]_callback_)(struct tep_event pass:[*], struct tep_record pass:[*], int, void pass:[*]), void pass:[*]_callback_context_); + struct tep_handle pass:[*]*tracefs_local_events*(const char pass:[*]_tracing_dir_); + struct tep_handle pass:[*]*tracefs_local_events_system*(const char pass:[*]_tracing_dir_, const char pass:[*] const pass:[*]_sys_names_); + int *tracefs_fill_local_events*(const char pass:[*]_tracing_dir_, struct tep_handle pass:[*]_tep_, int pass:[*]_parsing_failures_); + +Trace helper functions: + void *tracefs_list_free*(char pass:[*]pass:[*]_list_); + char pass:[*]pass:[*]*tracefs_tracers*(const char pass:[*]_tracing_dir_); + char pass:[*]*tracefs_get_clock*(struct tracefs_instance pass:[*]_instance_); +-- + +DESCRIPTION +----------- +The libtracefs(3) library provides APIs to access kernel trace file system. + +FILES +----- +[verse] +-- +*tracefs.h* + Header file to include in order to have access to the library APIs. +*-ltracefs* + Linker switch to add when building a program that uses the library. +-- + +SEE ALSO +-------- +_libtraceevent(3)_ +_trace-cmd(1)_ + +AUTHOR +------ +[verse] +-- +*Steven Rostedt* +*Tzvetomir Stoyanov* +-- +REPORTING BUGS +-------------- +Report bugs to + +LICENSE +------- +libtracefs is Free Software licensed under the GNU LGPL 2.1 + +RESOURCES +--------- +https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ \ No newline at end of file diff --git a/Documentation/manpage-1.72.xsl b/Documentation/manpage-1.72.xsl new file mode 100644 index 0000000..b4d315c --- /dev/null +++ b/Documentation/manpage-1.72.xsl @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/Documentation/manpage-base.xsl b/Documentation/manpage-base.xsl new file mode 100644 index 0000000..a264fa6 --- /dev/null +++ b/Documentation/manpage-base.xsl @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + sp + + + + + + + + br + + + diff --git a/Documentation/manpage-bold-literal.xsl b/Documentation/manpage-bold-literal.xsl new file mode 100644 index 0000000..608eb5d --- /dev/null +++ b/Documentation/manpage-bold-literal.xsl @@ -0,0 +1,17 @@ + + + + + + + fB + + + fR + + + diff --git a/Documentation/manpage-normal.xsl b/Documentation/manpage-normal.xsl new file mode 100644 index 0000000..a48f5b1 --- /dev/null +++ b/Documentation/manpage-normal.xsl @@ -0,0 +1,13 @@ + + + + + + +\ +. + + diff --git a/Documentation/manpage-suppress-sp.xsl b/Documentation/manpage-suppress-sp.xsl new file mode 100644 index 0000000..a63c763 --- /dev/null +++ b/Documentation/manpage-suppress-sp.xsl @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + From patchwork Thu Dec 17 09:46:20 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: 11979441 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 308B7C2BB9A for ; Thu, 17 Dec 2020 09:47:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F304A238E1 for ; Thu, 17 Dec 2020 09:47:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727739AbgLQJrO (ORCPT ); Thu, 17 Dec 2020 04:47:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727755AbgLQJrN (ORCPT ); Thu, 17 Dec 2020 04:47:13 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 304BDC0611C5 for ; Thu, 17 Dec 2020 01:46:33 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id g185so5109815wmf.3 for ; Thu, 17 Dec 2020 01:46:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=N48y4S6J5pzX7y2q8ngaSZvSJdDoFqsjVlLTD+/lKmc=; b=i7ugzBGGovHzrMIpXRpyrpdj+bVTj9h15d2lUQelOpPJwsE4tf7O8jKbLF4SUobKWS jPRRK3J9AlgzhmWkW3y2LUpEES2t1w7ATu7gK0dMyJuUGP5Vgv982XDvt31e03hft4Mx 7AAcyHQDmlp153DMVqlfXJ7CyVLqsLpLFf1ofIq5weSqEqKOKk2BQlCupQswuWrQybuR eOhPEvM1RoLdx991c8njCm+/tH6EuDrAJ49Ta/QL9eCyQdDId9NJ8GE6dZHjqcC3Mc71 AoDoM1+1S9+2hx3rcsEY8S5kOOm+1sPnz07bdh3N8Mu2eZ4vQrqoVKnkZbmQj8ZJQ14T bAEA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=N48y4S6J5pzX7y2q8ngaSZvSJdDoFqsjVlLTD+/lKmc=; b=Inlf0b8B0MGKdZKew0ESknBOzxHUKXeGBS4c6DhXwXd+aARtAd0d4qJy1ZH34lspT5 9HeHWKGhqx3DfBrNAb5W9F+cu1YMHdS1qdYY8bCQV4rb4zYuPFa6g+LXiJYAD35vE6F/ lY188eq+fJHQOoPWsWM+jcM4DzKeENvqZL05CNzdspqMCu/1D0tOJKkwtwiuRp1HH6KM CVp27NfE6/AlwkUTKTc66T4s3GIr748VrhFWjsZ1d6UCpFjwBkQ/iWuKq++xNnO0odaC 4dmsMm+S81na3Y7QuWyRfym2BxW69rT6aJBcSFbFpfgc3yyQyvcmDH5GJJqXIJElqlCa Lw+w== X-Gm-Message-State: AOAM533IS02d2DXpOcKPAdKVzQvQo/GF75ugZ/vPvE8AyjAq7q1dVDhj 4GZdlmi+zb4cZNT7PeSgzhQ= X-Google-Smtp-Source: ABdhPJwzCpvtJibQQuN9gZf+y3+8JsQlCmrt+xcnKSx7XOVFPyrUrKGaRkrS5TsV3+FnF0rp+oSY4Q== X-Received: by 2002:a1c:9dd8:: with SMTP id g207mr7587209wme.15.1608198391858; Thu, 17 Dec 2020 01:46:31 -0800 (PST) Received: from oberon.zico.biz ([83.222.187.186]) by smtp.gmail.com with ESMTPSA id o125sm6773164wmo.30.2020.12.17.01.46.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 01:46:31 -0800 (PST) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 3/9] libtracefs man pages: APIs for locating trace directory and files. Date: Thu, 17 Dec 2020 11:46:20 +0200 Message-Id: <20201217094626.1402191-4-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201217094626.1402191-1-tz.stoyanov@gmail.com> References: <20201217094626.1402191-1-tz.stoyanov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Documented APIs: tracefs_get_tracing_file() tracefs_put_tracing_file() tracefs_get_tracing_dir() tracefs_find_tracing_dir() Signed-off-by: Tzvetomir Stoyanov (VMware) --- Documentation/libtracefs-files.txt | 111 +++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 Documentation/libtracefs-files.txt diff --git a/Documentation/libtracefs-files.txt b/Documentation/libtracefs-files.txt new file mode 100644 index 0000000..b288892 --- /dev/null +++ b/Documentation/libtracefs-files.txt @@ -0,0 +1,111 @@ +libtracefs(3) +============= + +NAME +---- +tracefs_get_tracing_file, tracefs_put_tracing_file, tracefs_get_tracing_dir, +tracefs_find_tracing_dir - Find locations of trace directory and files. + +SYNOPSIS +-------- +[verse] +-- +*#include * + +char pass:[*]*tracefs_get_tracing_file*(const char pass:[*]_name_); +void *tracefs_put_tracing_file*(char pass:[*]_name_); +const char pass:[*]*tracefs_get_tracing_dir*(void); +char pass:[*]*tracefs_find_tracing_dir*(void); +-- + +DESCRIPTION +----------- +This set of APIs can be used to find the full path of the trace file +system mount point and trace files in it. + +The _tracefs_get_tracing_file()_ function returns the full path of the +file with given _name_ in the trace file system. The function works +only with files in the trasefs main directory, it is not trace instance +aware. It is recommended to use _tracefs_instance_get_file()_ and +_tracefs_instance_get_dir()_ instead. The returned string must be freed +with _tracefs_put_tracing_file()_. + +The _tracefs_put_tracing_file()_ function frees trace file name, +returned by _tracefs_get_tracing_file()_. + +The _tracefs_find_tracing_dir()_ function finds the mount point of the +trace file system and returns a full path to it. If the file system is +not mounted, it will mount it. The returned string must be freed. + +The _tracefs_get_tracing_dir()_ function returns the full path to the +trace file system. In the first function call, the mount point of the +tracing file system is located, cached and returned. It will mount it, +if it is not minted. On any subsequent call the cached path is returned. +The return string must _not_ be freed. + +RETURN VALUE +------------ +The _tracefs_get_tracing_file()_ function returns a string or NULL in case +of an error. The returned string must be freed with _tracefs_put_tracing_file()_. + +The _tracefs_find_tracing_dir()_ function returns a string or NULL in case +of an error. The returned string must be freed. + +The _tracefs_get_tracing_dir()_ function returns a constant string or NULL +in case of an error. The returned string must _not_ be freed. + +EXAMPLE +------- +[source,c] +-- +#include +... +char *trace_on = tracefs_get_tracing_file("tracing_on"); + if (trace_on) { + ... + tracefs_put_tracing_file(trace_on); + } +... +char *trace_dir = tracefs_find_tracing_dir(); + if (trace_dir) { + ... + free(trace_dir); + } +... +const char *trace_dir = tracefs_get_tracing_dir(); + +-- +FILES +----- +[verse] +-- +*tracefs.h* + Header file to include in order to have access to the library APIs. +*-ltracefs* + Linker switch to add when building a program that uses the library. +-- + +SEE ALSO +-------- +_libtracefs(3)_, +_libtraceevent(3)_, +_trace-cmd(1)_ + +AUTHOR +------ +[verse] +-- +*Steven Rostedt* +*Tzvetomir Stoyanov* +-- +REPORTING BUGS +-------------- +Report bugs to + +LICENSE +------- +libtracefs is Free Software licensed under the GNU LGPL 2.1 + +RESOURCES +--------- +https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ \ No newline at end of file From patchwork Thu Dec 17 09:46:21 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: 11979431 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECD4DC3526E for ; Thu, 17 Dec 2020 09:47:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE446238D6 for ; Thu, 17 Dec 2020 09:47:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727275AbgLQJqu (ORCPT ); Thu, 17 Dec 2020 04:46:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727991AbgLQJqt (ORCPT ); Thu, 17 Dec 2020 04:46:49 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23AA6C0611CA for ; Thu, 17 Dec 2020 01:46:34 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id r7so25908499wrc.5 for ; Thu, 17 Dec 2020 01:46:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Qk53r8eZIG9FM0whVuWdypgVu0JQXb37mXTB0DUalUI=; b=B+VmNv/ts9LBPVm4PS+olXyFXYKHJgVn5bxQVra/rSzQZkcy8+aiutZNshFHdWBkjh vzlIzD6yeoHL4bWZLyAu2pgI0veaaZRiL2JvtezoZkqS7IV67BeX4KgJlI02L6/Qf0se bAPM3zLWaa+p2tsmK4xexY41iTiX40x2SrShwsXepuKHA3seMXvLaFxd0UPjnDg1lB87 kTdbgDuFYDdCl8DmKnpV2zTngRhoXBbdWWfwbBCHVvSgQr63V6Gtnwa9Z7F/yhEu+bod 1O6fiJLbMLWgsMbQBeL84P2BcMz4THGVuwYfTq6zlH7JBh0mjT7IH9h4yskJ/FxksbDF n3yw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Qk53r8eZIG9FM0whVuWdypgVu0JQXb37mXTB0DUalUI=; b=gHjmiN79srwj8BVYpg/tfdr35JuUVFxxz9hQhJlUR3TklxMZ5lAO9C1jYCGmBGcxMH 6cxaEsksQdudvNUTUX40X+eNpIt7a1D+w5Y3XI2GHYrd3dtS19ERPfl2+klDEgJZmmaV fp7tXkRnWknfhygyRm6nfMF8GC3la/vNeB6/DuK/0u6+7QweuuX4XDwSmlPmQgpsdrF5 ybHeIt7WcvAUfAriF/mJdhRi9MiQkPO4wDjVtyj6SvzQnAS7ZnD4WA0n2Bw0tFmugzVJ RUPN85Xep5FoptD6UTXXcZjfdeFOGV9bFnIZ62A+M/d5UuFhJhfERWJYuj3AguLhSrW2 wAGQ== X-Gm-Message-State: AOAM533P3cr8c1/yNyAQLv2PZdeVyHQNgrRgirSHhniZpqO5XBkzxp4j oKcOKtY1B7Xsd9THIJgjF3c= X-Google-Smtp-Source: ABdhPJzhANg7jLOy4KPxm8prbqIKo50Tjqlaku+8Sc52EIdVBlLwNVNercC+nD9rsJ8pla2dijnC2Q== X-Received: by 2002:a5d:4f0e:: with SMTP id c14mr11392455wru.84.1608198392925; Thu, 17 Dec 2020 01:46:32 -0800 (PST) Received: from oberon.zico.biz ([83.222.187.186]) by smtp.gmail.com with ESMTPSA id o125sm6773164wmo.30.2020.12.17.01.46.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 01:46:32 -0800 (PST) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 4/9] libtracefs man pages: APIs for working with trace systems and events. Date: Thu, 17 Dec 2020 11:46:21 +0200 Message-Id: <20201217094626.1402191-5-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201217094626.1402191-1-tz.stoyanov@gmail.com> References: <20201217094626.1402191-1-tz.stoyanov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Documented APIs: tracefs_event_systems() tracefs_system_events() tracefs_iterate_raw_events() Signed-off-by: Tzvetomir Stoyanov (VMware) --- Documentation/libtracefs-events.txt | 140 ++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 Documentation/libtracefs-events.txt diff --git a/Documentation/libtracefs-events.txt b/Documentation/libtracefs-events.txt new file mode 100644 index 0000000..1fa4674 --- /dev/null +++ b/Documentation/libtracefs-events.txt @@ -0,0 +1,140 @@ +libtracefs(3) +============= + +NAME +---- +tracefs_event_systems, tracefs_system_events, tracefs_iterate_raw_events - +Work with trace systems and events. + +SYNOPSIS +-------- +[verse] +-- +*#include * +*#include * + +char pass:[*]pass:[*]*tracefs_event_systems*(const char pass:[*]_tracing_dir_); +char pass:[*]pass:[*]*tracefs_system_events*(const char pass:[*]_tracing_dir_, const char pass:[*]_system_); +int *tracefs_iterate_raw_events*(struct tep_handle pass:[*]_tep_, struct tracefs_instance pass:[*]_instance_, cpu_set_t pass:[*]_cpus_, int _cpu_size_, int (pass:[*]_callback_)(struct tep_event pass:[*], struct tep_record pass:[*], int, void pass:[*]), void pass:[*]_callback_context_); + +-- + +DESCRIPTION +----------- +Trace systems and events related APIs. + +The _tracefs_event_systems()_ function returns array of strings with the +names of all registered trace systems, located in the given _tracing_dir_ +directory. This could be NULL or tracefs mount point, for trace systems in +top instance, or full path to a trace instance, for trace systems in that +instance. The last entry in the array is a NULL pointer. The array must +be freed with _tracefs_list_free()_ API. + +The _tracefs_system_events()_ function returns array of strings with the +names all registered trace events for given trace system, located in the +given _tracing_dir_ directory. This could be NULL or tracefs mount point, +for trace events in top instance, or full path to a trace instance, for +trace events in that instance. The last entry in the array as a NULL +pointer. The array must be freed with _tracefs_list_free()_ API. + +The _tracefs_iterate_raw_events()_ function iterates through all recorded +events in the raw trace ring buffer. It requires an initialized _tep_ +handler. The ring buffer being iterated is in the given _instance_, or +in the top instance if _instance_ is NULL. It can filter events +for given _cpus_ only, a CPU mask of _cpu_size_ size, or walk through all +recorded events, if _cpus_ is a NULL pointer. The _callback_ is called for +every recorded event from the ring buffer. The _callback_context_ parameter +is passed to the _callback_. Parameters of the _callback_ are _tep_ event +handler; a pointer to recorded event, _struct tep_record_; the _cpu_ on +which the event had been happened and the user specified _callback_context_. +If the _callback_ returns non-zero, the iteration stops. + +RETURN VALUE +------------ +The _tracefs_event_systems()_ and __tracefs_system_events()_ functions return +an array of strings. The last element in that array is a NULL pointer. The array +must be freed with _tracefs_list_free()_ API. In case of an error, NULL is returned. + +The _tracefs_iterate_raw_events()_ function returns -1 in case of an error or +0 otherwise. + +EXAMPLE +------- +[source,c] +-- +#include +#include + +char **systems = tracefs_event_systems(NULL); + + if (systems) { + int i = 0; + /* Got registered trace systems from the top trace instance */ + while (systems[i]) { + char **events = tracefs_system_events(NULL, systems[i]); + if (events) { + /* Got registered events in system[i] from the top trace instance */ + int j = 0; + + while (events[j]) { + /* Got event[j] in system[i] from the top trace instance */ + j++; + } + tracefs_list_free(events); + } + i++; + } + tracefs_list_free(systems); + } +.... +static int records_walk(struct tep_event *tep, struct tep_record *record, int cpu, void *context) +{ + /* Got recorded event on cpu */ + return 0; +} +... +struct tep_event *tep = tracefs_local_events(NULL); + + if (!tep) { + /* Failed to initialise tep handler with local events */ + ... + } + if (tracefs_iterate_raw_events(tep, NULL, NULL, 0, records_walk, NULL) < 0) { + /* Error walking through the recorded raw events */ + } + tep_free(tep); +-- +FILES +----- +[verse] +-- +*tracefs.h* + Header file to include in order to have access to the library APIs. +*-ltracefs* + Linker switch to add when building a program that uses the library. +-- + +SEE ALSO +-------- +_libtracefs(3)_, +_libtraceevent(3)_, +_trace-cmd(1)_ + +AUTHOR +------ +[verse] +-- +*Steven Rostedt* +*Tzvetomir Stoyanov* +-- +REPORTING BUGS +-------------- +Report bugs to + +LICENSE +------- +libtracefs is Free Software licensed under the GNU LGPL 2.1 + +RESOURCES +--------- +https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ \ No newline at end of file From patchwork Thu Dec 17 09:46:22 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: 11979439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 503C0C2BBCD for ; Thu, 17 Dec 2020 09:47:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 20746238E3 for ; Thu, 17 Dec 2020 09:47:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727755AbgLQJrQ (ORCPT ); Thu, 17 Dec 2020 04:47:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727066AbgLQJrP (ORCPT ); Thu, 17 Dec 2020 04:47:15 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 422C4C0617B0 for ; Thu, 17 Dec 2020 01:46:35 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id r3so25923913wrt.2 for ; Thu, 17 Dec 2020 01:46:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3jTHsAv2LocixUIxaZBHDXqlapt2XOT62Xplq6fOgeM=; b=Fze13qkti54W/KNVY+5tz6XbnwIiVx8PEW0XXD2yBKsWRkOaEheYCly0PjBcDm/EHN hxh/oymt97SS4hS9SJ85oCHYMUz9j4ywB7Z2hkoHO46svpr+/45qvTo8xHGm2kc8M0ky mChfPlcqnHsN7TD57iFbezJbv5+cH7Cioag4Hv+zCZWZM7Zb/obhJ+ddujWbKGGb5ib6 WXAAOBAjJlg6zDiPJEdga9y+tzhprInWGYtoQeH1IvaNBPPOBNIdBn+RfGQM2VQZH0yH iJe+83WKqx4+QRNrjtdtol1Ai5JH79FzVBmPWpH5Yn2Q8ihRx8EoZXceFsUSueLteOVB C1wg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=3jTHsAv2LocixUIxaZBHDXqlapt2XOT62Xplq6fOgeM=; b=KYWsUbA20cWd1pIagzh/WqvraNt5n73vOM22Tv5V/sqIilPubh5FHXDux6PQc/jID2 n6UNMDft5SnfvLKLsjY6P7Z3UOm5WMgOKBsL5j2KmNIcCq3FDi0EBa3Aarr5u/plhTEZ 24PDl0kidepxxkOacQ0w4+8yDBj3rmKVLR/kfw9kjOtIcgJdB2ckb6XDU5GKPuXUdeZy 62Gq/rvwX8FsKTioayqXznducQzwm7USj54nTa2JETdqhR27J0nBdb/HcEfjqxKRW4ib Hby5OOcM5lssj8KStl+FjURaBUl94ozedvFdjgwyDhDSEgqSh6VGDN7oX9kgB8q/0ppR EovA== X-Gm-Message-State: AOAM533XcuzXlHXrBYvErrCiDZCv+xZZ51b4P5o8oJtlRg6lY060cJ9E RskAp/yN1+m0H5bIHDFdr+6bdn07xtr9rg== X-Google-Smtp-Source: ABdhPJxsoP7UAq62MuZ4PJh4+OIeJfynTN3GZFA/6Ab+NlxgmXC1m8O9PtKpJxlMy1PiFB6Izt41Aw== X-Received: by 2002:a5d:6902:: with SMTP id t2mr42454876wru.214.1608198394004; Thu, 17 Dec 2020 01:46:34 -0800 (PST) Received: from oberon.zico.biz ([83.222.187.186]) by smtp.gmail.com with ESMTPSA id o125sm6773164wmo.30.2020.12.17.01.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 01:46:33 -0800 (PST) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 5/9] libtracefs man pages: APIs for managing trace instances. Date: Thu, 17 Dec 2020 11:46:22 +0200 Message-Id: <20201217094626.1402191-6-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201217094626.1402191-1-tz.stoyanov@gmail.com> References: <20201217094626.1402191-1-tz.stoyanov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Documented APIs: tracefs_instance_create() tracefs_instance_destroy() tracefs_instance_free() tracefs_instance_is_new() Signed-off-by: Tzvetomir Stoyanov (VMware) --- Documentation/libtracefs-instances-manage.txt | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 Documentation/libtracefs-instances-manage.txt diff --git a/Documentation/libtracefs-instances-manage.txt b/Documentation/libtracefs-instances-manage.txt new file mode 100644 index 0000000..ca08269 --- /dev/null +++ b/Documentation/libtracefs-instances-manage.txt @@ -0,0 +1,104 @@ +libtracefs(3) +============= + +NAME +---- +tracefs_instance_create, tracefs_instance_destroy, tracefs_instance_free, +tracefs_instance_is_new - Manage trace instances. + +SYNOPSIS +-------- +[verse] +-- +*#include * + +struct tracefs_instance pass:[*]*tracefs_instance_create*(const char pass:[*]_name_); +int *tracefs_instance_destroy*(struct tracefs_instance pass:[*]_instance_); +void *tracefs_instance_free*(struct tracefs_instance pass:[*]_instance_); +bool *tracefs_instance_is_new*(struct tracefs_instance pass:[*]_instance_); + +-- + +DESCRIPTION +----------- +This set of functions can be used to manage trace instances. + +The _tracefs_instance_create()_ function creates a new trace instance with given +_name_, if it does not already exist in the system. It allocates and initializes +a new tracefs_instance structure and returns it. + +The _tracefs_instance_destroy()_ destroys the trace _instance_ and frees the +tracefs_instance structure. + +The _tracefs_instance_free()_ function frees the tracefs_instance structure, +without destroying the trace instance. + +The _tracefs_instance_is_new()_ function checks if the given _instance_ is newly +created by _tracefs_instance_create()_, or it has been in the system before that. + +RETURN VALUE +------------ +The _tracefs_instance_create()_ function returns a pointer to a newly allocated +tracefs_instance structure. It must be freed with _tracefs_instance_destroy()_ or +_tracefs_instance_free()_. + +The _tracefs_instance_destroy()_ function returns -1 in case of an error, +or 0 otherwise. + +The _tracefs_instance_is_new()_ function returns true if the instance is +created by _tracefs_instance_create()_ or false if it was in the system +before that. + +EXAMPLE +------- +[source,c] +-- +#include + +struct tracefs_instance *inst = tracefs_instance_create("foo"); + if (!inst) { + /* Error creating a new trace instance */ + ... + } + + ... + + if (tracefs_instance_is_new(inst)) + tracefs_instance_destroy(inst); + else + tracefs_instance_free(inst); +-- +FILES +----- +[verse] +-- +*tracefs.h* + Header file to include in order to have access to the library APIs. +*-ltracefs* + Linker switch to add when building a program that uses the library. +-- + +SEE ALSO +-------- +_libtracefs(3)_, +_libtraceevent(3)_, +_trace-cmd(1)_ + +AUTHOR +------ +[verse] +-- +*Steven Rostedt* +*Tzvetomir Stoyanov* +-- +REPORTING BUGS +-------------- +Report bugs to + +LICENSE +------- +libtracefs is Free Software licensed under the GNU LGPL 2.1 + +RESOURCES +--------- +https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ \ No newline at end of file From patchwork Thu Dec 17 09:46: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: 11979445 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 745E5C2BBCA for ; Thu, 17 Dec 2020 09:47:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F961238E1 for ; Thu, 17 Dec 2020 09:47:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727066AbgLQJrR (ORCPT ); Thu, 17 Dec 2020 04:47:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726890AbgLQJrR (ORCPT ); Thu, 17 Dec 2020 04:47:17 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 576F0C0611CB for ; Thu, 17 Dec 2020 01:46:36 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id q18so18390258wrn.1 for ; Thu, 17 Dec 2020 01:46:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r+YUtLl/Hf8N/iAQo2QQM3eGnDGMajLkjE2wfra0Wbo=; b=YaGAJtKmNigO5Aof9I+o0gpD+GeJ5ObdWiaV80qU2gOh6YR/LBJWmDL3LP9C0P6vO3 b8eXBtngHMu6SAObXhFq1CPUh87G6CfLWy4c4gBZp0ZQmY06oTj9KusoU5esBpK87WN+ imtjgOJNXjWRHBe2NopWp3R6tcVptlLxvP4smCzPBY/o2LdYfRkYYl4JFtqZGuo61q6W pa6v7AaOs3X0FBxOGD6XaxvK7Afmv1ONCxVEXd/YhdX8PcknoISv+N9P+hd0cJqw+E5A Rg1HE+XkYyF1QCnxKYCbhb4F1ssHFR3K11OfQoAv5bWA/XBY/NAiDm0CvHAEgap96taC ixSQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=r+YUtLl/Hf8N/iAQo2QQM3eGnDGMajLkjE2wfra0Wbo=; b=N6AH213AIcjyZvvUheep0LdaS4RJVkOQwsJLIw7eTXJdS+Om0Zzu8hdnbBch1W63PZ 3V/Qj3evxfl63MJTORhNhTbpTwEYPtk2levyeCiqLk6Oa825foLA6Zt8Q87PEfO7Zu4L q7Sqkvjbk13I1O1AN+9t+fXYXg2NaEUi02ty/c+qOlM4dBIdieJXHDFFZ3yFaKX4pAP2 EIcmXWAc0alrzLhIFtvn2pNhamEJ/vd3rjovDiOrt9pom1t5BpFHWzncwxOvW6al0nsN xgcGQHnxKFRCWYVw/mRxjVThK+DvgveNxKF/EfbvgB++Um/z3eOaE9qH37rdXUGJaPz8 6EUg== X-Gm-Message-State: AOAM532dKEYZOMRlwcesgYwLBV8Rmh+uCzVaO5ULnj3ZBJTHQajAGrrS dwcu2j1txCjckwGKCKOy/M0= X-Google-Smtp-Source: ABdhPJyiOHlalWQEKoaL8HmMRsf7bP3mzr0mCnJqaGVDbFPQBYFY9kovLl9T93+XGy/fyjsLKtsPfQ== X-Received: by 2002:adf:9cc6:: with SMTP id h6mr42512065wre.341.1608198395097; Thu, 17 Dec 2020 01:46:35 -0800 (PST) Received: from oberon.zico.biz ([83.222.187.186]) by smtp.gmail.com with ESMTPSA id o125sm6773164wmo.30.2020.12.17.01.46.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 01:46:34 -0800 (PST) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 6/9] libtracefs man pages: APIs for working with files in trace instances. Date: Thu, 17 Dec 2020 11:46:23 +0200 Message-Id: <20201217094626.1402191-7-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201217094626.1402191-1-tz.stoyanov@gmail.com> References: <20201217094626.1402191-1-tz.stoyanov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Documented APIs: tracefs_file_exists() tracefs_dir_exists() tracefs_instance_get_file() tracefs_instance_get_dir() tracefs_instance_file_write() tracefs_instance_file_read() Signed-off-by: Tzvetomir Stoyanov (VMware) --- Documentation/libtracefs-instances-files.txt | 157 +++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 Documentation/libtracefs-instances-files.txt diff --git a/Documentation/libtracefs-instances-files.txt b/Documentation/libtracefs-instances-files.txt new file mode 100644 index 0000000..f1e9707 --- /dev/null +++ b/Documentation/libtracefs-instances-files.txt @@ -0,0 +1,157 @@ +libtracefs(3) +============= + +NAME +---- +tracefs_file_exists, tracefs_dir_exists, tracefs_instance_get_file, +tracefs_instance_get_dir, tracefs_instance_file_write, +tracefs_instance_file_read - Work with files in tracing instances. + +SYNOPSIS +-------- +[verse] +-- +*#include * + +bool *tracefs_file_exists*(struct tracefs_instance pass:[*]_instance_, char pass:[*]_name_); +bool *tracefs_dir_exists*(struct tracefs_instance pass:[*]_instance_, char pass:[*]_name_); +char pass:[*]*tracefs_instance_get_file*(struct tracefs_instance pass:[*]_instance_, const char pass:[*]_file_); +char pass:[*]*tracefs_instance_get_dir*(struct tracefs_instance pass:[*]_instance_); +int *tracefs_instance_file_write*(struct tracefs_instance pass:[*]_instance_, const char pass:[*]_file_, const char pass:[*]_str_); +char pass:[*]*tracefs_instance_file_read*(struct tracefs_instance pass:[*]_instance_, char pass:[*]_file_, int pass:[*]_psize_); + +-- + +DESCRIPTION +----------- +This set of APIs can be used to work with trace files in all trace instances. +All they have _instance_ argument, to limit the scope on the given trace _instance_ only. +If _instance_ is NULL, the scope is limited to the main trace instance. + +The _tracefs_file_exists()_ function checks if a file with _name_ exists in _instance_. + +The _tracefs_dir_exists()_ function checks if a directory with _name_ exists in _instance_. + +The _tracefs_instance_get_file()_ function returns the full path of the file with +given _name_ in _instance_. + +The _tracefs_instance_get_dir()_ function returns the full path of the directory with +given _name_ in _instance_. + +The _tracefs_instance_file_write()_ function writes a string _str_ in a _file_ from +the given _instance_, without the terminating NULL character. + +The _tracefs_instance_file_read()_ function reads the content of a _file_ from +the given _instance_. + +RETURN VALUE +------------ +The _tracefs_file_exists()_ and _tracefs_dir_exists()_ functions return true if the +file / directory exist in the given instance or false if they do not exist. + +The _tracefs_instance_get_file()_ and _tracefs_instance_get_dir()_ functions return +a string or NULL in case of an error. The returned string must be freed with +_tracefs_put_tracing_file()_. + +The _tracefs_instance_file_write()_ function returns the number of written bytes, +or -1 in case of an error. + +The _tracefs_instance_file_read()_ function returns a pointer to a NULL terminated +string, read from the file, or NULL in case of an error. The returned string must +be freed with free(). + +EXAMPLE +------- +[source,c] +-- +#include + +struct tracefs_instance *inst = tracefs_instance_create("foo"); + if (!inst) { + /* Error creating a new trace instance */ + ... + } + + if (tracefs_file_exists(inst,"trace_clock")) { + /* The instance foo supports trace clock */ + char *path, *clock; + int size; + + path = = tracefs_instance_get_file(inst, "trace_clock") + if (!path) { + /* Error getting the path to trace_clock file in instance foo */ + ... + } + ... + tracefs_put_tracing_file(path); + + clock = tracefs_instance_file_read(inst, "trace_clock", &size); + if (!clock) { + /* Failed to read trace_clock file in instance foo */ + ... + } + ... + free(clock); + + if (tracefs_instance_file_write(inst, "trace_clock", "global") != strlen("global")) { + /* Failed to set gloabl trace clock in instance foo */ + ... + } + } else { + /* The instance foo does not support trace clock */ + } + + if (tracefs_dir_exists(inst,"options")) { + /* The instance foo supports trace options */ + char *path = tracefs_instance_get_file(inst, "options"); + if (!path) { + /* Error getting the path to options directory in instance foo */ + ... + } + + tracefs_put_tracing_file(path); + } else { + /* The instance foo does not support trace options */ + } + + ... + + if (tracefs_instance_is_new(inst)) + tracefs_instance_destroy(inst); + else + tracefs_instance_free(inst); +-- +FILES +----- +[verse] +-- +*tracefs.h* + Header file to include in order to have access to the library APIs. +*-ltracefs* + Linker switch to add when building a program that uses the library. +-- + +SEE ALSO +-------- +_libtracefs(3)_, +_libtraceevent(3)_, +_trace-cmd(1)_ + +AUTHOR +------ +[verse] +-- +*Steven Rostedt* +*Tzvetomir Stoyanov* +-- +REPORTING BUGS +-------------- +Report bugs to + +LICENSE +------- +libtracefs is Free Software licensed under the GNU LGPL 2.1 + +RESOURCES +--------- +https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ \ No newline at end of file From patchwork Thu Dec 17 09:46:24 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: 11979443 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DE24C2BBCF for ; Thu, 17 Dec 2020 09:47:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5E99A238D6 for ; Thu, 17 Dec 2020 09:47:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728204AbgLQJrS (ORCPT ); Thu, 17 Dec 2020 04:47:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726890AbgLQJrR (ORCPT ); Thu, 17 Dec 2020 04:47:17 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63534C0611CC for ; Thu, 17 Dec 2020 01:46:37 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id a12so25865112wrv.8 for ; Thu, 17 Dec 2020 01:46:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HoLQHa8sl8kTyKlHznALMq2ZsESwP03ZOzMjp/2wQpc=; b=CPEOcFnpFUUyITw8W7UdeXuQbPL1t7nKh2r8U4D+DymSImSzDT2dJC6D4w+OWGbsHv 7zPW1LkqVxEJAKITIj3NKOwk6X0cp/iRIkFBuOPAaY/VvnaK8z3bVUvciTzo/lviib26 sFmODRpCJlS4KXgxQJvrfPOjGD0+lft4t4xH64rC0XxiYx3G22MMuphpyd2kWmnDeCPx aE3BkXegEOSH2yBy/C8a+oEjrzpxdL9uGNJMZQGqRU86mApstnKTHsbdH7DFjTvPEnjD HeCGha2vRK+rtDDlxLKTVGRxOJQRkfzpnVWVY1llStXtWTa8fxrOAl4HjLbCqMvhWO22 1CgA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=HoLQHa8sl8kTyKlHznALMq2ZsESwP03ZOzMjp/2wQpc=; b=UI+EFNkwvY4A1azklz0Rx1+ntxntGFMpOHO2PaUkw4RK6Fsn1jNH31L66gHTQ9sS+N u4N23MwIW5MuuPcPh+vEgKINhiYYLC36YM38zu+bCoLSjV/8B8fLtkzIdgydowfOJrp8 JMpGlVUgL8nlBms3CVoiDPBDOnzr/V5jQTbEiuhFL9jfh5RDswMZAWtEWYjIOEpI7DkF YSUCBMXXSDTYZ2wPJ/iwVcRrV9ELZrAYY/65fE7Cxr0rzTb5I/fnIc1XiieqawJiJy63 Iyst5WZocmHMWiuBFbk6wP7knqvgulM094skHlnKc9l+XDTyU+Qm7eGrtXExfFsFQF89 i3AQ== X-Gm-Message-State: AOAM533vFCIzDghobps9mfrB1RTXkeq9k1YryYNH6P6GBapWE/M5DODy lhR+szzgOcQvvGuvxCKXSJs= X-Google-Smtp-Source: ABdhPJwPS3IEGpCewOEm8TFR9ewzU/eCvQ9d5T4vUhFFGy4QcskVMEpcsqIUhF8HAYsBstC9ZdHaDg== X-Received: by 2002:a5d:61ca:: with SMTP id q10mr42652793wrv.124.1608198396194; Thu, 17 Dec 2020 01:46:36 -0800 (PST) Received: from oberon.zico.biz ([83.222.187.186]) by smtp.gmail.com with ESMTPSA id o125sm6773164wmo.30.2020.12.17.01.46.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 01:46:35 -0800 (PST) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 7/9] libtracefs man pages: helper APIs for working with trace instances. Date: Thu, 17 Dec 2020 11:46:24 +0200 Message-Id: <20201217094626.1402191-8-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201217094626.1402191-1-tz.stoyanov@gmail.com> References: <20201217094626.1402191-1-tz.stoyanov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Documented APIs: tracefs_instance_get_name() tracefs_instances_walk() tracefs_instance_exists() Signed-off-by: Tzvetomir Stoyanov (VMware) --- Documentation/libtracefs-instances-utils.txt | 111 +++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 Documentation/libtracefs-instances-utils.txt diff --git a/Documentation/libtracefs-instances-utils.txt b/Documentation/libtracefs-instances-utils.txt new file mode 100644 index 0000000..1630d5c --- /dev/null +++ b/Documentation/libtracefs-instances-utils.txt @@ -0,0 +1,111 @@ +libtracefs(3) +============= + +NAME +---- +tracefs_instance_get_name, tracefs_instances_walk, tracefs_instance_exists - +Helper functions for working with tracing instances. + +SYNOPSIS +-------- +[verse] +-- +*#include * + +const char pass:[*]*tracefs_instance_get_name*(struct tracefs_instance pass:[*]_instance_); +int *tracefs_instances_walk*(int (pass:[*]_callback_)(const char pass:[*], void pass:[*]), void pass:[*]_context)_; +bool *tracefs_instance_exists*(const char pass:[*]_name_); + +-- + +DESCRIPTION +----------- +Helper functions for working with trace instances. + +The _tracefs_instance_get_name()_ function returns the name of the given _instance_. +Note that the top instance has no name, the function returns NULL for it. + +The _tracefs_instances_walk()_ function walks through all configured tracing +instances in the system and calls _callback_ for each one of them. The _context_ +argument is passed to the _callback_, together with the instance name. If the +_callback_ returns non-zero, the iteration stops. + +The _tracefs_instance_exists()_ function checks if an instance with given _name_ +exists in the system. + +RETURN VALUE +------------ +The _tracefs_instance_get_name()_ returns string or NULL in case of the top +instance. The returned string must _not_ be freed. + +The _tracefs_instances_walk()_ function returns 0, if all instances were iterated, 1 +if the iteration was stopped by the _callback_, or -1 in case of an error. + +The _tracefs_instance_exists()_ returns true if an instance with given name +exists in the system or false otherwise. + +EXAMPLE +------- +[source,c] +-- +#include + +struct tracefs_instance *inst; +.... +char *name = tracefs_instance_get_name(inst); + + if(name) { + /* Got name of the instance */ + } + +... +static int instance_walk(char *name, void *context) +{ + /* Got instance with name */ + return 0; +} +... + if (tracefs_instances_walk(instance_walk, NULL) < 0) { + /* Error walking through the instances */ + } +... + if (tracefs_instance_exists("foo")) { + /* There is instance with name foo in the system */ + } else { + /* There is no instance with name foo in the system */ + } +-- +FILES +----- +[verse] +-- +*tracefs.h* + Header file to include in order to have access to the library APIs. +*-ltracefs* + Linker switch to add when building a program that uses the library. +-- + +SEE ALSO +-------- +_libtracefs(3)_, +_libtraceevent(3)_, +_trace-cmd(1)_ + +AUTHOR +------ +[verse] +-- +*Steven Rostedt* +*Tzvetomir Stoyanov* +-- +REPORTING BUGS +-------------- +Report bugs to + +LICENSE +------- +libtracefs is Free Software licensed under the GNU LGPL 2.1 + +RESOURCES +--------- +https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ \ No newline at end of file From patchwork Thu Dec 17 09:46:25 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: 11979449 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE56AC2BBD5 for ; Thu, 17 Dec 2020 09:47:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 855FD233FB for ; Thu, 17 Dec 2020 09:47:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727498AbgLQJrT (ORCPT ); Thu, 17 Dec 2020 04:47:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726890AbgLQJrT (ORCPT ); Thu, 17 Dec 2020 04:47:19 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D62FC0611CD for ; Thu, 17 Dec 2020 01:46:38 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id q18so18390373wrn.1 for ; Thu, 17 Dec 2020 01:46:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UGI7x9XGf8QdyR8SMGBQIxUmxZG5OF3RDAyFwTys9vM=; b=JKIaFu3PtjFrkBYYVpx6sGadJy887v3SCDsm9y366ar6v1KxGPeFzo6kj8wj8piO4A 3r3dulTWEG/dCKanqyugqnLHMV5oefijNDn5gOrhMgcthf/6gHEN1JgbqdWR0enHnIgc kXx1V0r0KE+E838knc0zVDZnemcyX0TIea/PQyDvMMEWM7pG10RnlpOClETKmvZ7bWko TaQwnLpl5GwM0XOnPxhNZTcZ2NznD1urXaS6YIFuYX5MoHyyllvEtnUeEWAgPmfTL6h1 DrWYboxIrdHb3lgoBu68667TrrfeOGhpgFJcQW/XvCuOjgINz5b/tVAVljU+UK401qDs cO9w== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=UGI7x9XGf8QdyR8SMGBQIxUmxZG5OF3RDAyFwTys9vM=; b=AsWWpogkCoMmzvZVLARU5Cch4a5mTKoa47a5Re7ym8VaIbCwWFI46B49FWbIBWYHrr MILzeZDa6s6OhvfXGo5ZTl743kfsqp910g8IPUbWtzYJxTxYvKhm8qSlhhtB+VC/Dnmx 97+afpW0Dbms0DwJH87cxZ0sOExSAz3jqT7iEKhFCVSkfBWrTv/KlFyiSvyq9zp47NwU E/CeAeF5VghzTqfXMttIoF2gkK77CUKup0mETKI9qL5JtFsAzRCXFfnSLcWwo4ulvbi7 LA4gdIA3rAPh20IOUlTZP8YcQ04Qkib9FLlJ343eUs5AkPOcyK7VidE1z2tpPKzuq0dF TZhA== X-Gm-Message-State: AOAM533IkwV2CkrRuJmnE9lxFJdmyNJpn+1qlg4EUfW+1ri2v4h/Mg3z i0KuQsxpDWS8rwhixeTpm/E= X-Google-Smtp-Source: ABdhPJxKzeTN9DI2MLWkEVQEMFlXfybMMk5FWMdSj2ONy7ybaysko4M9VeRRsIdBdh3fIwUEcOQ4jQ== X-Received: by 2002:adf:ec8c:: with SMTP id z12mr31111712wrn.208.1608198397367; Thu, 17 Dec 2020 01:46:37 -0800 (PST) Received: from oberon.zico.biz ([83.222.187.186]) by smtp.gmail.com with ESMTPSA id o125sm6773164wmo.30.2020.12.17.01.46.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 01:46:36 -0800 (PST) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 8/9] libtracefs man pages: APIs for initializing a tep handler with trace events from the local system. Date: Thu, 17 Dec 2020 11:46:25 +0200 Message-Id: <20201217094626.1402191-9-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201217094626.1402191-1-tz.stoyanov@gmail.com> References: <20201217094626.1402191-1-tz.stoyanov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Documented APIs: tracefs_local_events() tracefs_local_events_system() tracefs_fill_local_events() Signed-off-by: Tzvetomir Stoyanov (VMware) --- Documentation/libtracefs-events-tep.txt | 131 ++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 Documentation/libtracefs-events-tep.txt diff --git a/Documentation/libtracefs-events-tep.txt b/Documentation/libtracefs-events-tep.txt new file mode 100644 index 0000000..a01ce0e --- /dev/null +++ b/Documentation/libtracefs-events-tep.txt @@ -0,0 +1,131 @@ +libtracefs(3) +============= + +NAME +---- +tracefs_local_events, tracefs_local_events_system, tracefs_fill_local_events - +Initialize a tep handler with trace events from the local system. + +SYNOPSIS +-------- +[verse] +-- +*#include * +*#include * + +struct tep_handle pass:[*]*tracefs_local_events*(const char pass:[*]_tracing_dir_); +struct tep_handle pass:[*]*tracefs_local_events_system*(const char pass:[*]_tracing_dir_, const char pass:[*] const pass:[*]_sys_names_); +int *tracefs_fill_local_events*(const char pass:[*]_tracing_dir_, struct tep_handle pass:[*]_tep_, int pass:[*]_parsing_failures_); + +-- + +DESCRIPTION +----------- +Functions for initializing a tep handler with trace events from the local system. + +The _tracefs_local_events()_ function allocates a new _tep_ handler and +initializes it with events from all trace systems, located in the given +_tracing_dir_ directory. This could be NULL or tracefs mount point, for +trace events in top instance, or full path to a trace instance, for trace +events in that instance. + +The _tracefs_local_events_system()_ function allocates a new _tep_ handler +and initializes it with events from specified trace systems _sys_names_, +located in the given _tracing_dir_ directory. This could be NULL or tracefs +mount point, for trace events in top instance, or full path to a trace instance, +for trace events in that instance. The _sys_names_ argument is an array of +trace system names, that will be used for _tep_ handler initialization. +The last element in that array must be a NULL pointer. + +The _tracefs_fill_local_events()_ function initializes already allocated _tep_ +handler with events from all trace systems, located in the given _tracing_dir_ +directory. This could be NULL or tracefs mount point, for trace events in +the top instance, or full path to a trace instance, for trace events in that +instance. The _tep_ argument must be a pointer to already allocated tep +handler, that is going to be initialized. The _parsing_failures_ argument +could be NULL or a pointer to an integer, where the number of failures while +parsing the event files are returned. + +RETURN VALUE +------------ +The _tracefs_local_events()_ and _tracefs_local_events_system()_ functions +return pointer to allocated and initialized _tep_ handler, or NULL in +case of an error. The returned _tep_ handler must be freed with _tep_free()_. + +The _tracefs_fill_local_events()_ function returns -1 in case of an error or +0 otherwise. + +EXAMPLE +------- +[source,c] +-- +#include +#include + +struct tep_event *tep; +... + tep = tracefs_local_events(NULL); + if (!tep) { + /* Failed to initialise tep handler with local events from top instance */ + ... + } +... + tep_free(tep); +... + const char *systems[] = {"ftrace", "irq", NULL}; + tep = tracefs_local_events_system(NULL, systems); + if (!tep) { + /* Failed to initialise tep handler with local events from + * ftrace and irq systems in top instance. + */ + ... + } +... + tep_free(tep); +... + int parsing_failures; + tep = tep_alloc(); + if (!tep) { + /* Failed to allocate a tep handler */ + ... + } + if (tracefs_fill_local_events(NULL, tep, &parsing_failures) < 0) { + /* Failed to initialise tep handler with local events from top instance */ + } +... + tep_free(tep); +-- +FILES +----- +[verse] +-- +*tracefs.h* + Header file to include in order to have access to the library APIs. +*-ltracefs* + Linker switch to add when building a program that uses the library. +-- + +SEE ALSO +-------- +_libtracefs(3)_, +_libtraceevent(3)_, +_trace-cmd(1)_ + +AUTHOR +------ +[verse] +-- +*Steven Rostedt* +*Tzvetomir Stoyanov* +-- +REPORTING BUGS +-------------- +Report bugs to + +LICENSE +------- +libtracefs is Free Software licensed under the GNU LGPL 2.1 + +RESOURCES +--------- +https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ \ No newline at end of file From patchwork Thu Dec 17 09:46:26 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: 11979433 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96E59C4361B for ; Thu, 17 Dec 2020 09:47:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 52AB723603 for ; Thu, 17 Dec 2020 09:47:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728191AbgLQJrB (ORCPT ); Thu, 17 Dec 2020 04:47:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727767AbgLQJrA (ORCPT ); Thu, 17 Dec 2020 04:47:00 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A77EC0611CE for ; Thu, 17 Dec 2020 01:46:39 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id t16so25891548wra.3 for ; Thu, 17 Dec 2020 01:46:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HUU1Jh6FSWY9JTBNdVV/FN25lvc1+FDVD1OMUo4JEl8=; b=DDTW+gNKZ6cLBW38x8X7qZnr1H/cPB/IswsUOyFGtX0JVZA0+nRblP7dZQAiVRPA6h ahZl7NdBDESRmfkvW5oL1sNEVh96ITe66rkUMu/tmUlxwz8VupaUl1bp0i/oSEyVqvPT iY85UC7ofYb/P4JMbfTKcqEv6MwXYidH8U4FAp1ytcC0GUZM6tTed3j/l15NmxfTnGnB AYV1QQtCyzq9A4QuBk3mtcTLoean7iQ2xhaa1FTgWStE7g+LQ3JVdIAxVUyUL1WnucDK cCX+jdcX1WBHRnh8sWls6MFdJdbQFnTh9YXi26InDeLKMtDeDAG+/nfRdxU8wUAP6jT9 M8vQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=HUU1Jh6FSWY9JTBNdVV/FN25lvc1+FDVD1OMUo4JEl8=; b=WBFnjaOaeFl1uP7VXRXJHfKkeMH2QSOwOOvxwXu2PtpnBEJ/RS2vUumdAmy3uKPe89 s26SfXS8WRmyi7HaP5LrL/z1z/N1eWyvRwMBgmoaUCoFuNmPKPrBC5FDQx8iloMcmaah FadVPUEQRAeG1Fv6eBx0r3meaFZq0aa47rkKsHRzSDAq+d5SUUtT8HW6irIHNptAzyQD a6ZdcYHGX+Jzcw9GI9wlJyTs2iNu9DUEDp4EjE4ha/NKTbNqzIZWWNydf0Ifdo5A3MJ5 v/Zv9L+AAc0Gyso7Zpmxc9PLNGjFIfK33SX0CFJZrzahSJ2Uyoy3+SUNNIBVBFyIAsrX F4Cw== X-Gm-Message-State: AOAM531IyKdJSGrBYyvUdpSNsaEiCkevmOjtLFCi3pK9zZcYeFDZcRTp 4+1GC2jSctcrxEVP0XiS65zssMUnmfTCGQ== X-Google-Smtp-Source: ABdhPJwbOps6UKkqjGLy4IUWvu52Z8P9UVKDzstWUkPimklCM8F2qU0bDQsLWATiKQHQvlvuNxJuMg== X-Received: by 2002:adf:ba46:: with SMTP id t6mr43025395wrg.168.1608198398357; Thu, 17 Dec 2020 01:46:38 -0800 (PST) Received: from oberon.zico.biz ([83.222.187.186]) by smtp.gmail.com with ESMTPSA id o125sm6773164wmo.30.2020.12.17.01.46.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 01:46:37 -0800 (PST) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 9/9] libtracefs man pages: helper APIs for working with trace file system. Date: Thu, 17 Dec 2020 11:46:26 +0200 Message-Id: <20201217094626.1402191-10-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201217094626.1402191-1-tz.stoyanov@gmail.com> References: <20201217094626.1402191-1-tz.stoyanov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Documented APIs: tracefs_tracers() tracefs_get_clock() tracefs_list_free() Signed-off-by: Tzvetomir Stoyanov (VMware) --- Documentation/libtracefs-utils.txt | 103 +++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 Documentation/libtracefs-utils.txt diff --git a/Documentation/libtracefs-utils.txt b/Documentation/libtracefs-utils.txt new file mode 100644 index 0000000..86dd754 --- /dev/null +++ b/Documentation/libtracefs-utils.txt @@ -0,0 +1,103 @@ +libtracefs(3) +============= + +NAME +---- +tracefs_tracers, tracefs_get_clock, tracefs_list_free - +Helper functions for working with trace file system. + +SYNOPSIS +-------- +[verse] +-- +*#include * + +char pass:[*]pass:[*]*tracefs_tracers*(const char pass:[*]_tracing_dir_); +char pass:[*]*tracefs_get_clock*(struct tracefs_instance pass:[*]_instance_); +void *tracefs_list_free*(char pass:[*]pass:[*]_list_); +-- + +DESCRIPTION +----------- +Various useful functions for working with trace file system. + +The _tracefs_tracers()_ function returns array of strings with the +names of supported tracer plugins, located in the given _tracing_dir_ directory. +This could be NULL or tracefs mount point, for trace systems in top instance, +or full path to a trace instance, for trace systems in that instance. +The last entry in the array as a NULL pointer. The array must +be freed with _tracefs_list_free()_ API. + +The _tracefs_get_clock()_ function returns name of the current trace clock, +used in the given _instance_. If _instance_ is NULL, the clock of the main +trace instance is returned. The returned string must be freed with free(). + +The _tracefs_list_free()_ function frees an array of strings, returned by +_tracefs_event_systems()_, _tracefs_system_events()_ and _tracefs_tracers()_ +APIs. + +RETURN VALUE +------------ +The _tracefs_tracers()_ returns array of strings. The last element in that +array is a NULL pointer. The array must be freed with _tracefs_list_free()_ API. +In case of an error, NULL is returned. + +The _tracefs_get_clock()_ returns string, that must be freed with free(), or NULL +in case of an error. + +EXAMPLE +------- +[source,c] +-- +#include + +char **tracers = tracefs_tracers(NULL); + + if (tracers) { + /* Got tracer plugins from the top trace instance */ + ... + tracefs_list_free(tracers); + } +.... +char *clock = tracefs_get_clock(NULL); + + if (clock) { + /* Got current trace clock of the top trace instance */ + ... + free(clock); + } +-- +FILES +----- +[verse] +-- +*tracefs.h* + Header file to include in order to have access to the library APIs. +*-ltracefs* + Linker switch to add when building a program that uses the library. +-- + +SEE ALSO +-------- +_libtracefs(3)_, +_libtraceevent(3)_, +_trace-cmd(1)_ + +AUTHOR +------ +[verse] +-- +*Steven Rostedt* +*Tzvetomir Stoyanov* +-- +REPORTING BUGS +-------------- +Report bugs to + +LICENSE +------- +libtracefs is Free Software licensed under the GNU LGPL 2.1 + +RESOURCES +--------- +https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ \ No newline at end of file