archive mirror
 help / color / mirror / Atom feed
From: "Bernhard M. Wiedemann" <>
To: Arnaldo Carvalho de Melo <>
Cc:, Ian Rogers <>,,
	"Bernhard M. Wiedemann" <>
Subject: [PATCH] perf jevents: Sort list of input files
Date: Tue, 21 Mar 2023 07:30:32 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

Without this, pmu-events.c would be generated with variations in ordering
depending on non-deterministic filesystem readdir order.

I tested that pmu-events.c still has the same number of lines
and that perf list output works.

This patch was done while working on reproducible builds for openSUSE,
but also solves issues in Debian [1] and other distributions.


Signed-off-by: Bernhard M. Wiedemann <>
CC: Ian Rogers <>
 tools/perf/pmu-events/ | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/pmu-events/ b/tools/perf/pmu-events/
index 2bcd07ce609f..736ee0a75cf8 100755
--- a/tools/perf/pmu-events/
+++ b/tools/perf/pmu-events/
@@ -889,7 +889,7 @@ def main() -> None:
   def ftw(path: str, parents: Sequence[str],
           action: Callable[[Sequence[str], os.DirEntry], None]) -> None:
     """Replicate the directory/file walking behavior of C's file tree walk."""
-    for item in os.scandir(path):
+    for item in sorted(os.scandir(path), key=lambda e:
       if _args.model != 'all' and item.is_dir():
         # Check if the model matches one in _args.model.
         if len(parents) == _args.model.split(',')[0].count('/'):

  reply	other threads:[~2023-03-21  6:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 20:18 [PATCH] perf jevents: Sort list of input files Bernhard M. Wiedemann
2023-03-20 20:48 ` Ian Rogers
2023-03-20 21:30   ` Bernhard M. Wiedemann
2023-03-20 21:39     ` Ian Rogers
2023-03-20 22:24     ` Arnaldo Carvalho de Melo
2023-03-21  6:30       ` Bernhard M. Wiedemann [this message]
2023-03-21 12:38         ` Arnaldo Carvalho de Melo

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \

* 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).