linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>, linux-kernel@vger.kernel.org
Subject: [PATCH 23/25] perf inject: Remove more aux-related stuff when processing instruction traces
Date: Fri, 25 Sep 2015 16:15:54 +0300	[thread overview]
Message-ID: <1443186956-18718-24-git-send-email-adrian.hunter@intel.com> (raw)
In-Reply-To: <1443186956-18718-1-git-send-email-adrian.hunter@intel.com>

perf inject can process instruction traces (using the --itrace option)
which removes aux-related events and replaces them with the requested
synthesized events.

However there are still some leftovers, namely PERF_RECORD_ITRACE_START
events and the original evsel (selected event) e.g. intel_pt//

For the sake of completeness, remove them too.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 tools/perf/builtin-inject.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 8638fad8a085..ecd69fae587e 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -31,6 +31,7 @@ struct perf_inject {
 	const char		*input_name;
 	struct perf_data_file	output;
 	u64			bytes_written;
+	u64			aux_id;
 	struct list_head	samples;
 	struct itrace_synth_opts itrace_synth_opts;
 };
@@ -176,6 +177,19 @@ static int perf_event__repipe(struct perf_tool *tool,
 	return perf_event__repipe_synth(tool, event);
 }
 
+static int perf_event__drop_aux(struct perf_tool *tool,
+				union perf_event *event __maybe_unused,
+				struct perf_sample *sample,
+				struct machine *machine __maybe_unused)
+{
+	struct perf_inject *inject = container_of(tool, struct perf_inject, tool);
+
+	if (!inject->aux_id)
+		inject->aux_id = sample->id;
+
+	return 0;
+}
+
 typedef int (*inject_handler)(struct perf_tool *tool,
 			      union perf_event *event,
 			      struct perf_sample *sample,
@@ -512,6 +526,8 @@ static int __cmd_inject(struct perf_inject *inject)
 		inject->tool.id_index	    = perf_event__repipe_id_index;
 		inject->tool.auxtrace_info  = perf_event__process_auxtrace_info;
 		inject->tool.auxtrace	    = perf_event__process_auxtrace;
+		inject->tool.aux	    = perf_event__drop_aux;
+		inject->tool.itrace_start   = perf_event__drop_aux,
 		inject->tool.ordered_events = true;
 		inject->tool.ordering_requires_timestamps = true;
 		/* Allow space in the header for new attributes */
@@ -535,14 +551,24 @@ static int __cmd_inject(struct perf_inject *inject)
 		}
 		/*
 		 * The AUX areas have been removed and replaced with
-		 * synthesized hardware events, so clear the feature flag.
+		 * synthesized hardware events, so clear the feature flag and
+		 * remove the evsel.
 		 */
 		if (inject->itrace_synth_opts.set) {
+			struct perf_evsel *evsel;
+
 			perf_header__clear_feat(&session->header,
 						HEADER_AUXTRACE);
 			if (inject->itrace_synth_opts.last_branch)
 				perf_header__set_feat(&session->header,
 						      HEADER_BRANCH_STACK);
+			evsel = perf_evlist__id2evsel_strict(session->evlist,
+							     inject->aux_id);
+			if (evsel) {
+				pr_debug("Deleting %s\n",
+					 perf_evsel__name(evsel));
+				perf_evlist__del(session->evlist, evsel);
+			}
 		}
 		session->header.data_offset = output_data_offset;
 		session->header.data_size = inject->bytes_written;
