All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Stephane Eranian <eranian@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	"mingo@elte.hu" <mingo@elte.hu>,
	"ak@linux.intel.com" <ak@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Rose Belcher <cel@us.ibm.com>,
	Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>,
	Sonny Rao <sonnyrao@chromium.org>,
	John Mccutchan <johnmccutchan@google.com>,
	David Ahern <dsahern@gmail.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Pawel Moll <pawel.moll@arm.com>
Subject: Re: [PATCH v8 2/4] perf inject: add jitdump mmap injection support
Date: Fri, 22 Jan 2016 19:13:43 -0300	[thread overview]
Message-ID: <20160122221343.GN4034@kernel.org> (raw)

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@redhat.com> 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.

Ok, but please work on top of my branch, that I'll push soon, for
instance, I had to fold the patch below, to fix the NO_LIBELF=1 case,
so, when one builds that way perf inject -h will say:

[acme@jouet linux]$ tools/perf/perf inject -h

 Usage: perf inject [<options>]

    -b, --build-ids       Inject build-ids into the output stream
    -f, --force           don't complain, do it
    -i, --input <file>    input file name
    -j, --jit             merge jitdump files into perf.data file
                          (not built-in because NO_LIBELF=1)
    -o, --output <file>   output file name
    -s, --sched-stat      Merge sched-stat and sched-switch for getting
events where and how long tasks slept
    -v, --verbose         be more verbose (show build ids, etc)
        --itrace[=<opts>]
                          Instruction Tracing options
        --kallsyms <file>
                          kallsyms pathname
        --strip           strip non-synthesized events (use with
--itrace)

[acme@jouet linux]$ 

I did some other changes and carved out two bits into separate patches,
will soon push what I have to a perf/jit branch in my tree so that you
can take a look.

- Arnaldo


---------------------------------------------------------


diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 606653f30759..b38445f08c2f 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -73,12 +73,14 @@ static int perf_event__repipe_oe_synth(struct perf_tool *tool,
 	return perf_event__repipe_synth(tool, event);
 }
 
+#ifdef HAVE_LIBELF_SUPPORT
 static int perf_event__drop_oe(struct perf_tool *tool __maybe_unused,
 			       union perf_event *event __maybe_unused,
 			       struct ordered_events *oe __maybe_unused)
 {
 	return 0;
 }
+#endif
 
 static int perf_event__repipe_op2_synth(struct perf_tool *tool,
 					union perf_event *event,
@@ -243,6 +245,7 @@ static int perf_event__repipe_mmap(struct perf_tool *tool,
 	return err;
 }
 
+#ifdef HAVE_LIBELF_SUPPORT
 static int perf_event__jit_repipe_mmap(struct perf_tool *tool,
 				       union perf_event *event,
 				       struct perf_sample *sample,
@@ -261,6 +264,7 @@ static int perf_event__jit_repipe_mmap(struct perf_tool *tool,
 	}
 	return perf_event__repipe_mmap(tool, event, sample, machine);
 }
+#endif
 
 static int perf_event__repipe_mmap2(struct perf_tool *tool,
 				   union perf_event *event,
@@ -275,6 +279,7 @@ static int perf_event__repipe_mmap2(struct perf_tool *tool,
 	return err;
 }
 
+#ifdef HAVE_LIBELF_SUPPORT
 static int perf_event__jit_repipe_mmap2(struct perf_tool *tool,
 					union perf_event *event,
 					struct perf_sample *sample,
@@ -293,6 +298,7 @@ static int perf_event__jit_repipe_mmap2(struct perf_tool *tool,
 	}
 	return perf_event__repipe_mmap2(tool, event, sample, machine);
 }
+#endif
 
 static int perf_event__repipe_fork(struct perf_tool *tool,
 				   union perf_event *event,
@@ -711,6 +717,7 @@ static int __cmd_inject(struct perf_inject *inject)
 	return ret;
 }
 
+#ifdef HAVE_LIBELF_SUPPORT
 static int
 jit_validate_events(struct perf_session *session)
 {
@@ -725,6 +732,7 @@ jit_validate_events(struct perf_session *session)
 	}
 	return 0;
 }
+#endif
 
 int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused)
 {
@@ -765,7 +773,7 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused)
 	};
 	int ret;
 
