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>,
LKML <linux-kernel@vger.kernel.org>,
Stephane Eranian <eranian@google.com>,
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/5] perf tools: Copy metric events properly when expand cgroups
Date: Wed, 23 Sep 2020 12:22:56 +0200 [thread overview]
Message-ID: <20200923102256.GI2893484@krava> (raw)
In-Reply-To: <20200923015945.47535-4-namhyung@kernel.org>
On Wed, Sep 23, 2020 at 10:59:43AM +0900, Namhyung Kim wrote:
SNIP
> diff --git a/tools/perf/util/cgroup.c b/tools/perf/util/cgroup.c
> index 8b6a4fa49082..dcd18ef268a1 100644
> --- a/tools/perf/util/cgroup.c
> +++ b/tools/perf/util/cgroup.c
> @@ -3,6 +3,9 @@
> #include "evsel.h"
> #include "cgroup.h"
> #include "evlist.h"
> +#include "rblist.h"
> +#include "metricgroup.h"
> +#include "stat.h"
> #include <linux/zalloc.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> @@ -193,10 +196,12 @@ int parse_cgroups(const struct option *opt, const char *str,
> return 0;
> }
>
> -int evlist__expand_cgroup(struct evlist *evlist, const char *str)
> +int evlist__expand_cgroup(struct evlist *evlist, const char *str,
> + struct rblist *metric_events)
> {
> struct evlist *orig_list, *tmp_list;
> struct evsel *pos, *evsel, *leader;
> + struct rblist orig_metric_events;
> struct cgroup *cgrp = NULL;
> const char *p, *e, *eos = str + strlen(str);
> int ret = -1;
> @@ -216,6 +221,8 @@ int evlist__expand_cgroup(struct evlist *evlist, const char *str)
> /* save original events and init evlist */
> perf_evlist__splice_list_tail(orig_list, &evlist->core.entries);
> evlist->core.nr_entries = 0;
> + orig_metric_events = *metric_events;
> + rblist__init(metric_events);
>
> for (;;) {
> p = strchr(str, ',');
> @@ -255,6 +262,11 @@ int evlist__expand_cgroup(struct evlist *evlist, const char *str)
> cgroup__put(cgrp);
> nr_cgroups++;
>
> + perf_stat__collect_metric_expr(tmp_list);
I know you added the option just for perf stat, not record,
but the code looks generic apart from using this function
I wonder if this would cause any issues if it was called in record
context.. maybe we could just skip it in that case, but that's for
future to worry about ;-)
jirka
> + if (metricgroup__copy_metric_events(tmp_list, cgrp, metric_events,
> + &orig_metric_events) < 0)
> + break;
> +
> perf_evlist__splice_list_tail(evlist, &tmp_list->core.entries);
> tmp_list->core.nr_entries = 0;
>
> @@ -268,6 +280,7 @@ int evlist__expand_cgroup(struct evlist *evlist, const char *str)
> out_err:
> evlist__delete(orig_list);
> evlist__delete(tmp_list);
> + rblist__exit(&orig_metric_events);
>
> return ret;
> }
SNIP
next prev parent reply other threads:[~2020-09-23 10:23 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-23 1:59 [PATCHSET v4 0/5] perf stat: Expand events for each cgroup Namhyung Kim
2020-09-23 1:59 ` [PATCH 1/5] perf evsel: Add evsel__clone() function Namhyung Kim
2020-09-23 1:59 ` [PATCH 2/5] perf stat: Add --for-each-cgroup option Namhyung Kim
2020-09-23 1:59 ` [PATCH 3/5] perf tools: Copy metric events properly when expand cgroups Namhyung Kim
2020-09-23 10:22 ` Jiri Olsa [this message]
2020-09-24 3:12 ` Namhyung Kim
2020-09-23 1:59 ` [PATCH 4/5] perf tools: Allow creation of cgroup without open Namhyung Kim
2020-09-23 1:59 ` [PATCH 5/5] perf test: Add expand cgroup event test Namhyung Kim
2020-09-23 22:36 ` Ian Rogers
2020-09-24 6:35 ` Namhyung Kim
-- strict thread matches above, loose matches on Subject: below --
2020-09-24 12:44 [PATCHSET v5 0/5] perf stat: Expand events for each cgroup Namhyung Kim
2020-09-24 12:44 ` [PATCH 3/5] perf tools: Copy metric events properly when expand cgroups Namhyung Kim
2020-09-25 13:26 ` Jiri Olsa
2020-09-25 13:44 ` Namhyung Kim
2020-09-25 13:51 ` Jiri Olsa
2020-09-28 11:54 ` Arnaldo Carvalho de Melo
2020-09-28 12:36 ` Jiri Olsa
2020-09-28 12:17 ` Arnaldo Carvalho de Melo
2020-09-21 9:46 [PATCHSET v3 0/5] perf stat: Expand events for each cgroup Namhyung Kim
2020-09-21 9:46 ` [PATCH 3/5] perf tools: Copy metric events properly when expand cgroups Namhyung Kim
2020-09-22 21:29 ` Jiri Olsa
2020-09-22 22:46 ` 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=20200923102256.GI2893484@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