perf/libperf move
Jiri Olsa
reviewerv2 cover perf/libperf move
hi,
this patchset moves libperf under tools/lib.
It's now possible to build and install it with:
$ cd tools/lib/perf
$ make prefix=/tmp/libperf install
INSTALL libperf.a
INSTALL libperf.so
INSTALL libperf.so.0
INSTALL libperf.so.0.0.1
INSTALL headers
INSTALL libperf.pc
INSTALL man
INSTALL html
INSTALL examples
$ find /tmp/libperf/ -not -type d
/tmp/libperf/share/doc/libperf/examples/sampling.c
/tmp/libperf/share/doc/libperf/examples/counting.c
/tmp/libperf/share/doc/libperf/html/libperf-sampling.html
/tmp/libperf/share/doc/libperf/html/libperf-counting.html
/tmp/libperf/share/doc/libperf/html/libperf.html
/tmp/libperf/share/man/man7/libperf-sampling.7
/tmp/libperf/share/man/man7/libperf-counting.7
/tmp/libperf/share/man/man3/libperf.3
/tmp/libperf/include/perf/mmap.h
/tmp/libperf/include/perf/event.h
/tmp/libperf/include/perf/evsel.h
/tmp/libperf/include/perf/evlist.h
/tmp/libperf/include/perf/threadmap.h
/tmp/libperf/include/perf/cpumap.h
/tmp/libperf/include/perf/core.h
/tmp/libperf/lib64/pkgconfig/libperf.pc
/tmp/libperf/lib64/libperf.so.0.0.1
/tmp/libperf/lib64/libperf.so.0
/tmp/libperf/lib64/libperf.so
/tmp/libperf/lib64/libperf.aThere are few obvious fixes added like include path changes.
Plus adding Documentation changes to have the man page base for more additions. I switched man pages to asciidoc and added 3 man pages:
libperf.3 - overall description
libperf-counting.7 - counting basics explained on simple example libperf-sampling.7 - sampling basics explained on simple example
The plan is to add more man pages to cover the basic API.
I put the html pages in here for you to check:
http://people.redhat.com/~jolsa/libperf/libperf.html
http://people.redhat.com/~jolsa/libperf/libperf-counting.html
http://people.redhat.com/~jolsa/libperf/libperf-sampling.html
It's also available in here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/lib
NOTE we are still able to change any libperf ABI,
nothing is committed by this move ;-)
NOTE 'make perf-targz-src-pkg' works nicely with this change, but is currently failing because of recent bpf changes, I have a fix for that and will send it shortly
v2 changes:
- squash 'fixes' patch with the move, so we don't break bisect
thanks,
jirka
---
Jiri Olsa (2):
libperf: Move libperf under tools/lib/perf
libperf: Add man pages
tools/{perf/lib => lib/perf}/Build | 0
tools/lib/perf/Documentation/Makefile | 156 +++++++++++++
tools/lib/perf/Documentation/asciidoc.conf | 120 ++++++++++
tools/lib/perf/Documentation/examples/sampling.c | 119 ++++++++++
tools/lib/perf/Documentation/libperf-counting.txt | 211 ++++++++++++++++++
tools/lib/perf/Documentation/libperf-sampling.txt | 243 ++++++++++++++++++++
tools/lib/perf/Documentation/libperf.txt | 246 +++++++++++++++++++++
tools/lib/perf/Documentation/manpage-1.72.xsl | 14 ++
tools/lib/perf/Documentation/manpage-base.xsl | 35 +++
.../perf/Documentation/manpage-bold-literal.xsl | 17 ++
tools/lib/perf/Documentation/manpage-normal.xsl | 13 ++
.../lib/perf/Documentation/manpage-suppress-sp.xsl | 21 ++
tools/{perf/lib => lib/perf}/Makefile | 7 +-
tools/{perf/lib => lib/perf}/core.c | 0
tools/{perf/lib => lib/perf}/cpumap.c | 0
tools/{perf/lib => lib/perf}/evlist.c | 0
tools/{perf/lib => lib/perf}/evsel.c | 0
.../lib => lib/perf}/include/internal/cpumap.h | 0
.../lib => lib/perf}/include/internal/evlist.h | 0
.../lib => lib/perf}/include/internal/evsel.h | 0
.../{perf/lib => lib/perf}/include/internal/lib.h | 0
.../{perf/lib => lib/perf}/include/internal/mmap.h | 0
.../lib => lib/perf}/include/internal/tests.h | 0
.../lib => lib/perf}/include/internal/threadmap.h | 0
.../lib => lib/perf}/include/internal/xyarray.h | 0
tools/{perf/lib => lib/perf}/include/perf/core.h | 0
tools/{perf/lib => lib/perf}/include/perf/cpumap.h | 0
tools/{perf/lib => lib/perf}/include/perf/event.h | 0
tools/{perf/lib => lib/perf}/include/perf/evlist.h | 0
tools/{perf/lib => lib/perf}/include/perf/evsel.h | 0
tools/{perf/lib => lib/perf}/include/perf/mmap.h | 0
.../lib => lib/perf}/include/perf/threadmap.h | 0
tools/{perf/lib => lib/perf}/internal.h | 0
tools/{perf/lib => lib/perf}/lib.c | 0
tools/{perf/lib => lib/perf}/libperf.map | 0
tools/{perf/lib => lib/perf}/libperf.pc.template | 0
tools/{perf/lib => lib/perf}/mmap.c | 0
tools/{perf/lib => lib/perf}/tests/Makefile | 2 +-
tools/{perf/lib => lib/perf}/tests/test-cpumap.c | 0
tools/{perf/lib => lib/perf}/tests/test-evlist.c | 0
tools/{perf/lib => lib/perf}/tests/test-evsel.c | 0
.../{perf/lib => lib/perf}/tests/test-threadmap.c | 0
tools/{perf/lib => lib/perf}/threadmap.c | 0
tools/{perf/lib => lib/perf}/xyarray.c | 0
tools/perf/MANIFEST | 1 +
tools/perf/Makefile.config | 2 +-
tools/perf/Makefile.perf | 2 +-
tools/perf/lib/Documentation/Makefile | 7 -
tools/perf/lib/Documentation/man/libperf.rst | 100 ---------
tools/perf/lib/Documentation/tutorial/tutorial.rst | 123 -----------
50 files changed, 1204 insertions(+), 235 deletions(-)
rename tools/{perf/lib => lib/perf}/Build (100%)
create mode 100644 tools/lib/perf/Documentation/Makefile
create mode 100644 tools/lib/perf/Documentation/asciidoc.conf
create mode 100644 tools/lib/perf/Documentation/examples/sampling.c
create mode 100644 tools/lib/perf/Documentation/libperf-counting.txt
create mode 100644 tools/lib/perf/Documentation/libperf-sampling.txt
create mode 100644 tools/lib/perf/Documentation/libperf.txt
create mode 100644 tools/lib/perf/Documentation/manpage-1.72.xsl
create mode 100644 tools/lib/perf/Documentation/manpage-base.xsl
create mode 100644 tools/lib/perf/Documentation/manpage-bold-literal.xsl
create mode 100644 tools/lib/perf/Documentation/manpage-normal.xsl
create mode 100644 tools/lib/perf/Documentation/manpage-suppress-sp.xsl
rename tools/{perf/lib => lib/perf}/Makefile (96%)
rename tools/{perf/lib => lib/perf}/core.c (100%)
rename tools/{perf/lib => lib/perf}/cpumap.c (100%)
rename tools/{perf/lib => lib/perf}/evlist.c (100%)
rename tools/{perf/lib => lib/perf}/evsel.c (100%)
rename tools/{perf/lib => lib/perf}/include/internal/cpumap.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/evlist.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/evsel.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/lib.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/mmap.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/tests.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/threadmap.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/xyarray.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/core.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/cpumap.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/event.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/evlist.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/evsel.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/mmap.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/threadmap.h (100%)
rename tools/{perf/lib => lib/perf}/internal.h (100%)
rename tools/{perf/lib => lib/perf}/lib.c (100%)
rename tools/{perf/lib => lib/perf}/libperf.map (100%)
rename tools/{perf/lib => lib/perf}/libperf.pc.template (100%)
rename tools/{perf/lib => lib/perf}/mmap.c (100%)
rename tools/{perf/lib => lib/perf}/tests/Makefile (93%)
rename tools/{perf/lib => lib/perf}/tests/test-cpumap.c (100%)
rename tools/{perf/lib => lib/perf}/tests/test-evlist.c (100%)
rename tools/{perf/lib => lib/perf}/tests/test-evsel.c (100%)
rename tools/{perf/lib => lib/perf}/tests/test-threadmap.c (100%)
rename tools/{perf/lib => lib/perf}/threadmap.c (100%)
rename tools/{perf/lib => lib/perf}/xyarray.c (100%)
delete mode 100644 tools/perf/lib/Documentation/Makefile
delete mode 100644 tools/perf/lib/Documentation/man/libperf.rst
delete mode 100644 tools/perf/lib/Documentation/tutorial/tutorial.rstJiri Olsa
reviewerPATCH v2 2/2 libperf: Add man pages
Changing the man page generation to, because it's easier to use and been more common in related projects. Removing the current rst pages.
Adding 3 man pages to have the man page base for more additions:
libperf.3 - overall description
libperf-counting.7 - counting basics explained on simple example libperf-sampling.7 - sampling basics explained on simple example
The plan is to add more man pages to cover the basic API.
The build generates html and man pages:
$ cd tools/lib/perf/Documentation
$ make
ASCIIDOC libperf.xml
XMLTO libperf.3
ASCIIDOC libperf-counting.xml
XMLTO libperf-counting.7
ASCIIDOC libperf-sampling.xml
XMLTO libperf-sampling.7
ASCIIDOC libperf.html
ASCIIDOC libperf-counting.html
ASCIIDOC libperf-sampling.htmlAdding following install targets:
install-man - man pages
install-html - html version of man pages
install-examples - examples mentioned in the man pages
--- tools/lib/perf/Documentation/Makefile | 159 ++++++++++- tools/lib/perf/Documentation/asciidoc.conf | 120 +++++++++ .../perf/Documentation/examples/sampling.c | 119 +++++++++ .../perf/Documentation/libperf-counting.txt | 211 +++++++++++++++ .../perf/Documentation/libperf-sampling.txt | 243 +++++++++++++++++ tools/lib/perf/Documentation/libperf.txt | 246 ++++++++++++++++++ tools/lib/perf/Documentation/man/libperf.rst | 100 ------- tools/lib/perf/Documentation/manpage-1.72.xsl | 14 + tools/lib/perf/Documentation/manpage-base.xsl | 35 +++ .../Documentation/manpage-bold-literal.xsl | 17 ++ .../lib/perf/Documentation/manpage-normal.xsl | 13 + .../Documentation/manpage-suppress-sp.xsl | 21 ++ .../perf/Documentation/tutorial/tutorial.rst | 123 --------- tools/lib/perf/Makefile | 5 +- 14 files changed, 1197 insertions(+), 229 deletions(-) create mode 100644 tools/lib/perf/Documentation/asciidoc.conf create mode 100644 tools/lib/perf/Documentation/examples/sampling.c create mode 100644 tools/lib/perf/Documentation/libperf-counting.txt create mode 100644 tools/lib/perf/Documentation/libperf-sampling.txt create mode 100644 tools/lib/perf/Documentation/libperf.txt delete mode 100644 tools/lib/perf/Documentation/man/libperf.rst create mode 100644 tools/lib/perf/Documentation/manpage-1.72.xsl create mode 100644 tools/lib/perf/Documentation/manpage-base.xsl create mode 100644 tools/lib/perf/Documentation/manpage-bold-literal.xsl create mode 100644 tools/lib/perf/Documentation/manpage-normal.xsl create mode 100644 tools/lib/perf/Documentation/manpage-suppress-sp.xsl delete mode 100644 tools/lib/perf/Documentation/tutorial/tutorial.rst
tools/lib/perf/Documentation/Makefile +154 -5
@@ -1,7 +1,156 @@ -all: - rst2man man/libperf.rst > man/libperf.7 - rst2pdf tutorial/tutorial.rst +# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) +# Most of this file is copied from tools/perf/Documentation/Makefile + +include ../../../scripts/Makefile.include +include ../../../scripts/utilities.mak + +MAN3_TXT = libperf.txt +MAN7_TXT = libperf-counting.txt libperf-sampling.txt +MAN_EX = examples/*.c + +MAN_TXT = $(MAN3_TXT) $(MAN7_TXT) + +_MAN_XML = $(patsubst %.txt,%.xml,$(MAN_TXT)) +_MAN_HTML = $(patsubst %.txt,%.html,$(MAN_TXT)) +_MAN_3 = $(patsubst %.txt,%.3,$(MAN3_TXT)) +_MAN_7 = $(patsubst %.txt,%.7,$(MAN7_TXT)) + +MAN_XML = $(addprefix $(OUTPUT),$(_MAN_XML)) +MAN_HTML = $(addprefix $(OUTPUT),$(_MAN_HTML)) +MAN_3 = $(addprefix $(OUTPUT),$(_MAN_3)) +MAN_7 = $(addprefix $(OUTPUT),$(_MAN_7)) +MAN_X = $(MAN_3) $(MAN_7) + +# Make the path relative to DESTDIR, not prefix +ifndef DESTDIR + prefix ?=$(HOME) +endif + +mandir ?= $(prefix)/share/man +man3dir = $(mandir)/man3 +man7dir = $(mandir)/man7 + +docdir ?= $(prefix)/share/doc/libperf +htmldir = $(docdir)/html +exdir = $(docdir)/examples + +ASCIIDOC = asciidoc +ASCIIDOC_EXTRA = --unsafe -f asciidoc.conf +ASCIIDOC_HTML = xhtml11 +MANPAGE_XSL = manpage-normal.xsl +XMLTO_EXTRA = +XMLTO =xmlto + +INSTALL ?= install +RM ?= rm -f + +# 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 libperf-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 libperf-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 + +DESTDIR ?= +DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))' + +export DESTDIR DESTDIR_SQ + +# Please note that there is a minor bug in asciidoc. +# The version after 6.0.3 _will_ include the patch found here: +# http://marc.theaimsgroup.com/?l=libtraceevent&m=111558757202243&w=2 +# +# Until that version is released you may have to apply the patch +# yourself - yes, all 6 characters of it! + +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 '$@; + endif +endif + +all: $(MAN_X) $(MAN_HTML) + +$(MAN_HTML) $(MAN_X): asciidoc.conf + +install-man: all + $(call QUIET_INSTALL, man) \ + $(INSTALL) -d -m 755 $(DESTDIR)$(man3dir); \ + $(INSTALL) -m 644 $(MAN_3) $(DESTDIR)$(man3dir); \ + $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir); \ + $(INSTALL) -m 644 $(MAN_7) $(DESTDIR)$(man7dir); + +install-html: + $(call QUIET_INSTALL, html) \ + $(INSTALL) -d -m 755 $(DESTDIR)$(htmldir); \ + $(INSTALL) -m 644 $(MAN_HTML) $(DESTDIR)$(htmldir); \ + +install-examples: + $(call QUIET_INSTALL, examples) \ + $(INSTALL) -d -m 755 $(DESTDIR)$(exdir); \ + $(INSTALL) -m 644 $(MAN_EX) $(DESTDIR)$(exdir); \ + +CLEAN_FILES = \ + $(MAN_XML) $(addsuffix +,$(MAN_XML)) \ + $(MAN_HTML) $(addsuffix +,$(MAN_HTML)) \ + $(MAN_X) clean: - rm -f man/libperf.7 - rm -f tutorial/tutorial.pdf + $(call QUIET_CLEAN, Documentation) $(RM) $(CLEAN_FILES) + +$(MAN_3): $(OUTPUT)%.3: %.xml + $(QUIET_XMLTO)$(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< + +$(MAN_7): $(OUTPUT)%.7: %.xml + $(QUIET_XMLTO)$(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< + +$(MAN_XML): $(OUTPUT)%.xml: %.txt + $(QUIET_ASCIIDOC)$(ASCIIDOC) -b docbook -d manpage \ + $(ASCIIDOC_EXTRA) -alibperf_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \ + mv $@+ $@ + +$(MAN_HTML): $(OUTPUT)%.html: %.txt + $(QUIET_ASCIIDOC)$(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage \ + $(ASCIIDOC_EXTRA) -aperf_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \ + mv $@+ $@
tools/lib/perf/Documentation/asciidoc.conf new file +120 -0
120 lines not on this page · raw message
tools/lib/perf/Documentation/examples/sampling.c new file +119 -0
119 lines not on this page · raw message
tools/lib/perf/Documentation/libperf-counting.txt new file +211 -0
211 lines not on this page · raw message
tools/lib/perf/Documentation/libperf-sampling.txt new file +243 -0
243 lines not on this page · raw message
tools/lib/perf/Documentation/libperf.txt new file +246 -0
246 lines not on this page · raw message
tools/lib/perf/Documentation/man/libperf.rst deleted +0 -100
100 lines not on this page · raw message
tools/lib/perf/Documentation/manpage-1.72.xsl new file +14 -0
@@ -0,0 +1,14 @@ +<!-- manpage-1.72.xsl: + special settings for manpages rendered from asciidoc+docbook + handles peculiarities in docbook-xsl 1.72.0 --> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + +<xsl:import href="manpage-base.xsl"/> + +<!-- these are the special values for the roff control characters + needed for docbook-xsl 1.72.0 --> +<xsl:param name="git.docbook.backslash">▓</xsl:param> +<xsl:param name="git.docbook.dot" >⌂</xsl:param> + +</xsl:stylesheet>
tools/lib/perf/Documentation/manpage-base.xsl new file +35 -0
@@ -0,0 +1,35 @@ +<!-- manpage-base.xsl: + special formatting for manpages rendered from asciidoc+docbook --> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + +<!-- these params silence some output from xmlto --> +<xsl:param name="man.output.quietly" select="1"/> +<xsl:param name="refentry.meta.get.quietly" select="1"/> + +<!-- convert asciidoc callouts to man page format; + git.docbook.backslash and git.docbook.dot params + must be supplied by another XSL file or other means --> +<xsl:template match="co"> + <xsl:value-of select="concat( + $git.docbook.backslash,'fB(', + substring-after(@id,'-'),')', + $git.docbook.backslash,'fR')"/> +</xsl:template> +<xsl:template match="calloutlist"> + <xsl:value-of select="$git.docbook.dot"/> + <xsl:text>sp </xsl:text> + <xsl:apply-templates/> + <xsl:text> </xsl:text> +</xsl:template> +<xsl:template match="callout"> + <xsl:value-of select="concat( + $git.docbook.backslash,'fB', + substring-after(@arearefs,'-'), + '. ',$git.docbook.backslash,'fR')"/> + <xsl:apply-templates/> + <xsl:value-of select="$git.docbook.dot"/> + <xsl:text>br </xsl:text> +</xsl:template> + +</xsl:stylesheet>
tools/lib/perf/Documentation/manpage-bold-literal.xsl new file +17 -0
@@ -0,0 +1,17 @@ +<!-- manpage-bold-literal.xsl: + special formatting for manpages rendered from asciidoc+docbook --> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + +<!-- render literal text as bold (instead of plain or monospace); + this makes literal text easier to distinguish in manpages + viewed on a tty --> +<xsl:template match="literal"> + <xsl:value-of select="$git.docbook.backslash"/> + <xsl:text>fB</xsl:text> + <xsl:apply-templates/> + <xsl:value-of select="$git.docbook.backslash"/> + <xsl:text>fR</xsl:text> +</xsl:template> + +</xsl:stylesheet>
tools/lib/perf/Documentation/manpage-normal.xsl new file +13 -0
@@ -0,0 +1,13 @@ +<!-- manpage-normal.xsl: + special settings for manpages rendered from asciidoc+docbook + handles anything we want to keep away from docbook-xsl 1.72.0 --> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + +<xsl:import href="manpage-base.xsl"/> + +<!-- these are the normal values for the roff control characters --> +<xsl:param name="git.docbook.backslash">\</xsl:param> +<xsl:param name="git.docbook.dot" >.</xsl:param> + +</xsl:stylesheet>
tools/lib/perf/Documentation/manpage-suppress-sp.xsl new file +21 -0
@@ -0,0 +1,21 @@ +<!-- manpage-suppress-sp.xsl: + special settings for manpages rendered from asciidoc+docbook + handles erroneous, inline .sp in manpage output of some + versions of docbook-xsl --> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + +<!-- attempt to work around spurious .sp at the tail of the line + that some versions of docbook stylesheets seem to add --> +<xsl:template match="simpara"> + <xsl:variable name="content"> + <xsl:apply-templates/> + </xsl:variable> + <xsl:value-of select="normalize-space($content)"/> + <xsl:if test="not(ancestor::authorblurb) and + not(ancestor::personblurb)"> + <xsl:text> </xsl:text> + </xsl:if> +</xsl:template> + +</xsl:stylesheet>
tools/lib/perf/Documentation/tutorial/tutorial.rst deleted +0 -123
123 lines not on this page · raw message
tools/lib/perf/Makefile +4 -1
@@ -181,7 +181,10 @@ install_pkgconfig: $(LIBPERF_PC) $(call QUIET_INSTALL, $(LIBPERF_PC)) \ $(call do_install,$(LIBPERF_PC),$(libdir_SQ)/pkgconfig,644) -install: install_lib install_headers install_pkgconfig +install_doc: + $(Q)$(MAKE) -C Documentation install-man install-html install-examples + +install: install_lib install_headers install_pkgconfig install_doc FORCE:
Signature · 1 line
2.21.0
Jiri Olsa
reviewerPATCH v2 1/2 libperf: Move libperf under tools/lib/perf
In reply to Jiri OlsaMoving libperf from its current location under perf to separate directory under tools/lib.
Also changing various paths (mainly include) to reflect the libperf move under separate directory and adding new directory under MANIFEST.
--- tools/lib/perf/Build | 13 + tools/lib/perf/Documentation/Makefile | 7 + tools/lib/perf/Documentation/man/libperf.rst | 100 +++ .../perf/Documentation/tutorial/tutorial.rst | 123 ++++ tools/lib/perf/Makefile | 188 +++++ tools/lib/perf/core.c | 38 ++ tools/lib/perf/cpumap.c | 345 ++++++++++ tools/lib/perf/evlist.c | 641 ++++++++++++++++++ tools/lib/perf/evsel.c | 301 ++++++++ tools/lib/perf/include/internal/cpumap.h | 19 + tools/lib/perf/include/internal/evlist.h | 127 ++++ tools/lib/perf/include/internal/evsel.h | 63 ++ tools/lib/perf/include/internal/lib.h | 12 + tools/lib/perf/include/internal/mmap.h | 55 ++ tools/lib/perf/include/internal/tests.h | 33 + tools/lib/perf/include/internal/threadmap.h | 23 + tools/lib/perf/include/internal/xyarray.h | 36 + tools/lib/perf/include/perf/core.h | 25 + tools/lib/perf/include/perf/cpumap.h | 28 + tools/lib/perf/include/perf/event.h | 385 +++++++++++ tools/lib/perf/include/perf/evlist.h | 49 ++ tools/lib/perf/include/perf/evsel.h | 40 ++ tools/lib/perf/include/perf/mmap.h | 15 + tools/lib/perf/include/perf/threadmap.h | 20 + tools/lib/perf/internal.h | 23 + tools/lib/perf/lib.c | 48 ++ tools/lib/perf/libperf.map | 51 ++ tools/lib/perf/libperf.pc.template | 11 + tools/lib/perf/mmap.c | 275 ++++++++ tools/lib/perf/tests/Makefile | 38 ++ tools/lib/perf/tests/test-cpumap.c | 31 + tools/lib/perf/tests/test-evlist.c | 413 +++++++++++ tools/lib/perf/tests/test-evsel.c | 135 ++++ tools/lib/perf/tests/test-threadmap.c | 31 + tools/lib/perf/threadmap.c | 91 +++ tools/lib/perf/xyarray.c | 33 + tools/perf/MANIFEST | 1 + tools/perf/Makefile.config | 2 +- tools/perf/Makefile.perf | 2 +- tools/perf/lib/Build | 13 - tools/perf/lib/Documentation/Makefile | 7 - tools/perf/lib/Documentation/man/libperf.rst | 100 --- .../lib/Documentation/tutorial/tutorial.rst | 123 ---- tools/perf/lib/Makefile | 188 ----- tools/perf/lib/core.c | 38 -- tools/perf/lib/cpumap.c | 345 ---------- tools/perf/lib/evlist.c | 641 ------------------ tools/perf/lib/evsel.c | 301 -------- tools/perf/lib/include/internal/cpumap.h | 19 - tools/perf/lib/include/internal/evlist.h | 127 ---- tools/perf/lib/include/internal/evsel.h | 63 -- tools/perf/lib/include/internal/lib.h | 12 - tools/perf/lib/include/internal/mmap.h | 55 -- tools/perf/lib/include/internal/tests.h | 33 - tools/perf/lib/include/internal/threadmap.h | 23 - tools/perf/lib/include/internal/xyarray.h | 36 - tools/perf/lib/include/perf/core.h | 25 - tools/perf/lib/include/perf/cpumap.h | 28 - tools/perf/lib/include/perf/event.h | 385 ----------- tools/perf/lib/include/perf/evlist.h | 49 -- tools/perf/lib/include/perf/evsel.h | 40 -- tools/perf/lib/include/perf/mmap.h | 15 - tools/perf/lib/include/perf/threadmap.h | 20 - tools/perf/lib/internal.h | 23 - tools/perf/lib/lib.c | 48 -- tools/perf/lib/libperf.map | 51 -- tools/perf/lib/libperf.pc.template | 11 - tools/perf/lib/mmap.c | 275 -------- tools/perf/lib/tests/Makefile | 38 -- tools/perf/lib/tests/test-cpumap.c | 31 - tools/perf/lib/tests/test-evlist.c | 413 ----------- tools/perf/lib/tests/test-evsel.c | 135 ---- tools/perf/lib/tests/test-threadmap.c | 31 - tools/perf/lib/threadmap.c | 91 --- tools/perf/lib/xyarray.c | 33 - 75 files changed, 3869 insertions(+), 3868 deletions(-) create mode 100644 tools/lib/perf/Build create mode 100644 tools/lib/perf/Documentation/Makefile create mode 100644 tools/lib/perf/Documentation/man/libperf.rst create mode 100644 tools/lib/perf/Documentation/tutorial/tutorial.rst create mode 100644 tools/lib/perf/Makefile create mode 100644 tools/lib/perf/core.c create mode 100644 tools/lib/perf/cpumap.c create mode 100644 tools/lib/perf/evlist.c create mode 100644 tools/lib/perf/evsel.c create mode 100644 tools/lib/perf/include/internal/cpumap.h create mode 100644 tools/lib/perf/include/internal/evlist.h create mode 100644 tools/lib/perf/include/internal/evsel.h create mode 100644 tools/lib/perf/include/internal/lib.h create mode 100644 tools/lib/perf/include/internal/mmap.h create mode 100644 tools/lib/perf/include/internal/tests.h create mode 100644 tools/lib/perf/include/internal/threadmap.h create mode 100644 tools/lib/perf/include/internal/xyarray.h create mode 100644 tools/lib/perf/include/perf/core.h create mode 100644 tools/lib/perf/include/perf/cpumap.h create mode 100644 tools/lib/perf/include/perf/event.h create mode 100644 tools/lib/perf/include/perf/evlist.h create mode 100644 tools/lib/perf/include/perf/evsel.h create mode 100644 tools/lib/perf/include/perf/mmap.h create mode 100644 tools/lib/perf/include/perf/threadmap.h create mode 100644 tools/lib/perf/internal.h create mode 100644 tools/lib/perf/lib.c create mode 100644 tools/lib/perf/libperf.map create mode 100644 tools/lib/perf/libperf.pc.template create mode 100644 tools/lib/perf/mmap.c create mode 100644 tools/lib/perf/tests/Makefile create mode 100644 tools/lib/perf/tests/test-cpumap.c create mode 100644 tools/lib/perf/tests/test-evlist.c create mode 100644 tools/lib/perf/tests/test-evsel.c create mode 100644 tools/lib/perf/tests/test-threadmap.c create mode 100644 tools/lib/perf/threadmap.c create mode 100644 tools/lib/perf/xyarray.c delete mode 100644 tools/perf/lib/Build delete mode 100644 tools/perf/lib/Documentation/Makefile delete mode 100644 tools/perf/lib/Documentation/man/libperf.rst delete mode 100644 tools/perf/lib/Documentation/tutorial/tutorial.rst delete mode 100644 tools/perf/lib/Makefile delete mode 100644 tools/perf/lib/core.c delete mode 100644 tools/perf/lib/cpumap.c delete mode 100644 tools/perf/lib/evlist.c delete mode 100644 tools/perf/lib/evsel.c delete mode 100644 tools/perf/lib/include/internal/cpumap.h delete mode 100644 tools/perf/lib/include/internal/evlist.h delete mode 100644 tools/perf/lib/include/internal/evsel.h delete mode 100644 tools/perf/lib/include/internal/lib.h delete mode 100644 tools/perf/lib/include/internal/mmap.h delete mode 100644 tools/perf/lib/include/internal/tests.h delete mode 100644 tools/perf/lib/include/internal/threadmap.h delete mode 100644 tools/perf/lib/include/internal/xyarray.h delete mode 100644 tools/perf/lib/include/perf/core.h delete mode 100644 tools/perf/lib/include/perf/cpumap.h delete mode 100644 tools/perf/lib/include/perf/event.h delete mode 100644 tools/perf/lib/include/perf/evlist.h delete mode 100644 tools/perf/lib/include/perf/evsel.h delete mode 100644 tools/perf/lib/include/perf/mmap.h delete mode 100644 tools/perf/lib/include/perf/threadmap.h delete mode 100644 tools/perf/lib/internal.h delete mode 100644 tools/perf/lib/lib.c delete mode 100644 tools/perf/lib/libperf.map delete mode 100644 tools/perf/lib/libperf.pc.template delete mode 100644 tools/perf/lib/mmap.c delete mode 100644 tools/perf/lib/tests/Makefile delete mode 100644 tools/perf/lib/tests/test-cpumap.c delete mode 100644 tools/perf/lib/tests/test-evlist.c delete mode 100644 tools/perf/lib/tests/test-evsel.c delete mode 100644 tools/perf/lib/tests/test-threadmap.c delete mode 100644 tools/perf/lib/threadmap.c delete mode 100644 tools/perf/lib/xyarray.c
tools/lib/perf/Build new file +13 -0
@@ -0,0 +1,13 @@ +libperf-y += core.o +libperf-y += cpumap.o +libperf-y += threadmap.o +libperf-y += evsel.o +libperf-y += evlist.o +libperf-y += mmap.o +libperf-y += zalloc.o +libperf-y += xyarray.o +libperf-y += lib.o + +$(OUTPUT)zalloc.o: ../../lib/zalloc.c FORCE + $(call rule_mkdir) + $(call if_changed_dep,cc_o_c)
tools/lib/perf/Documentation/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +all: + rst2man man/libperf.rst > man/libperf.7 + rst2pdf tutorial/tutorial.rst + +clean: + rm -f man/libperf.7 + rm -f tutorial/tutorial.pdf
tools/lib/perf/Documentation/man/libperf.rst new file +100 -0
100 lines not on this page · raw message
tools/lib/perf/Documentation/tutorial/tutorial.rst new file +123 -0
123 lines not on this page · raw message
tools/lib/perf/Makefile new file +188 -0
188 lines not on this page · raw message
tools/lib/perf/core.c new file +38 -0
@@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#define __printf (a, b) __attribute__((format(printf, a, b))) + +#include <stdio.h> +#include <stdarg.h> +#include <unistd.h> +#include <linux/compiler.h> +#include <perf/core.h> +#include <internal/lib.h> +#include "internal.h" + +static int __base_pr (enum libperf_print_level level__maybe_unused ,const char *format, +va_list args) +{ +return vfprintf (stderr, format, args); +} + +static libperf_print_fn_t __libperf_pr = __base_pr; + +__printf(2, 3) +void libperf_print (enum libperf_print_level level,const char *format, ...) +{ +va_list args; + +if (!__libperf_pr) +return ; + +va_start (args, format); +__libperf_pr (level, format, args); +va_end (args); +} + +void libperf_init (libperf_print_fn_t fn) +{ + page_size =sysconf (_SC_PAGE_SIZE); + __libperf_pr = fn; +}
tools/lib/perf/cpumap.c new file +345 -0
345 lines not on this page · raw message
tools/lib/perf/evlist.c new file +641 -0
641 lines not on this page · raw message
tools/lib/perf/evsel.c new file +301 -0
301 lines not on this page · raw message
tools/lib/perf/include/internal/cpumap.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_INTERNAL_CPUMAP_H +#define __LIBPERF_INTERNAL_CPUMAP_H + +#include <linux/refcount.h> + +struct perf_cpu_map { +refcount_t refcnt; +int nr; +int map[]; +}; + +#ifndef MAX_NR_CPUS +#define MAX_NR_CPUS 2048 +#endif + +int perf_cpu_map__idx (struct perf_cpu_map *cpus,int cpu); + +#endif /* __LIBPERF_INTERNAL_CPUMAP_H */
tools/lib/perf/include/internal/evlist.h new file +127 -0
127 lines not on this page · raw message
tools/lib/perf/include/internal/evsel.h new file +63 -0
63 lines not on this page · raw message
tools/lib/perf/include/internal/lib.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_INTERNAL_LIB_H +#define __LIBPERF_INTERNAL_LIB_H + +#include <sys/types.h> + +extern unsigned int page_size; + +ssize_t readn (int fd,void *buf,size_t n); +ssize_t writen (int fd,const void *buf,size_t n); + +#endif /* __LIBPERF_INTERNAL_CPUMAP_H */
tools/lib/perf/include/internal/mmap.h new file +55 -0
55 lines not on this page · raw message
tools/lib/perf/include/internal/tests.h new file +33 -0
@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_INTERNAL_TESTS_H +#define __LIBPERF_INTERNAL_TESTS_H + +#include <stdio.h> + +int tests_failed; + +#define __T_START \ +do { \ + fprintf(stdout, "- running %s...", __FILE__); \ + fflush(NULL); \ + tests_failed = 0; \ +} while (0) + +#define __T_END \ +do { \ + if (tests_failed) \ + fprintf(stdout, " FAILED (%d)\n", tests_failed); \ + else \ + fprintf(stdout, "OK\n"); \ +} while (0) + +#define __T (text, cond) \ +do { \ + if (!(cond)) { \ + fprintf(stderr, "FAILED %s:%d %s\n", __FILE__, __LINE__, text); \ + tests_failed++; \ + return -1; \ + } \ +} while (0) + +#endif /* __LIBPERF_INTERNAL_TESTS_H */
tools/lib/perf/include/internal/threadmap.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_INTERNAL_THREADMAP_H +#define __LIBPERF_INTERNAL_THREADMAP_H + +#include <linux/refcount.h> +#include <sys/types.h> +#include <unistd.h> + +struct thread_map_data { +pid_t pid; +char *comm; +}; + +struct perf_thread_map { +refcount_t refcnt; +int nr; +int err_thread; +struct thread_map_data map[]; +}; + +struct perf_thread_map *perf_thread_map__realloc (struct perf_thread_map *map,int nr); + +#endif /* __LIBPERF_INTERNAL_THREADMAP_H */
tools/lib/perf/include/internal/xyarray.h new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_INTERNAL_XYARRAY_H +#define __LIBPERF_INTERNAL_XYARRAY_H + +#include <linux/compiler.h> +#include <sys/types.h> + +struct xyarray { +size_t row_size; +size_t entry_size; +size_t entries; +size_t max_x; +size_t max_y; +char contents[]__aligned(8) ; +}; + +struct xyarray *xyarray__new (int xlen,int ylen,size_t entry_size); +void xyarray__delete (struct xyarray *xy); +void xyarray__reset (struct xyarray *xy); + +static inline void *xyarray__entry (struct xyarray *xy,int x,int y) +{ +return &xy->contents[x * xy->row_size + y * xy->entry_size]; +} + +static inline int xyarray__max_y (struct xyarray *xy) +{ +return xy->max_y; +} + +static inline int xyarray__max_x (struct xyarray *xy) +{ +return xy->max_x; +} + +#endif /* __LIBPERF_INTERNAL_XYARRAY_H */
tools/lib/perf/include/perf/core.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_CORE_H +#define __LIBPERF_CORE_H + +#include <stdarg.h> + +#ifndef LIBPERF_API +#define LIBPERF_API __attribute__((visibility("default"))) +#endif + +enum libperf_print_level { +LIBPERF_ERR , +LIBPERF_WARN , +LIBPERF_INFO , +LIBPERF_DEBUG , +LIBPERF_DEBUG2 , +LIBPERF_DEBUG3 , +}; + +typedef int (*libperf_print_fn_t )(enum libperf_print_level level, +const char *,va_list ap); + +LIBPERF_API void libperf_init(libperf_print_fn_t fn); + +#endif /* __LIBPERF_CORE_H */
tools/lib/perf/include/perf/cpumap.h new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_CPUMAP_H +#define __LIBPERF_CPUMAP_H + +#include <perf/core.h> +#include <stdio.h> +#include <stdbool.h> + +struct perf_cpu_map ; + +LIBPERF_API struct perf_cpu_map *perf_cpu_map__dummy_new(void); +LIBPERF_API struct perf_cpu_map *perf_cpu_map__new(const char *cpu_list); +LIBPERF_API struct perf_cpu_map *perf_cpu_map__read(FILE *file); +LIBPERF_API struct perf_cpu_map *perf_cpu_map__get(struct perf_cpu_map *map); +LIBPERF_API struct perf_cpu_map *perf_cpu_map__merge(struct perf_cpu_map *orig, +struct perf_cpu_map *other); +LIBPERF_API void perf_cpu_map__put(struct perf_cpu_map *map); +LIBPERF_API int perf_cpu_map__cpu(const struct perf_cpu_map *cpus, int idx); +LIBPERF_API int perf_cpu_map__nr(const struct perf_cpu_map *cpus); +LIBPERF_API bool perf_cpu_map__empty(const struct perf_cpu_map *map); +LIBPERF_API int perf_cpu_map__max(struct perf_cpu_map *map); + +#define perf_cpu_map__for_each_cpu (cpu, idx, cpus) \ + for ((idx) = 0, (cpu) = perf_cpu_map__cpu(cpus, idx); \ + (idx) < perf_cpu_map__nr(cpus); \ + (idx)++, (cpu) = perf_cpu_map__cpu(cpus, idx)) + +#endif /* __LIBPERF_CPUMAP_H */
tools/lib/perf/include/perf/event.h new file +385 -0
385 lines not on this page · raw message
tools/lib/perf/include/perf/evlist.h new file +49 -0
49 lines not on this page · raw message
tools/lib/perf/include/perf/evsel.h new file +40 -0
@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_EVSEL_H +#define __LIBPERF_EVSEL_H + +#include <stdint.h> +#include <perf/core.h> + +struct perf_evsel ; +struct perf_event_attr ; +struct perf_cpu_map ; +struct perf_thread_map ; + +struct perf_counts_values { +union { +struct { +uint64_t val; +uint64_t ena; +uint64_t run; + }; +uint64_t values[3 ]; + }; +}; + +LIBPERF_API struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr); +LIBPERF_API void perf_evsel__delete(struct perf_evsel *evsel); +LIBPERF_API int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus, +struct perf_thread_map *threads); +LIBPERF_API void perf_evsel__close(struct perf_evsel *evsel); +LIBPERF_API void perf_evsel__close_cpu(struct perf_evsel *evsel, int cpu); +LIBPERF_API int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread, +struct perf_counts_values *count); +LIBPERF_API int perf_evsel__enable(struct perf_evsel *evsel); +LIBPERF_API int perf_evsel__enable_cpu(struct perf_evsel *evsel, int cpu); +LIBPERF_API int perf_evsel__disable(struct perf_evsel *evsel); +LIBPERF_API int perf_evsel__disable_cpu(struct perf_evsel *evsel, int cpu); +LIBPERF_API struct perf_cpu_map *perf_evsel__cpus(struct perf_evsel *evsel); +LIBPERF_API struct perf_thread_map *perf_evsel__threads(struct perf_evsel *evsel); +LIBPERF_API struct perf_event_attr *perf_evsel__attr(struct perf_evsel *evsel); + +#endif /* __LIBPERF_EVSEL_H */
tools/lib/perf/include/perf/mmap.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_MMAP_H +#define __LIBPERF_MMAP_H + +#include <perf/core.h> + +struct perf_mmap ; +union perf_event ; + +LIBPERF_API void perf_mmap__consume(struct perf_mmap *map); +LIBPERF_API int perf_mmap__read_init(struct perf_mmap *map); +LIBPERF_API void perf_mmap__read_done(struct perf_mmap *map); +LIBPERF_API union perf_event *perf_mmap__read_event(struct perf_mmap *map); + +#endif /* __LIBPERF_MMAP_H */
tools/lib/perf/include/perf/threadmap.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_THREADMAP_H +#define __LIBPERF_THREADMAP_H + +#include <perf/core.h> +#include <sys/types.h> + +struct perf_thread_map ; + +LIBPERF_API struct perf_thread_map *perf_thread_map__new_dummy(void); + +LIBPERF_API void perf_thread_map__set_pid(struct perf_thread_map *map, int thread, pid_t pid); +LIBPERF_API char *perf_thread_map__comm(struct perf_thread_map *map, int thread); +LIBPERF_API int perf_thread_map__nr(struct perf_thread_map *threads); +LIBPERF_API pid_t perf_thread_map__pid(struct perf_thread_map *map, int thread); + +LIBPERF_API struct perf_thread_map *perf_thread_map__get(struct perf_thread_map *map); +LIBPERF_API void perf_thread_map__put(struct perf_thread_map *map); + +#endif /* __LIBPERF_THREADMAP_H */
tools/lib/perf/internal.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_INTERNAL_H +#define __LIBPERF_INTERNAL_H + +#include <perf/core.h> + +void libperf_print (enum libperf_print_level level, +const char *format, ...) + __attribute__((format (printf,2 ,3 ))); + +#define __pr (level, fmt, ...) \ +do { \ + libperf_print(level, "libperf: " fmt, ##__VA_ARGS__); \ +} while (0) + +#define pr_err (fmt, ...) __pr(LIBPERF_ERR, fmt, ##__VA_ARGS__) +#define pr_warning (fmt, ...) __pr(LIBPERF_WARN, fmt, ##__VA_ARGS__) +#define pr_info (fmt, ...) __pr(LIBPERF_INFO, fmt, ##__VA_ARGS__) +#define pr_debug (fmt, ...) __pr(LIBPERF_DEBUG, fmt, ##__VA_ARGS__) +#define pr_debug2 (fmt, ...) __pr(LIBPERF_DEBUG2, fmt, ##__VA_ARGS__) +#define pr_debug3 (fmt, ...) __pr(LIBPERF_DEBUG3, fmt, ##__VA_ARGS__) + +#endif /* __LIBPERF_INTERNAL_H */
tools/lib/perf/lib.c new file +48 -0
48 lines not on this page · raw message
tools/lib/perf/libperf.map new file +51 -0
51 lines not on this page · raw message
tools/lib/perf/libperf.pc.template new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) + +prefix=@PREFIX@ +libdir=@LIBDIR@ +includedir=${prefix}/include + +Name: libperf +Description: perf library +Version: @VERSION@ +Libs: -L${libdir} -lperf +Cflags: -I${includedir}
tools/lib/perf/mmap.c new file +275 -0
181 lines not on this page · raw message
tools/lib/perf/tests/Makefile new file +38 -0
Lines of this file are not shown. View the raw message.
tools/lib/perf/tests/test-cpumap.c new file +31 -0
Lines of this file are not shown. View the raw message.
tools/lib/perf/tests/test-evlist.c new file +413 -0
413 lines not on this page · raw message
tools/lib/perf/tests/test-evsel.c new file +135 -0
135 lines not on this page · raw message
tools/lib/perf/tests/test-threadmap.c new file +31 -0
Lines of this file are not shown. View the raw message.
tools/lib/perf/threadmap.c new file +91 -0
91 lines not on this page · raw message
tools/perf/lib/Documentation/Makefile deleted +0 -7
Lines of this file are not shown. View the raw message.
tools/perf/lib/Documentation/man/libperf.rst deleted +0 -100
100 lines not on this page · raw message
tools/perf/lib/Documentation/tutorial/tutorial.rst deleted +0 -123
123 lines not on this page · raw message
tools/perf/lib/Makefile deleted +0 -188
188 lines not on this page · raw message
tools/perf/lib/cpumap.c deleted +0 -345
345 lines not on this page · raw message
tools/perf/lib/evlist.c deleted +0 -641
641 lines not on this page · raw message
tools/perf/lib/evsel.c deleted +0 -301
301 lines not on this page · raw message
tools/perf/lib/include/internal/cpumap.h deleted +0 -19
Lines of this file are not shown. View the raw message.
tools/perf/lib/include/internal/evlist.h deleted +0 -127
127 lines not on this page · raw message
tools/perf/lib/include/internal/evsel.h deleted +0 -63
63 lines not on this page · raw message
tools/perf/lib/include/internal/lib.h deleted +0 -12
Lines of this file are not shown. View the raw message.
tools/perf/lib/include/internal/mmap.h deleted +0 -55
55 lines not on this page · raw message
tools/perf/lib/include/internal/tests.h deleted +0 -33
Lines of this file are not shown. View the raw message.
tools/perf/lib/include/internal/threadmap.h deleted +0 -23
Lines of this file are not shown. View the raw message.
tools/perf/lib/include/internal/xyarray.h deleted +0 -36
Lines of this file are not shown. View the raw message.
tools/perf/lib/include/perf/core.h deleted +0 -25
Lines of this file are not shown. View the raw message.
tools/perf/lib/include/perf/cpumap.h deleted +0 -28
Lines of this file are not shown. View the raw message.
tools/perf/lib/include/perf/event.h deleted +0 -385
385 lines not on this page · raw message
tools/perf/lib/include/perf/evlist.h deleted +0 -49
49 lines not on this page · raw message
tools/perf/lib/include/perf/evsel.h deleted +0 -40
Lines of this file are not shown. View the raw message.
tools/perf/lib/include/perf/mmap.h deleted +0 -15
Lines of this file are not shown. View the raw message.
tools/perf/lib/include/perf/threadmap.h deleted +0 -20
Lines of this file are not shown. View the raw message.
tools/perf/lib/lib.c deleted +0 -48
48 lines not on this page · raw message
tools/perf/lib/libperf.map deleted +0 -51
51 lines not on this page · raw message
tools/perf/lib/libperf.pc.template deleted +0 -11
Lines of this file are not shown. View the raw message.
tools/perf/lib/mmap.c deleted +0 -275
275 lines not on this page · raw message
tools/perf/lib/tests/test-cpumap.c deleted +0 -31
Lines of this file are not shown. View the raw message.
tools/perf/lib/tests/test-evlist.c deleted +0 -413
413 lines not on this page · raw message
tools/perf/lib/tests/test-evsel.c deleted +0 -135
135 lines not on this page · raw message
tools/perf/lib/tests/test-threadmap.c deleted +0 -31
Lines of this file are not shown. View the raw message.
tools/perf/lib/threadmap.c deleted +0 -91
91 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.21.0
Part of the diff is not shown here. View the raw message.
[tip: perf/core] libperf: Add man pages
In reply to Jiri OlsaThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 81de3bf37a8bf58ecdbef608d16ddb0f4bbb71ca Gitweb: https://git.kernel.org/tip/81de3bf37a8bf58ecdbef608d16ddb0f4bbb71ca Author: Jiri Olsa <[email protected]> AuthorDate: Fri, 06 Dec 2019 22:06:12 +01:00 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Mon, 06 Jan 2020 11:46:09 -03:00
libperf: Add man pages
Change the man page generation to asciidoc, because it's easier to use and has been more commonly used in related projects. Remove the current rst pages.
Add 3 man pages to have a base for more additions:
libperf.3 - overall description
libperf-counting.7 - counting basics explained on simple example libperf-sampling.7 - sampling basics explained on simple example
The plan is to add more man pages to cover the basic API.
The build generates html and man pages:
$ cd tools/lib/perf/Documentation
$ make
ASCIIDOC libperf.xml
XMLTO libperf.3
ASCIIDOC libperf-counting.xml
XMLTO libperf-counting.7
ASCIIDOC libperf-sampling.xml
XMLTO libperf-sampling.7
ASCIIDOC libperf.html
ASCIIDOC libperf-counting.html
ASCIIDOC libperf-sampling.htmlAdd the following install targets:
install-man - man pages
install-html - html version of man pages
install-examples - examples mentioned in the man pages
--- tools/lib/perf/Documentation/Makefile | 159 +++++- tools/lib/perf/Documentation/asciidoc.conf | 120 ++++- tools/lib/perf/Documentation/examples/sampling.c | 119 ++++- tools/lib/perf/Documentation/libperf-counting.txt | 211 ++++++++- tools/lib/perf/Documentation/libperf-sampling.txt | 243 +++++++++- tools/lib/perf/Documentation/libperf.txt | 246 +++++++++- tools/lib/perf/Documentation/man/libperf.rst | 100 +---- tools/lib/perf/Documentation/manpage-1.72.xsl | 14 +- tools/lib/perf/Documentation/manpage-base.xsl | 35 +- tools/lib/perf/Documentation/manpage-bold-literal.xsl | 17 +- tools/lib/perf/Documentation/manpage-normal.xsl | 13 +- tools/lib/perf/Documentation/manpage-suppress-sp.xsl | 21 +- tools/lib/perf/Documentation/tutorial/tutorial.rst | 123 +----- tools/lib/perf/Makefile | 5 +- 14 files changed, 1197 insertions(+), 229 deletions(-) create mode 100644 tools/lib/perf/Documentation/asciidoc.conf create mode 100644 tools/lib/perf/Documentation/examples/sampling.c create mode 100644 tools/lib/perf/Documentation/libperf-counting.txt create mode 100644 tools/lib/perf/Documentation/libperf-sampling.txt create mode 100644 tools/lib/perf/Documentation/libperf.txt delete mode 100644 tools/lib/perf/Documentation/man/libperf.rst create mode 100644 tools/lib/perf/Documentation/manpage-1.72.xsl create mode 100644 tools/lib/perf/Documentation/manpage-base.xsl create mode 100644 tools/lib/perf/Documentation/manpage-bold-literal.xsl create mode 100644 tools/lib/perf/Documentation/manpage-normal.xsl create mode 100644 tools/lib/perf/Documentation/manpage-suppress-sp.xsl delete mode 100644 tools/lib/perf/Documentation/tutorial/tutorial.rst
tools/lib/perf/Documentation/Makefile +154 -5
@@ -1,7 +1,156 @@ -all: - rst2man man/libperf.rst > man/libperf.7 - rst2pdf tutorial/tutorial.rst +# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) +# Most of this file is copied from tools/perf/Documentation/Makefile + +include ../../../scripts/Makefile.include +include ../../../scripts/utilities.mak + +MAN3_TXT = libperf.txt +MAN7_TXT = libperf-counting.txt libperf-sampling.txt +MAN_EX = examples/*.c + +MAN_TXT = $(MAN3_TXT) $(MAN7_TXT) + +_MAN_XML = $(patsubst %.txt,%.xml,$(MAN_TXT)) +_MAN_HTML = $(patsubst %.txt,%.html,$(MAN_TXT)) +_MAN_3 = $(patsubst %.txt,%.3,$(MAN3_TXT)) +_MAN_7 = $(patsubst %.txt,%.7,$(MAN7_TXT)) + +MAN_XML = $(addprefix $(OUTPUT),$(_MAN_XML)) +MAN_HTML = $(addprefix $(OUTPUT),$(_MAN_HTML)) +MAN_3 = $(addprefix $(OUTPUT),$(_MAN_3)) +MAN_7 = $(addprefix $(OUTPUT),$(_MAN_7)) +MAN_X = $(MAN_3) $(MAN_7) + +# Make the path relative to DESTDIR, not prefix +ifndef DESTDIR + prefix ?=$(HOME) +endif + +mandir ?= $(prefix)/share/man +man3dir = $(mandir)/man3 +man7dir = $(mandir)/man7 + +docdir ?= $(prefix)/share/doc/libperf +htmldir = $(docdir)/html +exdir = $(docdir)/examples + +ASCIIDOC = asciidoc +ASCIIDOC_EXTRA = --unsafe -f asciidoc.conf +ASCIIDOC_HTML = xhtml11 +MANPAGE_XSL = manpage-normal.xsl +XMLTO_EXTRA = +XMLTO =xmlto + +INSTALL ?= install +RM ?= rm -f + +# 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 libperf-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 libperf-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 + +DESTDIR ?= +DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))' + +export DESTDIR DESTDIR_SQ + +# Please note that there is a minor bug in asciidoc. +# The version after 6.0.3 _will_ include the patch found here: +# http://marc.theaimsgroup.com/?l=libtraceevent&m=111558757202243&w=2 +# +# Until that version is released you may have to apply the patch +# yourself - yes, all 6 characters of it! + +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 '$@; + endif +endif + +all: $(MAN_X) $(MAN_HTML) + +$(MAN_HTML) $(MAN_X): asciidoc.conf + +install-man: all + $(call QUIET_INSTALL, man) \ + $(INSTALL) -d -m 755 $(DESTDIR)$(man3dir); \ + $(INSTALL) -m 644 $(MAN_3) $(DESTDIR)$(man3dir); \ + $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir); \ + $(INSTALL) -m 644 $(MAN_7) $(DESTDIR)$(man7dir); + +install-html: + $(call QUIET_INSTALL, html) \ + $(INSTALL) -d -m 755 $(DESTDIR)$(htmldir); \ + $(INSTALL) -m 644 $(MAN_HTML) $(DESTDIR)$(htmldir); \ + +install-examples: + $(call QUIET_INSTALL, examples) \ + $(INSTALL) -d -m 755 $(DESTDIR)$(exdir); \ + $(INSTALL) -m 644 $(MAN_EX) $(DESTDIR)$(exdir); \ + +CLEAN_FILES = \ + $(MAN_XML) $(addsuffix +,$(MAN_XML)) \ + $(MAN_HTML) $(addsuffix +,$(MAN_HTML)) \ + $(MAN_X) clean: - rm -f man/libperf.7 - rm -f tutorial/tutorial.pdf + $(call QUIET_CLEAN, Documentation) $(RM) $(CLEAN_FILES) + +$(MAN_3): $(OUTPUT)%.3: %.xml + $(QUIET_XMLTO)$(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< + +$(MAN_7): $(OUTPUT)%.7: %.xml + $(QUIET_XMLTO)$(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< + +$(MAN_XML): $(OUTPUT)%.xml: %.txt + $(QUIET_ASCIIDOC)$(ASCIIDOC) -b docbook -d manpage \ + $(ASCIIDOC_EXTRA) -alibperf_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \ + mv $@+ $@ + +$(MAN_HTML): $(OUTPUT)%.html: %.txt + $(QUIET_ASCIIDOC)$(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage \ + $(ASCIIDOC_EXTRA) -aperf_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \ + mv $@+ $@
tools/lib/perf/Documentation/asciidoc.conf new file +120 -0
120 lines not on this page · raw message
tools/lib/perf/Documentation/examples/sampling.c new file +119 -0
119 lines not on this page · raw message
tools/lib/perf/Documentation/libperf-counting.txt new file +211 -0
211 lines not on this page · raw message
tools/lib/perf/Documentation/libperf-sampling.txt new file +243 -0
243 lines not on this page · raw message
tools/lib/perf/Documentation/libperf.txt new file +246 -0
246 lines not on this page · raw message
tools/lib/perf/Documentation/man/libperf.rst deleted +0 -100
100 lines not on this page · raw message
tools/lib/perf/Documentation/manpage-1.72.xsl new file +14 -0
@@ -0,0 +1,14 @@ +<!-- manpage-1.72.xsl: + special settings for manpages rendered from asciidoc+docbook + handles peculiarities in docbook-xsl 1.72.0 --> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + +<xsl:import href="manpage-base.xsl"/> + +<!-- these are the special values for the roff control characters + needed for docbook-xsl 1.72.0 --> +<xsl:param name="git.docbook.backslash">▓</xsl:param> +<xsl:param name="git.docbook.dot" >⌂</xsl:param> + +</xsl:stylesheet>
tools/lib/perf/Documentation/manpage-base.xsl new file +35 -0
@@ -0,0 +1,35 @@ +<!-- manpage-base.xsl: + special formatting for manpages rendered from asciidoc+docbook --> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + +<!-- these params silence some output from xmlto --> +<xsl:param name="man.output.quietly" select="1"/> +<xsl:param name="refentry.meta.get.quietly" select="1"/> + +<!-- convert asciidoc callouts to man page format; + git.docbook.backslash and git.docbook.dot params + must be supplied by another XSL file or other means --> +<xsl:template match="co"> + <xsl:value-of select="concat( + $git.docbook.backslash,'fB(', + substring-after(@id,'-'),')', + $git.docbook.backslash,'fR')"/> +</xsl:template> +<xsl:template match="calloutlist"> + <xsl:value-of select="$git.docbook.dot"/> + <xsl:text>sp </xsl:text> + <xsl:apply-templates/> + <xsl:text> </xsl:text> +</xsl:template> +<xsl:template match="callout"> + <xsl:value-of select="concat( + $git.docbook.backslash,'fB', + substring-after(@arearefs,'-'), + '. ',$git.docbook.backslash,'fR')"/> + <xsl:apply-templates/> + <xsl:value-of select="$git.docbook.dot"/> + <xsl:text>br </xsl:text> +</xsl:template> + +</xsl:stylesheet>
tools/lib/perf/Documentation/manpage-bold-literal.xsl new file +17 -0
@@ -0,0 +1,17 @@ +<!-- manpage-bold-literal.xsl: + special formatting for manpages rendered from asciidoc+docbook --> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + +<!-- render literal text as bold (instead of plain or monospace); + this makes literal text easier to distinguish in manpages + viewed on a tty --> +<xsl:template match="literal"> + <xsl:value-of select="$git.docbook.backslash"/> + <xsl:text>fB</xsl:text> + <xsl:apply-templates/> + <xsl:value-of select="$git.docbook.backslash"/> + <xsl:text>fR</xsl:text> +</xsl:template> + +</xsl:stylesheet>
tools/lib/perf/Documentation/manpage-normal.xsl new file +13 -0
@@ -0,0 +1,13 @@ +<!-- manpage-normal.xsl: + special settings for manpages rendered from asciidoc+docbook + handles anything we want to keep away from docbook-xsl 1.72.0 --> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + +<xsl:import href="manpage-base.xsl"/> + +<!-- these are the normal values for the roff control characters --> +<xsl:param name="git.docbook.backslash">\</xsl:param> +<xsl:param name="git.docbook.dot" >.</xsl:param> + +</xsl:stylesheet>
tools/lib/perf/Documentation/manpage-suppress-sp.xsl new file +21 -0
@@ -0,0 +1,21 @@ +<!-- manpage-suppress-sp.xsl: + special settings for manpages rendered from asciidoc+docbook + handles erroneous, inline .sp in manpage output of some + versions of docbook-xsl --> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + +<!-- attempt to work around spurious .sp at the tail of the line + that some versions of docbook stylesheets seem to add --> +<xsl:template match="simpara"> + <xsl:variable name="content"> + <xsl:apply-templates/> + </xsl:variable> + <xsl:value-of select="normalize-space($content)"/> + <xsl:if test="not(ancestor::authorblurb) and + not(ancestor::personblurb)"> + <xsl:text> </xsl:text> + </xsl:if> +</xsl:template> + +</xsl:stylesheet>
tools/lib/perf/Documentation/tutorial/tutorial.rst deleted +0 -123
123 lines not on this page · raw message
tools/lib/perf/Makefile +4 -1
@@ -181,7 +181,10 @@ install_pkgconfig: $(LIBPERF_PC) $(call QUIET_INSTALL, $(LIBPERF_PC)) \ $(call do_install,$(LIBPERF_PC),$(libdir_SQ)/pkgconfig,644) -install: install_lib install_headers install_pkgconfig +install_doc: + $(Q)$(MAKE) -C Documentation install-man install-html install-examples + +install: install_lib install_headers install_pkgconfig install_doc FORCE:
[tip: perf/core] libperf: Move to tools/lib/perf
In reply to Jiri OlsaThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 3ce311afb5583cf3d3b7f54ab088949da28aea05 Gitweb: https://git.kernel.org/tip/3ce311afb5583cf3d3b7f54ab088949da28aea05 Author: Jiri Olsa <[email protected]> AuthorDate: Fri, 06 Dec 2019 22:06:11 +01:00 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Mon, 06 Jan 2020 11:46:09 -03:00
libperf: Move to tools/lib/perf
Move libperf from its current location under tools/perf to a separate directory under tools/lib/.
Also change various paths (mainly includes) to reflect the libperf move to a separate directory and add a new directory under MANIFEST.
--- tools/lib/perf/Build | 13 +- tools/lib/perf/Documentation/Makefile | 7 +- tools/lib/perf/Documentation/man/libperf.rst | 100 ++- tools/lib/perf/Documentation/tutorial/tutorial.rst | 123 ++- tools/lib/perf/Makefile | 188 ++++- tools/lib/perf/core.c | 38 +- tools/lib/perf/cpumap.c | 345 ++++++- tools/lib/perf/evlist.c | 641 ++++++++++++- tools/lib/perf/evsel.c | 301 ++++++- tools/lib/perf/include/internal/cpumap.h | 19 +- tools/lib/perf/include/internal/evlist.h | 127 ++- tools/lib/perf/include/internal/evsel.h | 63 +- tools/lib/perf/include/internal/lib.h | 12 +- tools/lib/perf/include/internal/mmap.h | 55 +- tools/lib/perf/include/internal/tests.h | 33 +- tools/lib/perf/include/internal/threadmap.h | 23 +- tools/lib/perf/include/internal/xyarray.h | 36 +- tools/lib/perf/include/perf/core.h | 25 +- tools/lib/perf/include/perf/cpumap.h | 28 +- tools/lib/perf/include/perf/event.h | 385 +++++++- tools/lib/perf/include/perf/evlist.h | 49 +- tools/lib/perf/include/perf/evsel.h | 40 +- tools/lib/perf/include/perf/mmap.h | 15 +- tools/lib/perf/include/perf/threadmap.h | 20 +- tools/lib/perf/internal.h | 23 +- tools/lib/perf/lib.c | 48 +- tools/lib/perf/libperf.map | 51 +- tools/lib/perf/libperf.pc.template | 11 +- tools/lib/perf/mmap.c | 275 +++++- tools/lib/perf/tests/Makefile | 38 +- tools/lib/perf/tests/test-cpumap.c | 31 +- tools/lib/perf/tests/test-evlist.c | 413 ++++++++- tools/lib/perf/tests/test-evsel.c | 135 +++- tools/lib/perf/tests/test-threadmap.c | 31 +- tools/lib/perf/threadmap.c | 91 ++- tools/lib/perf/xyarray.c | 33 +- tools/perf/MANIFEST | 1 +- tools/perf/Makefile.config | 2 +- tools/perf/Makefile.perf | 2 +- tools/perf/lib/Build | 13 +- tools/perf/lib/Documentation/Makefile | 7 +- tools/perf/lib/Documentation/man/libperf.rst | 100 +-- tools/perf/lib/Documentation/tutorial/tutorial.rst | 123 +-- tools/perf/lib/Makefile | 188 +---- tools/perf/lib/core.c | 38 +- tools/perf/lib/cpumap.c | 345 +------ tools/perf/lib/evlist.c | 641 +------------ tools/perf/lib/evsel.c | 301 +------ tools/perf/lib/include/internal/cpumap.h | 19 +- tools/perf/lib/include/internal/evlist.h | 127 +-- tools/perf/lib/include/internal/evsel.h | 63 +- tools/perf/lib/include/internal/lib.h | 12 +- tools/perf/lib/include/internal/mmap.h | 55 +- tools/perf/lib/include/internal/tests.h | 33 +- tools/perf/lib/include/internal/threadmap.h | 23 +- tools/perf/lib/include/internal/xyarray.h | 36 +- tools/perf/lib/include/perf/core.h | 25 +- tools/perf/lib/include/perf/cpumap.h | 28 +- tools/perf/lib/include/perf/event.h | 385 +------- tools/perf/lib/include/perf/evlist.h | 49 +- tools/perf/lib/include/perf/evsel.h | 40 +- tools/perf/lib/include/perf/mmap.h | 15 +- tools/perf/lib/include/perf/threadmap.h | 20 +- tools/perf/lib/internal.h | 23 +- tools/perf/lib/lib.c | 48 +- tools/perf/lib/libperf.map | 51 +- tools/perf/lib/libperf.pc.template | 11 +- tools/perf/lib/mmap.c | 275 +----- tools/perf/lib/tests/Makefile | 38 +- tools/perf/lib/tests/test-cpumap.c | 31 +- tools/perf/lib/tests/test-evlist.c | 413 +-------- tools/perf/lib/tests/test-evsel.c | 135 +--- tools/perf/lib/tests/test-threadmap.c | 31 +- tools/perf/lib/threadmap.c | 91 +-- tools/perf/lib/xyarray.c | 33 +- 75 files changed, 3869 insertions(+), 3868 deletions(-) create mode 100644 tools/lib/perf/Build create mode 100644 tools/lib/perf/Documentation/Makefile create mode 100644 tools/lib/perf/Documentation/man/libperf.rst create mode 100644 tools/lib/perf/Documentation/tutorial/tutorial.rst create mode 100644 tools/lib/perf/Makefile create mode 100644 tools/lib/perf/core.c create mode 100644 tools/lib/perf/cpumap.c create mode 100644 tools/lib/perf/evlist.c create mode 100644 tools/lib/perf/evsel.c create mode 100644 tools/lib/perf/include/internal/cpumap.h create mode 100644 tools/lib/perf/include/internal/evlist.h create mode 100644 tools/lib/perf/include/internal/evsel.h create mode 100644 tools/lib/perf/include/internal/lib.h create mode 100644 tools/lib/perf/include/internal/mmap.h create mode 100644 tools/lib/perf/include/internal/tests.h create mode 100644 tools/lib/perf/include/internal/threadmap.h create mode 100644 tools/lib/perf/include/internal/xyarray.h create mode 100644 tools/lib/perf/include/perf/core.h create mode 100644 tools/lib/perf/include/perf/cpumap.h create mode 100644 tools/lib/perf/include/perf/event.h create mode 100644 tools/lib/perf/include/perf/evlist.h create mode 100644 tools/lib/perf/include/perf/evsel.h create mode 100644 tools/lib/perf/include/perf/mmap.h create mode 100644 tools/lib/perf/include/perf/threadmap.h create mode 100644 tools/lib/perf/internal.h create mode 100644 tools/lib/perf/lib.c create mode 100644 tools/lib/perf/libperf.map create mode 100644 tools/lib/perf/libperf.pc.template create mode 100644 tools/lib/perf/mmap.c create mode 100644 tools/lib/perf/tests/Makefile create mode 100644 tools/lib/perf/tests/test-cpumap.c create mode 100644 tools/lib/perf/tests/test-evlist.c create mode 100644 tools/lib/perf/tests/test-evsel.c create mode 100644 tools/lib/perf/tests/test-threadmap.c create mode 100644 tools/lib/perf/threadmap.c create mode 100644 tools/lib/perf/xyarray.c delete mode 100644 tools/perf/lib/Build delete mode 100644 tools/perf/lib/Documentation/Makefile delete mode 100644 tools/perf/lib/Documentation/man/libperf.rst delete mode 100644 tools/perf/lib/Documentation/tutorial/tutorial.rst delete mode 100644 tools/perf/lib/Makefile delete mode 100644 tools/perf/lib/core.c delete mode 100644 tools/perf/lib/cpumap.c delete mode 100644 tools/perf/lib/evlist.c delete mode 100644 tools/perf/lib/evsel.c delete mode 100644 tools/perf/lib/include/internal/cpumap.h delete mode 100644 tools/perf/lib/include/internal/evlist.h delete mode 100644 tools/perf/lib/include/internal/evsel.h delete mode 100644 tools/perf/lib/include/internal/lib.h delete mode 100644 tools/perf/lib/include/internal/mmap.h delete mode 100644 tools/perf/lib/include/internal/tests.h delete mode 100644 tools/perf/lib/include/internal/threadmap.h delete mode 100644 tools/perf/lib/include/internal/xyarray.h delete mode 100644 tools/perf/lib/include/perf/core.h delete mode 100644 tools/perf/lib/include/perf/cpumap.h delete mode 100644 tools/perf/lib/include/perf/event.h delete mode 100644 tools/perf/lib/include/perf/evlist.h delete mode 100644 tools/perf/lib/include/perf/evsel.h delete mode 100644 tools/perf/lib/include/perf/mmap.h delete mode 100644 tools/perf/lib/include/perf/threadmap.h delete mode 100644 tools/perf/lib/internal.h delete mode 100644 tools/perf/lib/lib.c delete mode 100644 tools/perf/lib/libperf.map delete mode 100644 tools/perf/lib/libperf.pc.template delete mode 100644 tools/perf/lib/mmap.c delete mode 100644 tools/perf/lib/tests/Makefile delete mode 100644 tools/perf/lib/tests/test-cpumap.c delete mode 100644 tools/perf/lib/tests/test-evlist.c delete mode 100644 tools/perf/lib/tests/test-evsel.c delete mode 100644 tools/perf/lib/tests/test-threadmap.c delete mode 100644 tools/perf/lib/threadmap.c delete mode 100644 tools/perf/lib/xyarray.c
tools/lib/perf/Build new file +13 -0
@@ -0,0 +1,13 @@ +libperf-y += core.o +libperf-y += cpumap.o +libperf-y += threadmap.o +libperf-y += evsel.o +libperf-y += evlist.o +libperf-y += mmap.o +libperf-y += zalloc.o +libperf-y += xyarray.o +libperf-y += lib.o + +$(OUTPUT)zalloc.o: ../../lib/zalloc.c FORCE + $(call rule_mkdir) + $(call if_changed_dep,cc_o_c)
tools/lib/perf/Documentation/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +all: + rst2man man/libperf.rst > man/libperf.7 + rst2pdf tutorial/tutorial.rst + +clean: + rm -f man/libperf.7 + rm -f tutorial/tutorial.pdf
tools/lib/perf/Documentation/man/libperf.rst new file +100 -0
100 lines not on this page · raw message
tools/lib/perf/Documentation/tutorial/tutorial.rst new file +123 -0
123 lines not on this page · raw message
tools/lib/perf/Makefile new file +188 -0
188 lines not on this page · raw message
tools/lib/perf/core.c new file +38 -0
@@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#define __printf (a, b) __attribute__((format(printf, a, b))) + +#include <stdio.h> +#include <stdarg.h> +#include <unistd.h> +#include <linux/compiler.h> +#include <perf/core.h> +#include <internal/lib.h> +#include "internal.h" + +static int __base_pr (enum libperf_print_level level__maybe_unused ,const char *format, +va_list args) +{ +return vfprintf (stderr, format, args); +} + +static libperf_print_fn_t __libperf_pr = __base_pr; + +__printf(2, 3) +void libperf_print (enum libperf_print_level level,const char *format, ...) +{ +va_list args; + +if (!__libperf_pr) +return ; + +va_start (args, format); +__libperf_pr (level, format, args); +va_end (args); +} + +void libperf_init (libperf_print_fn_t fn) +{ + page_size =sysconf (_SC_PAGE_SIZE); + __libperf_pr = fn; +}
tools/lib/perf/cpumap.c new file +345 -0
345 lines not on this page · raw message
tools/lib/perf/evlist.c new file +641 -0
641 lines not on this page · raw message
tools/lib/perf/evsel.c new file +301 -0
301 lines not on this page · raw message
tools/lib/perf/include/internal/cpumap.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_INTERNAL_CPUMAP_H +#define __LIBPERF_INTERNAL_CPUMAP_H + +#include <linux/refcount.h> + +struct perf_cpu_map { +refcount_t refcnt; +int nr; +int map[]; +}; + +#ifndef MAX_NR_CPUS +#define MAX_NR_CPUS 2048 +#endif + +int perf_cpu_map__idx (struct perf_cpu_map *cpus,int cpu); + +#endif /* __LIBPERF_INTERNAL_CPUMAP_H */
tools/lib/perf/include/internal/evlist.h new file +127 -0
127 lines not on this page · raw message
tools/lib/perf/include/internal/evsel.h new file +63 -0
63 lines not on this page · raw message
tools/lib/perf/include/internal/lib.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_INTERNAL_LIB_H +#define __LIBPERF_INTERNAL_LIB_H + +#include <sys/types.h> + +extern unsigned int page_size; + +ssize_t readn (int fd,void *buf,size_t n); +ssize_t writen (int fd,const void *buf,size_t n); + +#endif /* __LIBPERF_INTERNAL_CPUMAP_H */
tools/lib/perf/include/internal/mmap.h new file +55 -0
55 lines not on this page · raw message
tools/lib/perf/include/internal/tests.h new file +33 -0
@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_INTERNAL_TESTS_H +#define __LIBPERF_INTERNAL_TESTS_H + +#include <stdio.h> + +int tests_failed; + +#define __T_START \ +do { \ + fprintf(stdout, "- running %s...", __FILE__); \ + fflush(NULL); \ + tests_failed = 0; \ +} while (0) + +#define __T_END \ +do { \ + if (tests_failed) \ + fprintf(stdout, " FAILED (%d)\n", tests_failed); \ + else \ + fprintf(stdout, "OK\n"); \ +} while (0) + +#define __T (text, cond) \ +do { \ + if (!(cond)) { \ + fprintf(stderr, "FAILED %s:%d %s\n", __FILE__, __LINE__, text); \ + tests_failed++; \ + return -1; \ + } \ +} while (0) + +#endif /* __LIBPERF_INTERNAL_TESTS_H */
tools/lib/perf/include/internal/threadmap.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_INTERNAL_THREADMAP_H +#define __LIBPERF_INTERNAL_THREADMAP_H + +#include <linux/refcount.h> +#include <sys/types.h> +#include <unistd.h> + +struct thread_map_data { +pid_t pid; +char *comm; +}; + +struct perf_thread_map { +refcount_t refcnt; +int nr; +int err_thread; +struct thread_map_data map[]; +}; + +struct perf_thread_map *perf_thread_map__realloc (struct perf_thread_map *map,int nr); + +#endif /* __LIBPERF_INTERNAL_THREADMAP_H */
tools/lib/perf/include/internal/xyarray.h new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_INTERNAL_XYARRAY_H +#define __LIBPERF_INTERNAL_XYARRAY_H + +#include <linux/compiler.h> +#include <sys/types.h> + +struct xyarray { +size_t row_size; +size_t entry_size; +size_t entries; +size_t max_x; +size_t max_y; +char contents[]__aligned(8) ; +}; + +struct xyarray *xyarray__new (int xlen,int ylen,size_t entry_size); +void xyarray__delete (struct xyarray *xy); +void xyarray__reset (struct xyarray *xy); + +static inline void *xyarray__entry (struct xyarray *xy,int x,int y) +{ +return &xy->contents[x * xy->row_size + y * xy->entry_size]; +} + +static inline int xyarray__max_y (struct xyarray *xy) +{ +return xy->max_y; +} + +static inline int xyarray__max_x (struct xyarray *xy) +{ +return xy->max_x; +} + +#endif /* __LIBPERF_INTERNAL_XYARRAY_H */
tools/lib/perf/include/perf/core.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_CORE_H +#define __LIBPERF_CORE_H + +#include <stdarg.h> + +#ifndef LIBPERF_API +#define LIBPERF_API __attribute__((visibility("default"))) +#endif + +enum libperf_print_level { +LIBPERF_ERR , +LIBPERF_WARN , +LIBPERF_INFO , +LIBPERF_DEBUG , +LIBPERF_DEBUG2 , +LIBPERF_DEBUG3 , +}; + +typedef int (*libperf_print_fn_t )(enum libperf_print_level level, +const char *,va_list ap); + +LIBPERF_API void libperf_init(libperf_print_fn_t fn); + +#endif /* __LIBPERF_CORE_H */
tools/lib/perf/include/perf/cpumap.h new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_CPUMAP_H +#define __LIBPERF_CPUMAP_H + +#include <perf/core.h> +#include <stdio.h> +#include <stdbool.h> + +struct perf_cpu_map ; + +LIBPERF_API struct perf_cpu_map *perf_cpu_map__dummy_new(void); +LIBPERF_API struct perf_cpu_map *perf_cpu_map__new(const char *cpu_list); +LIBPERF_API struct perf_cpu_map *perf_cpu_map__read(FILE *file); +LIBPERF_API struct perf_cpu_map *perf_cpu_map__get(struct perf_cpu_map *map); +LIBPERF_API struct perf_cpu_map *perf_cpu_map__merge(struct perf_cpu_map *orig, +struct perf_cpu_map *other); +LIBPERF_API void perf_cpu_map__put(struct perf_cpu_map *map); +LIBPERF_API int perf_cpu_map__cpu(const struct perf_cpu_map *cpus, int idx); +LIBPERF_API int perf_cpu_map__nr(const struct perf_cpu_map *cpus); +LIBPERF_API bool perf_cpu_map__empty(const struct perf_cpu_map *map); +LIBPERF_API int perf_cpu_map__max(struct perf_cpu_map *map); + +#define perf_cpu_map__for_each_cpu (cpu, idx, cpus) \ + for ((idx) = 0, (cpu) = perf_cpu_map__cpu(cpus, idx); \ + (idx) < perf_cpu_map__nr(cpus); \ + (idx)++, (cpu) = perf_cpu_map__cpu(cpus, idx)) + +#endif /* __LIBPERF_CPUMAP_H */
tools/lib/perf/include/perf/event.h new file +385 -0
385 lines not on this page · raw message
tools/lib/perf/include/perf/evlist.h new file +49 -0
49 lines not on this page · raw message
tools/lib/perf/include/perf/evsel.h new file +40 -0
@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_EVSEL_H +#define __LIBPERF_EVSEL_H + +#include <stdint.h> +#include <perf/core.h> + +struct perf_evsel ; +struct perf_event_attr ; +struct perf_cpu_map ; +struct perf_thread_map ; + +struct perf_counts_values { +union { +struct { +uint64_t val; +uint64_t ena; +uint64_t run; + }; +uint64_t values[3 ]; + }; +}; + +LIBPERF_API struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr); +LIBPERF_API void perf_evsel__delete(struct perf_evsel *evsel); +LIBPERF_API int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus, +struct perf_thread_map *threads); +LIBPERF_API void perf_evsel__close(struct perf_evsel *evsel); +LIBPERF_API void perf_evsel__close_cpu(struct perf_evsel *evsel, int cpu); +LIBPERF_API int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread, +struct perf_counts_values *count); +LIBPERF_API int perf_evsel__enable(struct perf_evsel *evsel); +LIBPERF_API int perf_evsel__enable_cpu(struct perf_evsel *evsel, int cpu); +LIBPERF_API int perf_evsel__disable(struct perf_evsel *evsel); +LIBPERF_API int perf_evsel__disable_cpu(struct perf_evsel *evsel, int cpu); +LIBPERF_API struct perf_cpu_map *perf_evsel__cpus(struct perf_evsel *evsel); +LIBPERF_API struct perf_thread_map *perf_evsel__threads(struct perf_evsel *evsel); +LIBPERF_API struct perf_event_attr *perf_evsel__attr(struct perf_evsel *evsel); + +#endif /* __LIBPERF_EVSEL_H */
tools/lib/perf/include/perf/mmap.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_MMAP_H +#define __LIBPERF_MMAP_H + +#include <perf/core.h> + +struct perf_mmap ; +union perf_event ; + +LIBPERF_API void perf_mmap__consume(struct perf_mmap *map); +LIBPERF_API int perf_mmap__read_init(struct perf_mmap *map); +LIBPERF_API void perf_mmap__read_done(struct perf_mmap *map); +LIBPERF_API union perf_event *perf_mmap__read_event(struct perf_mmap *map); + +#endif /* __LIBPERF_MMAP_H */
tools/lib/perf/include/perf/threadmap.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_THREADMAP_H +#define __LIBPERF_THREADMAP_H + +#include <perf/core.h> +#include <sys/types.h> + +struct perf_thread_map ; + +LIBPERF_API struct perf_thread_map *perf_thread_map__new_dummy(void); + +LIBPERF_API void perf_thread_map__set_pid(struct perf_thread_map *map, int thread, pid_t pid); +LIBPERF_API char *perf_thread_map__comm(struct perf_thread_map *map, int thread); +LIBPERF_API int perf_thread_map__nr(struct perf_thread_map *threads); +LIBPERF_API pid_t perf_thread_map__pid(struct perf_thread_map *map, int thread); + +LIBPERF_API struct perf_thread_map *perf_thread_map__get(struct perf_thread_map *map); +LIBPERF_API void perf_thread_map__put(struct perf_thread_map *map); + +#endif /* __LIBPERF_THREADMAP_H */
tools/lib/perf/internal.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_INTERNAL_H +#define __LIBPERF_INTERNAL_H + +#include <perf/core.h> + +void libperf_print (enum libperf_print_level level, +const char *format, ...) + __attribute__((format (printf,2 ,3 ))); + +#define __pr (level, fmt, ...) \ +do { \ + libperf_print(level, "libperf: " fmt, ##__VA_ARGS__); \ +} while (0) + +#define pr_err (fmt, ...) __pr(LIBPERF_ERR, fmt, ##__VA_ARGS__) +#define pr_warning (fmt, ...) __pr(LIBPERF_WARN, fmt, ##__VA_ARGS__) +#define pr_info (fmt, ...) __pr(LIBPERF_INFO, fmt, ##__VA_ARGS__) +#define pr_debug (fmt, ...) __pr(LIBPERF_DEBUG, fmt, ##__VA_ARGS__) +#define pr_debug2 (fmt, ...) __pr(LIBPERF_DEBUG2, fmt, ##__VA_ARGS__) +#define pr_debug3 (fmt, ...) __pr(LIBPERF_DEBUG3, fmt, ##__VA_ARGS__) + +#endif /* __LIBPERF_INTERNAL_H */
tools/lib/perf/lib.c new file +48 -0
48 lines not on this page · raw message
tools/lib/perf/libperf.map new file +51 -0
51 lines not on this page · raw message
tools/lib/perf/libperf.pc.template new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) + +prefix=@PREFIX@ +libdir=@LIBDIR@ +includedir=${prefix}/include + +Name: libperf +Description: perf library +Version: @VERSION@ +Libs: -L${libdir} -lperf +Cflags: -I${includedir}
tools/lib/perf/mmap.c new file +275 -0
181 lines not on this page · raw message
tools/lib/perf/tests/Makefile new file +38 -0
Lines of this file are not shown. View the raw message.
tools/lib/perf/tests/test-cpumap.c new file +31 -0
Lines of this file are not shown. View the raw message.
tools/lib/perf/tests/test-evlist.c new file +413 -0
413 lines not on this page · raw message
tools/lib/perf/tests/test-evsel.c new file +135 -0
135 lines not on this page · raw message
tools/lib/perf/tests/test-threadmap.c new file +31 -0
Lines of this file are not shown. View the raw message.
tools/lib/perf/threadmap.c new file +91 -0
91 lines not on this page · raw message
tools/perf/lib/Documentation/Makefile deleted +0 -7
Lines of this file are not shown. View the raw message.
tools/perf/lib/Documentation/man/libperf.rst deleted +0 -100
100 lines not on this page · raw message
tools/perf/lib/Documentation/tutorial/tutorial.rst deleted +0 -123
123 lines not on this page · raw message
tools/perf/lib/Makefile deleted +0 -188
188 lines not on this page · raw message
tools/perf/lib/cpumap.c deleted +0 -345
345 lines not on this page · raw message
tools/perf/lib/evlist.c deleted +0 -641
641 lines not on this page · raw message
tools/perf/lib/evsel.c deleted +0 -301
301 lines not on this page · raw message
tools/perf/lib/include/internal/cpumap.h deleted +0 -19
Lines of this file are not shown. View the raw message.
tools/perf/lib/include/internal/evlist.h deleted +0 -127
127 lines not on this page · raw message
tools/perf/lib/include/internal/evsel.h deleted +0 -63
63 lines not on this page · raw message
tools/perf/lib/include/internal/lib.h deleted +0 -12
Lines of this file are not shown. View the raw message.
tools/perf/lib/include/internal/mmap.h deleted +0 -55
55 lines not on this page · raw message
tools/perf/lib/include/internal/tests.h deleted +0 -33
Lines of this file are not shown. View the raw message.
tools/perf/lib/include/internal/threadmap.h deleted +0 -23
Lines of this file are not shown. View the raw message.
tools/perf/lib/include/internal/xyarray.h deleted +0 -36
Lines of this file are not shown. View the raw message.
tools/perf/lib/include/perf/core.h deleted +0 -25
Lines of this file are not shown. View the raw message.
tools/perf/lib/include/perf/cpumap.h deleted +0 -28
Lines of this file are not shown. View the raw message.
tools/perf/lib/include/perf/event.h deleted +0 -385
385 lines not on this page · raw message
tools/perf/lib/include/perf/evlist.h deleted +0 -49
49 lines not on this page · raw message
tools/perf/lib/include/perf/evsel.h deleted +0 -40
Lines of this file are not shown. View the raw message.
tools/perf/lib/include/perf/mmap.h deleted +0 -15
Lines of this file are not shown. View the raw message.
tools/perf/lib/include/perf/threadmap.h deleted +0 -20
Lines of this file are not shown. View the raw message.
tools/perf/lib/lib.c deleted +0 -48
48 lines not on this page · raw message
tools/perf/lib/libperf.map deleted +0 -51
51 lines not on this page · raw message
tools/perf/lib/libperf.pc.template deleted +0 -11
Lines of this file are not shown. View the raw message.
tools/perf/lib/mmap.c deleted +0 -275
275 lines not on this page · raw message
tools/perf/lib/tests/test-cpumap.c deleted +0 -31
Lines of this file are not shown. View the raw message.
tools/perf/lib/tests/test-evlist.c deleted +0 -413
413 lines not on this page · raw message
tools/perf/lib/tests/test-evsel.c deleted +0 -135
135 lines not on this page · raw message
tools/perf/lib/tests/test-threadmap.c deleted +0 -31
Lines of this file are not shown. View the raw message.
tools/perf/lib/threadmap.c deleted +0 -91
91 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.