Re: [RFC] perf/jevents: Add new structure to pass json fields.

From: Jiri Olsa
Date: Wed Aug 26 2020 - 07:02:39 EST


On Tue, Aug 25, 2020 at 01:10:41PM +0530, Kajol Jain wrote:

SNIP

> diff --git a/tools/perf/pmu-events/jevents.h b/tools/perf/pmu-events/jevents.h
> index 2afc8304529e..e696edf70e9a 100644
> --- a/tools/perf/pmu-events/jevents.h
> +++ b/tools/perf/pmu-events/jevents.h
> @@ -2,14 +2,28 @@
> #ifndef JEVENTS_H
> #define JEVENTS_H 1
>
> +#include "pmu-events.h"
> +
> +struct json_event {
> + char *name;
> + char *event;
> + char *desc;
> + char *topic;
> + char *long_desc;
> + char *pmu;
> + char *unit;
> + char *perpkg;
> + char *metric_expr;
> + char *metric_name;
> + char *metric_group;
> + char *deprecated;
> + char *metric_constraint;
> +};
> +
> int json_events(const char *fn,
> - int (*func)(void *data, char *name, char *event, char *desc,
> - char *long_desc,
> - char *pmu,
> - char *unit, char *perpkg, char *metric_expr,
> - char *metric_name, char *metric_group,
> - char *deprecated, char *metric_constraint),
> - void *data);
> + int (*func)(void *data, struct json_event *je),
> + void *data);

please also add typedef for the function,
it's used in other places as well

thanks,
jirka