Re: [PATCH v8 2/4] perf inject: add jitdump mmap injection support

From: Stephane Eranian
Date: Thu Feb 04 2016 - 18:03:12 EST


Hi,

On Thu, Feb 4, 2016 at 1:53 PM, Arnaldo Carvalho de Melo
<acme@xxxxxxxxxx> wrote:
> Em Fri, Jan 22, 2016 at 01:22:51PM -0800, Stephane Eranian escreveu:
>> On Fri, Jan 22, 2016 at 12:44 PM, Arnaldo Carvalho de Melo
>> <acme@xxxxxxxxxx> wrote:
>> > Em Mon, Nov 30, 2015 at 10:02:21AM +0100, Stephane Eranian escreveu:
>> >> This patch adds a --jit/-j option to perf inject.
>> >>
>> >> This options injects MMAP records into the perf.data
>> >> file to cover the jitted code mmaps. It also emits
>> >> ELF images for each function in the jidump file.
>> >> Those images are created where the jitdump file is.
>> >> The MMAP records point to that location as well.
>> >>
>> >> Typical flow:
>> >> $ perf record -k mono -- java -agentpath:libpjvmti.so java_class
>> >> $ perf inject --jit -i perf.data -o perf.data.jitted
>> >> $ perf report -i perf.data.jitted
>> >
>> > So, it fails 'make -C tools/perf build-test', specifically the one where
>> > we ask for a NO_LIBELF build, trying to fix:
>> >
>> I have rebase to tip.git last night. Will try your branch today.
>> Will add a couple of minor adjustments and also better documentation
>> on how to use it.
>
> So, trying to continue with this, digged for instructions on how to
> build this the libjvmti.so thing, figure out its java-devel (aka
> java-1.8.0-openjdk-devel).
>
I will try on Ubuntu again with the latest JVM.
Clearly the environment is different.

> And I needed this to build it, hacky tho, as was what was there before,
> BTW, what distro was it you tested this for that
> update-java-alternatives to be available?
>
Ubuntu Trusty and Wily.

> I'm keeping what I have a perf/jit branch in my git tree.
>

Ok, I will try it out.
Thanks.

>
> diff --git a/tools/perf/jvmti/Makefile b/tools/perf/jvmti/Makefile
> index 5e46f518e045..d7005f1608d2 100644
> --- a/tools/perf/jvmti/Makefile
> +++ b/tools/perf/jvmti/Makefile
> @@ -33,7 +33,8 @@ VLIBJVMTI=libjvmti.so.$(VERSION)
> SLDFLAGS=-shared -Wl,-soname -Wl,$(VLIBJVMTI)
> SOLIBEXT=so
>
> -JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | cut -d ' ' -f 3)
> +#JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | cut -d ' ' -f 3)
> +JDIR=$(shell alternatives --display java | tail -1 | cut -d' ' -f 5 | sed 's%/jre/bin/java.%%g')
> # -lrt required in 32-bit mode for clock_gettime()
> LIBS=-lelf -lrt
> INCDIR=-I $(JDIR)/include -I $(JDIR)/include/linux