From: Jiri Olsa <jolsa@redhat.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Stephane Eranian <eranian@google.com>,
LKML <linux-kernel@vger.kernel.org>,
Andi Kleen <ak@linux.intel.com>, Ian Rogers <irogers@google.com>,
John Garry <john.garry@huawei.com>,
Kajol Jain <kjain@linux.ibm.com>
Subject: Re: [PATCH 3/4] perf tools: Copy metric events properly when expand cgroups
Date: Fri, 18 Sep 2020 15:45:35 +0200 [thread overview]
Message-ID: <20200918134535.GC2626435@krava> (raw)
In-Reply-To: <20200916063129.1061487-4-namhyung@kernel.org>
On Wed, Sep 16, 2020 at 03:31:28PM +0900, Namhyung Kim wrote:
SNIP
> + free(new_expr);
> + return -ENOMEM;
> + }
> +
> + memcpy(new_expr->metric_refs, old_expr->metric_refs,
> + nr * alloc_size);
> + } else {
> + new_expr->metric_refs = NULL;
> + }
> +
> + /* calculate number of metric_events */
> + for (nr = 0; old_expr->metric_events[nr]; nr++)
> + continue;
> + alloc_size = sizeof(*new_expr->metric_events);
> + new_expr->metric_events = calloc(nr + 1, alloc_size);
> + if (!new_expr->metric_events) {
> + free(new_expr->metric_refs);
> + free(new_expr);
> + return -ENOMEM;
> + }
> +
> + /* copy evsel in the same position */
> + for (idx = 0; idx < nr; idx++) {
> + evsel = old_expr->metric_events[idx];
> + evsel = evlist__get_evsel(evlist, evsel->idx);
this probably won't happen, but evlist__get_evsel can return NULL
jirka
> + new_expr->metric_events[idx] = evsel;
> + }
> +
> + list_add(&new_expr->nd, &new_me->head);
> + }
> + }
> + return 0;
> +}
SNIP
next prev parent reply other threads:[~2020-09-18 13:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-16 6:31 [PATCHSET v2 0/4] perf stat: Expand events for each cgroup Namhyung Kim
2020-09-16 6:31 ` [PATCH 1/4] perf evsel: Add evsel__clone() function Namhyung Kim
2020-09-18 13:31 ` Jiri Olsa
2020-09-21 5:44 ` Namhyung Kim
2020-09-16 6:31 ` [PATCH 2/4] perf stat: Add --for-each-cgroup option Namhyung Kim
2020-09-16 13:51 ` Arnaldo Carvalho de Melo
2020-09-17 1:33 ` Namhyung Kim
2020-09-18 13:34 ` Jiri Olsa
2020-09-21 5:45 ` Namhyung Kim
2020-09-16 6:31 ` [PATCH 3/4] perf tools: Copy metric events properly when expand cgroups Namhyung Kim
2020-09-18 13:45 ` Jiri Olsa [this message]
2020-09-21 5:48 ` Namhyung Kim
2020-09-16 6:31 ` [PATCH 4/4] perf test: Add expand cgroup event test Namhyung Kim
2020-09-18 13:51 ` Jiri Olsa
2020-09-21 5:49 ` Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200918134535.GC2626435@krava \
--to=jolsa@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=eranian@google.com \
--cc=irogers@google.com \
--cc=john.garry@huawei.com \
--cc=kjain@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).