diff options
author | Eugene Rozenfeld <erozen@microsoft.com> | 2021-07-01 16:21:36 -0700 |
---|---|---|
committer | Eugene Rozenfeld <erozen@microsoft.com> | 2021-07-01 23:30:14 -0700 |
commit | 01d402c5e0ac1ddf5618bbe316b50067625fda46 (patch) | |
tree | 4a0ba3dcc78f61fc407651554c59706cb36c98c7 /gcc | |
parent | 73494401241b183ca188954a035734fcc53d97de (diff) | |
download | gcc-01d402c5e0ac1ddf5618bbe316b50067625fda46.zip gcc-01d402c5e0ac1ddf5618bbe316b50067625fda46.tar.gz gcc-01d402c5e0ac1ddf5618bbe316b50067625fda46.tar.bz2 |
Update gen_autofdo_event.py and gcc-auto-profile.
gen_autofdo_event.py was stumbling on models with stepping so
I updated the script to handle this case similar to the code in
https://github.com/andikleen/pmu-tools/blob/c6a5f63aede19def8886d6a8b74d7a55c38ca947/event_download.py
The second change was to tolerate cases when the CPU supports PEBS but the
perf command with /p fails. This can happen in, e.g., a virtual machine.
I regenerated gcc-auto-profile using the updated script.
contrib/ChangeLog:
* gen_autofdo_event.py: handle stepping, non-working PEBS
gcc/ChangeLog:
* config/i386/gcc-auto-profile: regenerate
Diffstat (limited to 'gcc')
-rwxr-xr-x | gcc/config/i386/gcc-auto-profile | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/gcc/config/i386/gcc-auto-profile b/gcc/config/i386/gcc-auto-profile index 5da5c63..56f64cb 100755 --- a/gcc/config/i386/gcc-auto-profile +++ b/gcc/config/i386/gcc-auto-profile @@ -1,7 +1,7 @@ #!/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 --shell --all in gcc source +# 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 # usages: # gcc-auto-profile program (profile program and children) @@ -10,7 +10,7 @@ # gcc-auto-profile --kernel -a sleep X (profile kernel) # gcc-auto-profile --all -a sleep X (profile kernel and user space) -# identify branches taken event for CPU +# Identify branches taken event for CPU. # FLAGS=u @@ -37,7 +37,12 @@ case `egrep -q "^cpu family\s*: 6" /proc/cpuinfo && egrep "^model\s*:" /proc/cpuinfo | head -n1` in model*:\ 55|\ model*:\ 77|\ -model*:\ 76) E="cpu/event=0xC4,umask=0xFE/p$FLAGS" ;; +model*:\ 76|\ +model*:\ 92|\ +model*:\ 95|\ +model*:\ 87|\ +model*:\ 133|\ +model*:\ 122) E="cpu/event=0xC4,umask=0xFE/p$FLAGS" ;; model*:\ 42|\ model*:\ 45|\ model*:\ 58|\ @@ -48,9 +53,16 @@ model*:\ 70|\ model*:\ 63|\ model*:\ 61|\ model*:\ 71|\ +model*:\ 79|\ model*:\ 86|\ model*:\ 78|\ -model*:\ 94) E="cpu/event=0xC4,umask=0x20/p$FLAGS" ;; +model*:\ 94|\ +model*:\ 142|\ +model*:\ 158|\ +model*:\ 165|\ +model*:\ 166|\ +model*:\ 85|\ +model*:\ 85) E="cpu/event=0xC4,umask=0x20/p$FLAGS" ;; model*:\ 46|\ model*:\ 30|\ model*:\ 31|\ @@ -63,8 +75,23 @@ model*:\ 38|\ model*:\ 39|\ model*:\ 54|\ model*:\ 53) E="cpu/event=0x88,umask=0x41/p$FLAGS" ;; +model*:\ 126|\ +model*:\ 140|\ +model*:\ 141|\ +model*:\ 106|\ +model*:\ 108) E="cpu/event=0xc4,umask=0x20/p$FLAGS" ;; *) echo >&2 "Unknown CPU. Run contrib/gen_autofdo_event.py --all --script to update script." exit 1 ;; esac -exec perf record -e $E -b "$@" +set -x +if ! perf record -e $E -b "$@" ; then + # PEBS may not actually be working even if the processor supports it + # (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/\//')" + set -x + exec perf record -e $E -b "$@" + set +x +fi |