Re: [RFC 1/3] perf jevents: Add support for parsing perchip/percore events

From: Jiri Olsa
Date: Mon Jul 06 2020 - 08:58:13 EST


On Fri, Jul 03, 2020 at 11:50:28AM +0530, kajoljain wrote:

SNIP

> ]
> diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
> index fa86c5f997cc..dd2b14cc147c 100644
> --- a/tools/perf/pmu-events/jevents.c
> +++ b/tools/perf/pmu-events/jevents.c
> @@ -53,6 +53,23 @@
> int verbose;
> char *prog;
>
> +enum event_class {
> + PerChip = 0,
> + PerPkg = 1,
> + PerCore = 2
> +};

could you please split this into patch that changes perpkg
into the class type string and another that adds new PerChip/PerCore?

> +
> +enum event_class convert(const char* event_class_type) {
> +
> + if (!strcmp(event_class_type, "PerCore"))
> + return PerCore;
> + else if (!strcmp(event_class_type, "PerChip"))
> + return PerChip;
> + else if (!strcmp(event_class_type, "PerPkg"))
> + return PerPkg;
> + return -1;
> +}
> +
> int eprintf(int level, int var, const char *fmt, ...)
> {
>
> @@ -320,7 +337,7 @@ static void print_events_table_prefix(FILE *fp, const char *tblname)
>
> static int print_events_table_entry(void *data, char *name, char *event,
> char *desc, char *long_desc,
> - char *pmu, char *unit, char *perpkg,
> + char *pmu, char *unit, char *event_class_type,

maybe 'aggregation' or 'aggr_mode' would be better name than event_class_type?

thanks,
jirka