From: Jiri Olsa <jolsa@redhat.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>, Jiri Olsa <jolsa@kernel.org>,
linux-kernel@vger.kernel.org, Namhyung Kim <namhyung@kernel.org>,
Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 2/2] perf, tools, stat: Reset ids counter when retrying events
Date: Wed, 21 Feb 2018 15:39:33 +0100 [thread overview]
Message-ID: <20180221143933.GE2565@krava> (raw)
In-Reply-To: <20180221140002.GB24416@kernel.org>
On Wed, Feb 21, 2018 at 11:00:02AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Oct 05, 2017 at 07:00:29PM -0700, Andi Kleen escreveu:
> > From: Andi Kleen <ak@linux.intel.com>
> >
> > perf stat can retry opening events. After opening an file descriptor
> > it adds the ids to the ecsel. Each event keeps a running
> > count of ids.
>
> Ok, and that is done in perf_evlist__id_add() where we also add things
> to the evlist->heads hashtable, shouldn't we remove all these before
> retrying? I.e. perf_evlist__close() shouldn't be resetting that
> hashtable?
>
> I.e. like in the following patch? Jiri? Namhyung?
>
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index 7b7d535396f7..e8942456106e 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -37,13 +37,18 @@
> #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
> #define SID(e, x, y) xyarray__entry(e->sample_id, x, y)
>
> -void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus,
> - struct thread_map *threads)
> +static void perf_evlist__init_heads(struct perf_evlist *evlist)
> {
> int i;
>
> for (i = 0; i < PERF_EVLIST__HLIST_SIZE; ++i)
> INIT_HLIST_HEAD(&evlist->heads[i]);
> +}
> +
> +void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus,
> + struct thread_map *threads)
> +{
> + perf_evlist__init_heads(evlist);
> INIT_LIST_HEAD(&evlist->entries);
> perf_evlist__set_maps(evlist, cpus, threads);
> fdarray__init(&evlist->pollfd, 64);
> @@ -1381,8 +1386,11 @@ void perf_evlist__close(struct perf_evlist *evlist)
> {
> struct perf_evsel *evsel;
>
> - evlist__for_each_entry_reverse(evlist, evsel)
> + evlist__for_each_entry_reverse(evlist, evsel) {
> perf_evsel__close(evsel);
> + }
> +
> + perf_evlist__init_heads(evlist);
> }
>
> static int perf_evlist__create_syswide_maps(struct perf_evlist *evlist)
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index ef351688b797..fba708bc9d98 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -1932,6 +1932,7 @@ void perf_evsel__close(struct perf_evsel *evsel)
>
> perf_evsel__close_fd(evsel);
> perf_evsel__free_fd(evsel);
> + evsel->ids = 0;
> }
yes, that seems correct
jirka
next prev parent reply other threads:[~2018-02-21 14:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-06 2:00 [PATCH 1/2] perf, tools, stat: Use xyarray dimensions to iterate fds Andi Kleen
2017-10-06 2:00 ` [PATCH 2/2] perf, tools, stat: Reset ids counter when retrying events Andi Kleen
2017-10-06 3:36 ` Andi Kleen
2018-02-21 14:00 ` Arnaldo Carvalho de Melo
2018-02-21 14:39 ` Jiri Olsa [this message]
2018-02-21 14:31 ` Jiri Olsa
2018-02-21 14:33 ` Arnaldo Carvalho de Melo
2018-02-21 14:37 ` Jiri Olsa
2018-02-21 14:33 ` [PATCH 1/2] perf, tools, stat: Use xyarray dimensions to iterate fds Jiri Olsa
2018-02-21 14:37 ` Arnaldo Carvalho de Melo
2018-03-06 6:41 ` [tip:perf/core] perf " tip-bot for Andi Kleen
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=20180221143933.GE2565@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.