Skip to contentSkip to conversation

perf report: fix error with -g in pipe mode

PATCH In review Stephane Eranian 2 participants 2 messages Apr 10, 2012 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf report: fix error with -g in pipe mode

In pipe mode, we cannot check the validity of sample_type or the branch view mode until we start processing the events. There is no meta-data information at the beginning of the pipe mode stream. Instead, all the meta data is pushed via pseudo records and those get processed by process_sample_events().

Without this patch:

  $ perf record -g -o - foo | perf inject -b | perf report -g -i -
  Selected -g but no callchain data. Did you call 'perf record' without -g?

---

tools/perf/builtin-report.c +7 -0
index 2e31743..c338b97 100644
@@ -249,6 +249,13 @@ static int perf_report__setup_sample_type(struct perf_report *rep)
 {
 	struct perf_session *self = rep->session;
 
+	/*
+	 * cannot determine sample type, branch mode until we have
+	 * processed the meta-data pseudo records via process_sample_events()
+	 */
+	if (self->fd_pipe)
+		return 0;
+
 	if (!(self->sample_type & PERF_SAMPLE_CALLCHAIN)) {
 		if (sort__has_parent) {
 			ui__warning("Selected --sort parent, but no "
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 11 lines · Stephane Eranian

In pipe mode, we cannot check the validity of sample_type or the branch view mode until we start processing the events. There is no meta-data information at the beginning of the pipe mode stream. Instead, all the meta data is pushed via pseudo records and those get processed by process_sample_events().

Without this patch:

   $ perf record -g -o - foo | perf inject -b | perf report -g -i -
   Selected -g but no callchain data. Did you call 'perf record' without -g?
Quoted 20 lines

---

tools/perf/builtin-report.c +7 -0
index 2e31743..c338b97 100644
@@ -249,6 +249,13 @@ static int perf_report__setup_sample_type(struct perf_report *rep)
  {
  	struct perf_session *self = rep->session;
 
+	/*
+	 * cannot determine sample type, branch mode until we have
+	 * processed the meta-data pseudo records via process_sample_events()
+	 */
+	if (self->fd_pipe)
+		return 0;
+
  	if (!(self->sample_type&  PERF_SAMPLE_CALLCHAIN)) {
  		if (sort__has_parent) {
  			ui__warning("Selected --sort parent, but no "