[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190318092117.GA25277@krava>
Date: Mon, 18 Mar 2019 10:21:17 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Jin Yao <yao.jin@...ux.intel.com>
Cc: acme@...nel.org, jolsa@...nel.org, peterz@...radead.org,
mingo@...hat.com, alexander.shishkin@...ux.intel.com,
Linux-kernel@...r.kernel.org, ak@...ux.intel.com,
kan.liang@...el.com, yao.jin@...el.com
Subject: Re: [PATCH v2 1/4] perf: Add a 'percore' event qualifier
On Sun, Mar 17, 2019 at 12:34:25AM +0800, Jin Yao wrote:
SNIP
> static bool config_term_shrinked;
> @@ -950,6 +951,7 @@ config_term_avail(int term_type, struct parse_events_error *err)
> case PARSE_EVENTS__TERM_TYPE_CONFIG2:
> case PARSE_EVENTS__TERM_TYPE_NAME:
> case PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD:
> + case PARSE_EVENTS__TERM_TYPE_PERCORE:
> return true;
> default:
> if (!err)
> @@ -1041,6 +1043,14 @@ do { \
> case PARSE_EVENTS__TERM_TYPE_MAX_EVENTS:
> CHECK_TYPE_VAL(NUM);
> break;
> + case PARSE_EVENTS__TERM_TYPE_PERCORE:
> + CHECK_TYPE_VAL(NUM);
> + if ((unsigned int)term->val.num > 1) {
> + err->str = strdup("expected 0 or 1");
> + err->idx = term->err_val;
> + return -EINVAL;
> + }
> + break;
> default:
> err->str = strdup("unknown term");
> err->idx = term->err_term;
> @@ -1179,6 +1189,10 @@ do { \
> case PARSE_EVENTS__TERM_TYPE_DRV_CFG:
> ADD_CONFIG_TERM(DRV_CFG, drv_cfg, term->val.str);
> break;
> + case PARSE_EVENTS__TERM_TYPE_PERCORE:
> + ADD_CONFIG_TERM(PERCORE, percore,
> + term->val.num ? 1 : 0);
term->val.num ? true : false
> + break;
> default:
> break;
> }
> @@ -1233,6 +1247,18 @@ int parse_events_add_numeric(struct parse_events_state *parse_state,
> get_config_name(head_config), &config_terms);
> }
>
> +static bool config_term_percore(struct list_head *config_terms)
> +{
> + struct perf_evsel_config_term *term;
> +
> + list_for_each_entry(term, config_terms, list) {
> + if (term->type == PERF_EVSEL__CONFIG_TERM_PERCORE)
> + return term->val.percore ? true : false;
term->val.percore is bool right? so just simple
return term->val.percore;
should be enough.. together with above change
jirka
Powered by blists - more mailing lists