linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Andi Kleen <ak@linux.intel.com>,
	Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	jolsa@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Optimize perf stat for large number of events/cpus
Date: Wed, 27 Nov 2019 21:01:30 -0300	[thread overview]
Message-ID: <033E8FCB-2430-48E0-8631-0F0236D5E904@kernel.org> (raw)
In-Reply-To: <20191127232657.GL84886@tassilo.jf.intel.com>

On November 27, 2019 8:26:57 PM GMT-03:00, Andi Kleen <ak@linux.intel.com> wrote:
>On Wed, Nov 27, 2019 at 12:43:05PM -0300, Arnaldo Carvalho de Melo
>wrote:
>> So, have you tried running 'perf test' after each cset is applied and
>> built?
>
>I ran it at the end, but there are quite a few fails out of the box,
>so I missed that one thanks.
>
>This patch fixes it. Let me know if I should submit it in a more
>formal way.
>
>---
>
>Fix event times test case
>
>Reported-by: Arnaldo
>Signed-off-by: Andi Kleen <ak@linux.intel.com>
>
>diff --git a/tools/perf/lib/evsel.c b/tools/perf/lib/evsel.c
>index 4c6485fc31b9..4dc06289f4c7 100644
>--- a/tools/perf/lib/evsel.c
>+++ b/tools/perf/lib/evsel.c
>@@ -224,7 +224,7 @@ int perf_evsel__enable(struct perf_evsel *evsel)
> 	int i;
> 	int err = 0;
> 
>-	for (i = 0; i < evsel->cpus->nr && !err; i++)
>+	for (i = 0; i < xyarray__max_x(evsel->fd) && !err; i++)
> 		err = perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_ENABLE, NULL, i);
> 	return err;
> }
>@@ -239,7 +239,7 @@ int perf_evsel__disable(struct perf_evsel *evsel)
> 	int i;
> 	int err = 0;
> 
>-	for (i = 0; i < evsel->cpus->nr && !err; i++)
>+	for (i = 0; i < xyarray__max_x(evsel->fd) && !err; i++)
> 		err = perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_DISABLE, NULL, i);
> 	return err;
> }
>diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
>index 59b9b4f3fe34..0844e3e29fb0 100644
>--- a/tools/perf/util/evsel.c
>+++ b/tools/perf/util/evsel.c
>@@ -1853,6 +1853,10 @@ int perf_evsel__open_per_cpu(struct evsel
>*evsel,
> 			     struct perf_cpu_map *cpus,
> 			     int cpu)
> {
>+	if (cpu == -1)
>+		return evsel__open_cpu(evsel, cpus, NULL, 0,
>+					cpus ? cpus->nr : 1);
>+
> 	return evsel__open_cpu(evsel, cpus, NULL, cpu, cpu + 1);
> }
> 

Just save me some time by saying to which cset in v8 I should squash this into, so that we keep the whole shebang bisectable,

Thanks,

- Arnaldo

  reply	other threads:[~2019-11-28  0:00 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-21  0:15 Andi Kleen
2019-11-21  0:15 ` [PATCH 01/12] perf pmu: Use file system cache to optimize sysfs access Andi Kleen
2019-11-29  6:02   ` [tip: perf/urgent] " tip-bot2 for Andi Kleen
2019-11-21  0:15 ` [PATCH 02/12] perf affinity: Add infrastructure to save/restore affinity Andi Kleen
2019-11-29  6:02   ` [tip: perf/urgent] " tip-bot2 for Andi Kleen
2019-11-21  0:15 ` [PATCH 03/12] perf cpumap: Maintain cpumaps ordered and without dups Andi Kleen
2019-12-04  7:53   ` [tip: perf/urgent] " tip-bot2 for Andi Kleen
2019-11-21  0:15 ` [PATCH 04/12] perf evlist: Maintain evlist->all_cpus Andi Kleen
2019-12-04  7:53   ` [tip: perf/urgent] " tip-bot2 for Andi Kleen
2019-11-21  0:15 ` [PATCH 05/12] perf evsel: Add iterator to iterate over events ordered by CPU Andi Kleen
2019-12-04  7:53   ` [tip: perf/urgent] " tip-bot2 for Andi Kleen
2019-11-21  0:15 ` [PATCH 06/12] perf evsel: Add functions to close evsel on a CPU Andi Kleen
2019-12-04  7:53   ` [tip: perf/urgent] " tip-bot2 for Andi Kleen
2019-11-21  0:15 ` [PATCH 07/12] perf stat: Use affinity for closing file descriptors Andi Kleen
2019-12-04  7:53   ` [tip: perf/urgent] " tip-bot2 for Andi Kleen
2019-11-21  0:15 ` [PATCH 08/12] perf stat: Factor out open error handling Andi Kleen
2019-12-04  7:53   ` [tip: perf/urgent] " tip-bot2 for Andi Kleen
2019-11-21  0:15 ` [PATCH 09/12] perf stat: Use affinity for opening events Andi Kleen
2019-12-04  7:53   ` [tip: perf/urgent] " tip-bot2 for Andi Kleen
2019-12-18  9:29   ` [perf stat] cc9cdf40ae: perf-sanity-tests.Event_times.fail kernel test robot
2019-11-21  0:15 ` [PATCH 10/12] perf stat: Use affinity for reading Andi Kleen
2019-12-04  7:53   ` [tip: perf/urgent] " tip-bot2 for Andi Kleen
2019-11-21  0:15 ` [PATCH 11/12] perf evsel: Add functions to enable/disable for a specific CPU Andi Kleen
2019-12-04  7:53   ` [tip: perf/urgent] " tip-bot2 for Andi Kleen
2019-11-21  0:15 ` [PATCH 12/12] perf stat: Use affinity for enabling/disabling events Andi Kleen
2019-12-04  7:53   ` [tip: perf/urgent] " tip-bot2 for Andi Kleen
2019-11-21 12:47 ` Optimize perf stat for large number of events/cpus Andi Kleen
2019-11-21 14:32   ` Arnaldo Carvalho de Melo
2019-11-27 15:16 ` Arnaldo Carvalho de Melo
2019-11-27 15:43   ` Arnaldo Carvalho de Melo
2019-11-27 23:26     ` Andi Kleen
2019-11-28  0:01       ` Arnaldo Carvalho de Melo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-11-16  5:52 Andi Kleen
2019-11-20 15:16 ` Jiri Olsa
2019-11-12  0:59 Andi Kleen
2019-11-07 18:16 Andi Kleen
2019-11-05  0:25 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=033E8FCB-2430-48E0-8631-0F0236D5E904@kernel.org \
    --to=arnaldo.melo@gmail.com \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: Optimize perf stat for large number of events/cpus' \
    /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

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox