Re: [PATCH v3 15/15] perf header: add event desc to pipe-mode header

Jiri Olsa
2017-06-08T11:54:54Z

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?

jirka