-- 
1.9.1


  parent reply	other threads:[~2015-09-25 13:20 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-25 13:15 [PATCH 00/25] perf tools: minor improvements to Intel PT related stuff Adrian Hunter
2015-09-25 13:15 ` [PATCH 01/25] perf auxtrace: Fix 'instructions' period of zero Adrian Hunter
2015-09-28 14:12   ` Arnaldo Carvalho de Melo
2015-09-28 14:16     ` Arnaldo Carvalho de Melo
2015-09-29  8:41   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 02/25] perf report: Fix sample type validation for synthesized callchains Adrian Hunter
2015-09-29  8:41   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 03/25] perf intel-pt: Fix potential loop forever Adrian Hunter
2015-09-29  8:42   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 04/25] perf intel-pt: Make logging slightly more efficient Adrian Hunter
2015-09-29  8:42   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 05/25] perf script: Allow time to be displayed in nanoseconds Adrian Hunter
2015-09-29  8:42   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 06/25] perf tools: Warn when AUX data has been lost Adrian Hunter
2015-09-29  8:43   ` [tip:perf/core] perf session: " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 07/25] perf tools: Add more documentation to export-to-postgresql.py script Adrian Hunter
2015-09-29  8:43   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 08/25] perf auxtrace: Add option to synthesize branch stacks on samples Adrian Hunter
2015-09-29  8:43   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 09/25] perf report: Adjust sample type validation for synthesized branch stacks Adrian Hunter
2015-09-29  8:44   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 10/25] perf report: Also do default setup " Adrian Hunter
2015-09-29  8:44   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 11/25] perf report: Skip events with null " Adrian Hunter
2015-09-29  8:44   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 12/25] perf inject: Set branch stack feature flag when synthesizing " Adrian Hunter
2015-09-29  8:45   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 13/25] perf intel-pt: Move branch filter logic Adrian Hunter
2015-09-29  8:45   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 14/25] perf intel-pt: Support generating branch stack Adrian Hunter
2015-09-29  8:45   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 15/25] perf report: Make max_stack value allow for synthesized callchains Adrian Hunter
2015-09-28 20:03   ` Arnaldo Carvalho de Melo
2015-09-29  8:52     ` Adrian Hunter
2015-09-29 15:51       ` Arnaldo Carvalho de Melo
2015-09-30  8:43         ` Adrian Hunter
2015-09-30 13:17           ` Arnaldo Carvalho de Melo
2015-10-01  7:10       ` [tip:perf/core] perf report: Amend documentation about max_stack and " tip-bot for Adrian Hunter
2015-09-29  8:46   ` [tip:perf/core] perf report: Make max_stack value allow for " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 16/25] perf hists: Allow for max_stack greater than PERF_MAX_STACK_DEPTH Adrian Hunter
2015-09-29  8:46   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 17/25] perf callchain: " Adrian Hunter
2015-09-28 20:08   ` Arnaldo Carvalho de Melo
2015-09-29  8:16     ` Adrian Hunter
2015-10-01 11:45       ` Adrian Hunter
2015-10-03  7:49   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 18/25] perf script: Add a setting for maximum stack depth Adrian Hunter
2015-09-29  8:46   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 19/25] perf scripting python: Allow for max_stack greater than PERF_MAX_STACK_DEPTH Adrian Hunter
2015-09-29  8:47   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 20/25] perf script: Make scripting_max_stack value allow for synthesized callchains Adrian Hunter
2015-09-29  8:47   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 21/25] perf tools: Add perf_evlist__id2evsel_strict() Adrian Hunter
2015-09-29  8:47   ` [tip:perf/core] perf evlist: " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 22/25] perf tools: Add perf_evlist__del() Adrian Hunter
2015-09-28 13:33   ` Arnaldo Carvalho de Melo
2015-09-28 20:14     ` Arnaldo Carvalho de Melo
2015-09-29  8:48   ` [tip:perf/core] perf evlist: Add perf_evlist__remove() tip-bot for Adrian Hunter
2015-09-25 13:15 ` Adrian Hunter [this message]
2015-09-29  8:48   ` [tip:perf/core] perf inject: Remove more aux-related stuff when processing instruction traces tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 24/25] perf inject: Add --strip option to strip out non-synthesized events Adrian Hunter
2015-09-29  8:49   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-25 13:15 ` [PATCH 25/25] perf intel-pt: Add mispred-all config option to aid use with autofdo Adrian Hunter
2015-09-29  8:49   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-28 20:33 ` [PATCH 00/25] perf tools: minor improvements to Intel PT related stuff Arnaldo Carvalho de Melo
2015-09-29 11:13   ` Adrian Hunter

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=1443186956-18718-24-git-send-email-adrian.hunter@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=acme@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).