aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorAndi Kleen <ak@gcc.gnu.org>2024-10-31 16:31:02 -0700
committerAndi Kleen <ak@gcc.gnu.org>2024-11-08 20:42:43 -0800
commit9c8f3d5e7d5ee64ffe5c50a72b087227f2e8f957 (patch)
treef882b81fe82af9b4087f6afd4f9d27ac7d4de743 /contrib
parent440be01b07941506d1c8819448bd17c8717d55f5 (diff)
downloadgcc-9c8f3d5e7d5ee64ffe5c50a72b087227f2e8f957.zip
gcc-9c8f3d5e7d5ee64ffe5c50a72b087227f2e8f957.tar.gz
gcc-9c8f3d5e7d5ee64ffe5c50a72b087227f2e8f957.tar.bz2
Update gcc-auto-profile / gen_autofdo_event.py
- Fix warnings with newer python versions about bad escapes by making all the python string raw. - Add a fallback for using the builtin perf event list if the CPU model number is unknown. - Regenerate the shipped gcc-auto-profile with the changes. contrib/ChangeLog: * gen_autofdo_event.py: Convert strings to raw. Add fallback to using builtin perf event list. gcc/ChangeLog: * config/i386/gcc-auto-profile: Regenerate.
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/gen_autofdo_event.py36
1 files changed, 20 insertions, 16 deletions
diff --git a/contrib/gen_autofdo_event.py b/contrib/gen_autofdo_event.py
index 4c20194..4e58a53 100755
--- a/contrib/gen_autofdo_event.py
+++ b/contrib/gen_autofdo_event.py
@@ -112,7 +112,7 @@ for j in u:
u.close()
if args.script:
- print('''#!/bin/sh
+ print(r'''#!/bin/sh
# Profile workload for gcc profile feedback (autofdo) using Linux perf.
# Auto generated. To regenerate for new CPUs run
# contrib/gen_autofdo_event.py --script --all in gcc source
@@ -152,22 +152,26 @@ case `grep -E -q "^cpu family\s*: 6" /proc/cpuinfo &&
for event, mod in eventmap.items():
for m in mod[:-1]:
print("model*:\ %s|\\" % m)
- print('model*:\ %s) E="%s$FLAGS" ;;' % (mod[-1], event))
- print('''*)
+ print(r'model*:\ %s) E="%s$FLAGS" ;;' % (mod[-1], event))
+ print(r'''*)
+ if perf list br_inst_retired | grep -q br_inst_retired.near_taken ; then
+ E=br_inst_retired.near_taken:p
+ else
echo >&2 "Unknown CPU. Run contrib/gen_autofdo_event.py --all --script to update script."
- exit 1 ;;''')
- print("esac")
- print("set -x")
- print('if ! perf record -e $E -b "$@" ; then')
- print(' # PEBS may not actually be working even if the processor supports it')
- print(' # (e.g., in a virtual machine). Trying to run without /p.')
- print(' set +x')
- print(' echo >&2 "Retrying without /p."')
- print(' E="$(echo "${E}" | sed -e \'s/\/p/\//\')"')
- print(' set -x')
- print(' exec perf record -e $E -b "$@"')
- print(' set +x')
- print('fi')
+ exit 1
+ fi ;;''')
+ print(r"esac")
+ print(r"set -x")
+ print(r'if ! perf record -e $E -b "$@" ; then')
+ print(r' # PEBS may not actually be working even if the processor supports it')
+ print(r' # (e.g., in a virtual machine). Trying to run without /p.')
+ print(r' set +x')
+ print(r' echo >&2 "Retrying without /p."')
+ print(r' E="$(echo "${E}" | sed -e \'s/\/p/\//\ -e s/:p//)"')
+ print(r' set -x')
+ print(r' exec perf record -e $E -b "$@"')
+ print(r' set +x')
+ print(r'fi')
if cpufound == 0 and not args.all:
sys.exit('CPU %s not found' % cpu)