2019-12-06 13:57:46

by Jiri Olsa

[permalink] [raw]
Subject: [PATCH 0/3] 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.a

There are few obvious fixes added like include path changes,
that I put in separate patch, because they would get lost in
the big move 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

thanks,
jirka


---
Jiri Olsa (3):
libperf: Move libperf under tools/lib/perf
libperf: Additional fixes
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 +++++++++++++++++++++
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/{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
tools/{perf/lib => lib/perf}/include/internal/cpumap.h | 0
tools/{perf/lib => lib/perf}/include/internal/evlist.h | 0
tools/{perf/lib => lib/perf}/include/internal/evsel.h | 0
tools/{perf/lib => lib/perf}/include/internal/lib.h | 0
tools/{perf/lib => lib/perf}/include/internal/mmap.h | 0
tools/{perf/lib => lib/perf}/include/internal/tests.h | 0
tools/{perf/lib => lib/perf}/include/internal/threadmap.h | 0
tools/{perf/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
tools/{perf/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
tools/{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.rst


2019-12-06 13:57:53

by Jiri Olsa

[permalink] [raw]
Subject: [PATCH 2/3] libperf: Additional fixes

Changing various paths (mainly include) to reflect the
libperf move under separate directory and adding new
directory under MANIFEST.

Link: https://lkml.kernel.org/n/[email protected]
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/lib/perf/Makefile | 2 +-
tools/lib/perf/tests/Makefile | 2 +-
tools/perf/MANIFEST | 1 +
tools/perf/Makefile.config | 2 +-
tools/perf/Makefile.perf | 2 +-
5 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/lib/perf/Makefile b/tools/lib/perf/Makefile
index 0f233638ef1f..768dd423730b 100644
--- a/tools/lib/perf/Makefile
+++ b/tools/lib/perf/Makefile
@@ -60,7 +60,7 @@ else
endif

INCLUDES = \
--I$(srctree)/tools/perf/lib/include \
+-I$(srctree)/tools/lib/perf/include \
-I$(srctree)/tools/lib/ \
-I$(srctree)/tools/include \
-I$(srctree)/tools/arch/$(SRCARCH)/include/ \
diff --git a/tools/lib/perf/tests/Makefile b/tools/lib/perf/tests/Makefile
index a43cd08c5c03..96841775feaf 100644
--- a/tools/lib/perf/tests/Makefile
+++ b/tools/lib/perf/tests/Makefile
@@ -16,7 +16,7 @@ all:

include $(srctree)/tools/scripts/Makefile.include

-INCLUDE = -I$(srctree)/tools/perf/lib/include -I$(srctree)/tools/include -I$(srctree)/tools/lib
+INCLUDE = -I$(srctree)/tools/lib/perf/include -I$(srctree)/tools/include -I$(srctree)/tools/lib

$(TESTS_A): FORCE
$(QUIET_LINK)$(CC) $(INCLUDE) $(CFLAGS) -o $@ $(subst -a,.c,$@) ../libperf.a $(LIBAPI)
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index 70f1ff4e2eb4..ae2aab5b1be0 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -7,6 +7,7 @@ tools/lib/traceevent
tools/lib/api
tools/lib/bpf
tools/lib/subcmd
+tools/lib/perf
tools/lib/argv_split.c
tools/lib/ctype.c
tools/lib/hweight.c
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index c90f4146e5a2..80e55e796be9 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -286,7 +286,7 @@ ifeq ($(DEBUG),0)
endif
endif

-INC_FLAGS += -I$(src-perf)/lib/include
+INC_FLAGS += -I$(srctree)/tools/lib/perf/include
INC_FLAGS += -I$(src-perf)/util/include
INC_FLAGS += -I$(src-perf)/arch/$(SRCARCH)/include
INC_FLAGS += -I$(srctree)/tools/include/
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index eae5d5e95952..3eda9d4b88e7 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -230,7 +230,7 @@ LIB_DIR = $(srctree)/tools/lib/api/
TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
BPF_DIR = $(srctree)/tools/lib/bpf/
SUBCMD_DIR = $(srctree)/tools/lib/subcmd/
-LIBPERF_DIR = $(srctree)/tools/perf/lib/
+LIBPERF_DIR = $(srctree)/tools/lib/perf/

# Set FEATURE_TESTS to 'all' so all possible feature checkers are executed.
# Without this setting the output feature dump file misses some features, for
--
2.21.0

2019-12-06 14:23:39

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH 0/3] perf/libperf move

Em Fri, Dec 06, 2019 at 02:55:10PM +0100, Jiri Olsa escreveu:
> 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

By any means it is one of:

"libbpf: Fix up generation of bpf_helper_defs.h"
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git/commit/?id=1fd450f99272

And:

"libbpf: Fix sym->st_value print on 32-bit arches"
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git/commit/?id=7c3977d1e804

?

I've been cherry-picking this to have my build-test and container builds
for some time waiting for those to get upstream.

- Arnaldo

2019-12-06 14:36:04

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH 0/3] perf/libperf move

On Fri, Dec 06, 2019 at 11:21:54AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Dec 06, 2019 at 02:55:10PM +0100, Jiri Olsa escreveu:
> > 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
>
> By any means it is one of:
>
> "libbpf: Fix up generation of bpf_helper_defs.h"
> https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git/commit/?id=1fd450f99272

yep, I ended up wit hthe same patch.. great ;-)

thanks,
jirka

>
> And:
>
> "libbpf: Fix sym->st_value print on 32-bit arches"
> https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git/commit/?id=7c3977d1e804
>
> ?
>
> I've been cherry-picking this to have my build-test and container builds
> for some time waiting for those to get upstream.
>
> - Arnaldo
>