lkml.org 
[lkml]   [2019]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2019-03-18 10:22    [W:0.076 / U:3.700 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site