-	const struct option options[] = {
+	struct option options[] = {
 		OPT_BOOLEAN('b', "build-ids", &inject.build_ids,
 			    "Inject build-ids into the output stream"),
 		OPT_STRING('i', "input", &inject.input_name, "file",
@@ -792,7 +800,9 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused)
 		"perf inject [<options>]",
 		NULL
 	};
-
+#ifndef HAVE_LIBELF_SUPPORT
+	set_option_nobuild(options, 'j', "jit", "NO_LIBELF=1", true);
+#endif
 	argc = parse_options(argc, argv, options, inject_usage, 0);
 
 	/*
@@ -828,7 +838,7 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused)
 		inject.tool.ordered_events = true;
 		inject.tool.ordering_requires_timestamps = true;
 	}
-
+#ifdef HAVE_LIBELF_SUPPORT
 	if (inject.jit_mode) {
 		/*
 		 * validate event is using the correct clockid
@@ -847,7 +857,7 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused)
 		 */
 		inject.tool.finished_round = perf_event__drop_oe;
 	}
-
+#endif
 	ret = symbol__init(&inject.session->header.env);
 	if (ret < 0)
 		goto out_delete;
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 9ef707198941..52a4a806ee2f 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -106,8 +106,8 @@ libperf-y += scripting-engines/
 libperf-$(CONFIG_ZLIB) += zlib.o
 libperf-$(CONFIG_LZMA) += lzma.o
 libperf-y += demangle-java.o
-libperf-y += jitdump.o
-libperf-y += genelf.o
+libperf-$(CONFIG_LIBELF) += jitdump.o
+libperf-$(CONFIG_LIBELF) += genelf.o
 
 CFLAGS_config.o   += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
 

----- End forwarded message -----

             reply	other threads:[~2016-01-22 22:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22 22:13 Arnaldo Carvalho de Melo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-11-30  9:02 [PATCH v8 0/4] perf: add support for profiling jitted code Stephane Eranian
2015-11-30  9:02 ` [PATCH v8 2/4] perf inject: add jitdump mmap injection support Stephane Eranian
2016-01-22 20:44   ` Arnaldo Carvalho de Melo
2016-01-22 21:22     ` Stephane Eranian
     [not found]       ` <20160122215542.GK4034@kernel.org>
     [not found]         ` <20160122220929.GL4034@kernel.org>
2016-01-22 22:10           ` Arnaldo Carvalho de Melo
2016-02-04 21:53       ` Arnaldo Carvalho de Melo
2016-02-04 23:02         ` Stephane Eranian
2016-02-05 13:47           ` Arnaldo Carvalho de Melo
2016-02-05 13:51             ` Arnaldo Carvalho de Melo
2016-02-05 13:57               ` Arnaldo Carvalho de Melo
2016-02-05 14:24                 ` Arnaldo Carvalho de Melo
2016-02-08 18:53                   ` Stephane Eranian
2016-02-11 22:16                     ` Arnaldo Carvalho de Melo
2016-02-12 20:32                       ` Stephane Eranian
2016-02-12 20:43                         ` Arnaldo Carvalho de Melo
2016-02-15  2:16                           ` Stephane Eranian
2016-02-15 17:14                             ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160122221343.GN4034@kernel.org \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=cel@us.ibm.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=johnmccutchan@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=namhyung@kernel.org \
    --cc=pawel.moll@arm.com \
    --cc=peterz@infradead.org \
    --cc=sonnyrao@chromium.org \
    --cc=sukadev@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.