lkml.org 
[lkml]   [2020]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 3/5] perf jevents: Add support for parsing perchip/percore events
On Thu, Aug 27, 2020 at 06:39:56PM +0530, Kajol Jain wrote:
> Initially, every time we want to add new terms like chip, core thread etc,
> we need to create corrsponding fields in pmu_events and event struct.
> This patch adds an enum called 'aggr_mode_class' which store all these
> aggregation like perchip/percore. It also adds new field 'aggr_mode'
> to capture these terms.
> Now, if user wants to add any new term, they just need to add it in
> the enum defined.
>
> Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
> ---
> tools/perf/pmu-events/jevents.c | 16 ++++++++++++++++
> tools/perf/pmu-events/pmu-events.h | 6 ++++++
> 2 files changed, 22 insertions(+)
>
> diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
> index b205cd904a4f..f4ad2d403533 100644
> --- a/tools/perf/pmu-events/jevents.c
> +++ b/tools/perf/pmu-events/jevents.c
> @@ -48,6 +48,7 @@
> #include <linux/list.h>
> #include "jsmn.h"
> #include "json.h"
> +#include "pmu-events.h"
>
> int verbose;
> char *prog;
> @@ -60,6 +61,7 @@ struct json_event {
> char *pmu;
> char *unit;
> char *perpkg;
> + char *aggr_mode;
> char *metric_expr;
> char *metric_name;
> char *metric_group;
> @@ -74,6 +76,14 @@ struct json_event {
> (void)(&_min1 == &_min2); \
> _min1 < _min2 ? _min1 : _min2; })
> #endif

please add new line in here

> +enum aggr_mode_class convert(const char *aggr_mode)
> +{
> + if (!strcmp(aggr_mode, "PerCore"))
> + return PerCore;
> + else if (!strcmp(aggr_mode, "PerChip"))
> + return PerChip;
> + return -1;

should we display some warning in here?

thanks,
jirka

\
 
 \ /
  Last update: 2020-08-31 10:44    [W:0.179 / U:0.680 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site