mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-23 02:44:18 +08:00
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.
This commit is contained in:
parent
440be01b07
commit
9c8f3d5e7d
@ -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)
|
||||
|
@ -82,17 +82,24 @@ model*:\ 126|\
|
||||
model*:\ 167|\
|
||||
model*:\ 140|\
|
||||
model*:\ 141|\
|
||||
model*:\ 143|\
|
||||
model*:\ 207|\
|
||||
model*:\ 106|\
|
||||
model*:\ 108) E="cpu/event=0xc4,umask=0x20/p$FLAGS" ;;
|
||||
model*:\ 108|\
|
||||
model*:\ 173|\
|
||||
model*:\ 174) E="cpu/event=0xc4,umask=0x20/$FLAGS" ;;
|
||||
model*:\ 134|\
|
||||
model*:\ 150|\
|
||||
model*:\ 156|\
|
||||
model*:\ 190) E="cpu/event=0xc4,umask=0xfe/p$FLAGS" ;;
|
||||
model*:\ 156) E="cpu/event=0xc4,umask=0xfe/p$FLAGS" ;;
|
||||
model*:\ 143|\
|
||||
model*:\ 207) E="cpu/event=0xc4,umask=0x20/p$FLAGS" ;;
|
||||
model*:\ 190) E="cpu/event=0xc4,umask=0xc0/$FLAGS" ;;
|
||||
model*:\ 190) E="cpu/event=0xc4,umask=0xfe/$FLAGS" ;;
|
||||
*)
|
||||
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 ;;
|
||||
exit 1
|
||||
fi ;;
|
||||
esac
|
||||
set -x
|
||||
if ! perf record -e $E -b "$@" ; then
|
||||
@ -100,7 +107,7 @@ if ! perf record -e $E -b "$@" ; then
|
||||
# (e.g., in a virtual machine). Trying to run without /p.
|
||||
set +x
|
||||
echo >&2 "Retrying without /p."
|
||||
E="$(echo "${E}" | sed -e 's/\/p/\//')"
|
||||
E="$(echo "${E}" | sed -e \'s/\/p/\//\ -e s/:p//)"
|
||||
set -x
|
||||
exec perf record -e $E -b "$@"
|
||||
set +x
|
||||
|
Loading…
Reference in New Issue
Block a user