Messages in this thread | | | From | David Carrillo-Cisneros <> | Date | Mon, 12 Jun 2017 21:23:44 -0700 | Subject | Re: [PATCH v3 15/15] perf header: add event desc to pipe-mode header |
| |
On Thu, Jun 8, 2017 at 4:54 AM, Jiri Olsa <jolsa@redhat.com> wrote: > On Tue, Jun 06, 2017 at 12:07:22AM -0700, David Carrillo-Cisneros wrote: > > SNIP > >> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c >> index 6c1963e5bf10..c91acd5b0838 100644 >> --- a/tools/perf/util/header.c >> +++ b/tools/perf/util/header.c >> @@ -66,6 +66,7 @@ struct feat_fd { >> void *buf; /* Either buf != NULL or fd >= 0 */ >> ssize_t offset; >> size_t size; >> + struct perf_evsel *events; >> }; >> >> void perf_header__set_feat(struct perf_header *header, int feat) >> @@ -1353,10 +1354,15 @@ static int __desc_attr__fprintf(FILE *fp, const char *name, const char *val, >> >> static void print_event_desc(struct feat_fd *ff, FILE *fp) >> { >> - struct perf_evsel *evsel, *events = read_event_desc(ff); >> + struct perf_evsel *evsel, *events; >> u32 j; >> u64 *id; >> >> + if (ff->events) >> + events = ff->events; >> + else >> + events = read_event_desc(ff); > > can you read from ff at this point in print callback?
Yes, ->print it's always called after ->process in perf_event__synthesize_features. So process_event_desc (that in pipe-mode sets ff->events) is called before this print_event_desc.
> > jirka
| |