diff mbox series

contrib/gen_autofdo_event.py: Allow for it to work if there are more than 3 hyphens in Family-model

Message ID CAEOHGOnQ008-SxTGBwYZLgT1LGa7kQPxz_GEaBZjwFFd6QT-oA@mail.gmail.com
State New
Headers show
Series contrib/gen_autofdo_event.py: Allow for it to work if there are more than 3 hyphens in Family-model | expand

Commit Message

Javad Karabi May 21, 2020, 2:37 a.m. UTC
Perfmon mapfile Family-model's can contain 4 hyphens, e.g.
"GenuineIntel-6-55-[56789ABCDEF]"

This simply slices the hyphen-split Family-model to the first 3
elements, so that the list unpack does not throw an exception saying
that there are too many values to unpack.

Comments

Andi Kleen May 24, 2020, 9:55 p.m. UTC | #1
Javad Karabi via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
>
> diff --git a/contrib/gen_autofdo_event.py b/contrib/gen_autofdo_event.py
> index c97460c61c6..cd77a8686d9 100755
> --- a/contrib/gen_autofdo_event.py
> +++ b/contrib/gen_autofdo_event.py
> @@ -94,7 +94,7 @@ for j in u:
>      n = j.rstrip().split(',')
>      if len(n) >= 4 and (args.all or n[0] == cpu) and n[3] == "core":
>          if args.all:
> -            vendor, fam, model = n[0].split("-")
> +            vendor, fam, model = n[0].split("-")[:3]

That doesn't fix the problem, we really need to match
the stepping too. You turned a visible failure into a silent one.

-Andi
diff mbox series

Patch

diff --git a/contrib/gen_autofdo_event.py b/contrib/gen_autofdo_event.py
index c97460c61c6..cd77a8686d9 100755
--- a/contrib/gen_autofdo_event.py
+++ b/contrib/gen_autofdo_event.py
@@ -94,7 +94,7 @@  for j in u:
     n = j.rstrip().split(',')
     if len(n) >= 4 and (args.all or n[0] == cpu) and n[3] == "core":
         if args.all:
-            vendor, fam, model = n[0].split("-")
+            vendor, fam, model = n[0].split("-")[:3]
             model = int(model, 16)
         cpufound += 1
         found += find_event(baseurl + n[2], model)