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

Jiri Olsa
2020-08-26T11:02:39Z

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