浏览代码

perf tools: Hit all build ids when AUX area tracing

We need to include all buildids when a perf.data file contains AUX area
tracing data because we do not decode the trace for that purpose because
it would take too long.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1430404667-10593-4-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Adrian Hunter 10 年之前
父节点
当前提交
cd10b28952
共有 3 个文件被更改,包括 25 次插入2 次删除
  1. 9 0
      tools/perf/builtin-buildid-list.c
  2. 7 1
      tools/perf/builtin-inject.c
  3. 9 1
      tools/perf/builtin-record.c

+ 9 - 0
tools/perf/builtin-buildid-list.c

@@ -69,6 +69,15 @@ static int perf_session__list_build_ids(bool force, bool with_hits)
 	session = perf_session__new(&file, false, &build_id__mark_dso_hit_ops);
 	session = perf_session__new(&file, false, &build_id__mark_dso_hit_ops);
 	if (session == NULL)
 	if (session == NULL)
 		return -1;
 		return -1;
+
+	/*
+	 * We take all buildids when the file contains AUX area tracing data
+	 * because we do not decode the trace because it would take too long.
+	 */
+	if (!perf_data_file__is_pipe(&file) &&
+	    perf_header__has_feat(&session->header, HEADER_AUXTRACE))
+		with_hits = false;
+
 	/*
 	/*
 	 * in pipe-mode, the only way to get the buildids is to parse
 	 * in pipe-mode, the only way to get the buildids is to parse
 	 * the record stream. Buildids are stored as RECORD_HEADER_BUILD_ID
 	 * the record stream. Buildids are stored as RECORD_HEADER_BUILD_ID

+ 7 - 1
tools/perf/builtin-inject.c

@@ -27,6 +27,7 @@ struct perf_inject {
 	struct perf_session	*session;
 	struct perf_session	*session;
 	bool			build_ids;
 	bool			build_ids;
 	bool			sched_stat;
 	bool			sched_stat;
+	bool			have_auxtrace;
 	const char		*input_name;
 	const char		*input_name;
 	struct perf_data_file	output;
 	struct perf_data_file	output;
 	u64			bytes_written;
 	u64			bytes_written;
@@ -122,6 +123,8 @@ static s64 perf_event__repipe_auxtrace(struct perf_tool *tool,
 						  tool);
 						  tool);
 	int ret;
 	int ret;
 
 
+	inject->have_auxtrace = true;
+
 	if (!inject->output.is_pipe) {
 	if (!inject->output.is_pipe) {
 		off_t offset;
 		off_t offset;
 
 
@@ -508,9 +511,12 @@ static int __cmd_inject(struct perf_inject *inject)
 	ret = perf_session__process_events(session);
 	ret = perf_session__process_events(session);
 
 
 	if (!file_out->is_pipe) {
 	if (!file_out->is_pipe) {
-		if (inject->build_ids)
+		if (inject->build_ids) {
 			perf_header__set_feat(&session->header,
 			perf_header__set_feat(&session->header,
 					      HEADER_BUILD_ID);
 					      HEADER_BUILD_ID);
+			if (inject->have_auxtrace)
+				dsos__hit_all(session);
+		}
 		/*
 		/*
 		 * The AUX areas have been removed and replaced with
 		 * 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.

+ 9 - 1
tools/perf/builtin-record.c

@@ -620,8 +620,16 @@ out_child:
 	if (!err && !file->is_pipe) {
 	if (!err && !file->is_pipe) {
 		rec->session->header.data_size += rec->bytes_written;
 		rec->session->header.data_size += rec->bytes_written;
 
 
-		if (!rec->no_buildid)
+		if (!rec->no_buildid) {
 			process_buildids(rec);
 			process_buildids(rec);
+			/*
+			 * We take all buildids when the file contains
+			 * AUX area tracing data because we do not decode the
+			 * trace because it would take too long.
+			 */
+			if (rec->opts.full_auxtrace)
+				dsos__hit_all(rec->session);
+		}
 		perf_session__write_header(rec->session, rec->evlist, fd, true);
 		perf_session__write_header(rec->session, rec->evlist, fd, true);
 	}
 	}