[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <45b24f2b-3cb5-2e61-b80b-c19389988a07@linux.ibm.com>
Date: Wed, 18 Mar 2020 17:48:25 +0530
From: kajoljain <kjain@...ux.ibm.com>
To: Jiri Olsa <jolsa@...hat.com>
Cc: acme@...nel.org, linuxppc-dev@...ts.ozlabs.org, mpe@...erman.id.au,
sukadev@...ux.vnet.ibm.com, linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org, anju@...ux.vnet.ibm.com,
maddy@...ux.vnet.ibm.com, ravi.bangoria@...ux.ibm.com,
peterz@...radead.org, yao.jin@...ux.intel.com, ak@...ux.intel.com,
jolsa@...nel.org, kan.liang@...ux.intel.com, jmario@...hat.com,
alexander.shishkin@...ux.intel.com, mingo@...nel.org,
paulus@...abs.org, namhyung@...nel.org, mpetlan@...hat.com,
gregkh@...uxfoundation.org, benh@...nel.crashing.org,
mamatha4@...ux.vnet.ibm.com, mark.rutland@....com,
tglx@...utronix.de
Subject: Re: [PATCH v5 09/11] perf/tools: Enhance JSON/metric infrastructure
to handle "?"
On 3/17/20 8:40 PM, Jiri Olsa wrote:
> On Tue, Mar 17, 2020 at 11:53:31AM +0530, Kajol Jain wrote:
>
> SBIP
>
>> +static int metricgroup__add_metric_runtime_param(struct strbuf *events,
>> + struct list_head *group_list, struct pmu_event *pe)
>> +{
>> + int i, count;
>> + int ret = -EINVAL;
>> +
>> + count = arch_get_runtimeparam();
>> +
>> + /* This loop is added to create multiple
>> + * events depend on count value and add
>> + * those events to group_list.
>> + */
>> +
>> + for (i = 0; i < count; i++) {
>> + const char **ids;
>> + int idnum;
>> + struct egroup *eg;
>> + char value[PATH_MAX];
>> +
>> + if (expr__find_other(pe->metric_expr, NULL, &ids, &idnum, i) < 0)
>> + return ret;
>> +
>> + if (events->len > 0)
>> + strbuf_addf(events, ",");
>> +
>> + if (metricgroup__has_constraint(pe))
>> + metricgroup__add_metric_non_group(events, ids, idnum);
>> + else
>> + metricgroup__add_metric_weak_group(events, ids, idnum);
>> +
>> + eg = malloc(sizeof(*eg));
>> + if (!eg) {
>> + ret = -ENOMEM;
>> + return ret;
>> + }
>> +
>> + sprintf(value, "%s%c%d", pe->metric_name, '_', i);
>> + eg->ids = ids;
>> + eg->idnum = idnum;
>> + eg->metric_name = strdup(value);
>> + if (!eg->metric_name) {
>> + ret = -ENOMEM;
>> + return ret;
>> + }
>> +
>> + eg->metric_expr = pe->metric_expr;
>> + eg->metric_unit = pe->unit;
>> + list_add_tail(&eg->nd, group_list);
>> + ret = 0;
>> +
>> + if (ret != 0)
>> + break;
>
> again, this is part of metricgroup__add_metric_param no? why not use it?
Yes right, thanks for pointing it out. Will update in next version.
Thanks,
Kajol
>
> jirka
>
Powered by blists - more mailing lists