|
6 | 6 |
|
7 | 7 | set -e
|
8 | 8 |
|
| 9 | +skip_test=0 |
| 10 | + |
9 | 11 | function commachecker()
|
10 | 12 | {
|
11 | 13 | local -i cnt=0
|
@@ -156,14 +158,47 @@ check_per_socket()
|
156 | 158 | echo "[Success]"
|
157 | 159 | }
|
158 | 160 |
|
| 161 | +# The perf stat options for per-socket, per-core, per-die |
| 162 | +# and -A ( no_aggr mode ) uses the info fetched from this |
| 163 | +# directory: "/sys/devices/system/cpu/cpu*/topology". For |
| 164 | +# example, socket value is fetched from "physical_package_id" |
| 165 | +# file in topology directory. |
| 166 | +# Reference: cpu__get_topology_int in util/cpumap.c |
| 167 | +# If the platform doesn't expose topology information, values |
| 168 | +# will be set to -1. For example, incase of pSeries platform |
| 169 | +# of powerpc, value for "physical_package_id" is restricted |
| 170 | +# and set to -1. Check here validates the socket-id read from |
| 171 | +# topology file before proceeding further |
| 172 | + |
| 173 | +FILE_LOC="/sys/devices/system/cpu/cpu*/topology/" |
| 174 | +FILE_NAME="physical_package_id" |
| 175 | + |
| 176 | +check_for_topology() |
| 177 | +{ |
| 178 | + if ! ParanoidAndNotRoot 0 |
| 179 | + then |
| 180 | + socket_file=`ls $FILE_LOC/$FILE_NAME | head -n 1` |
| 181 | + [ -z $socket_file ] && return 0 |
| 182 | + socket_id=`cat $socket_file` |
| 183 | + [ $socket_id == -1 ] && skip_test=1 |
| 184 | + return 0 |
| 185 | + fi |
| 186 | +} |
| 187 | + |
| 188 | +check_for_topology |
159 | 189 | check_no_args
|
160 | 190 | check_system_wide
|
161 |
| -check_system_wide_no_aggr |
162 | 191 | check_interval
|
163 | 192 | check_event
|
164 |
| -check_per_core |
165 | 193 | check_per_thread
|
166 |
| -check_per_die |
167 | 194 | check_per_node
|
168 |
| -check_per_socket |
| 195 | +if [ $skip_test -ne 1 ] |
| 196 | +then |
| 197 | + check_system_wide_no_aggr |
| 198 | + check_per_core |
| 199 | + check_per_die |
| 200 | + check_per_socket |
| 201 | +else |
| 202 | + echo "[Skip] Skipping tests for system_wide_no_aggr, per_core, per_die and per_socket since socket id exposed via topology is invalid" |
| 203 | +fi |
169 | 204 | exit 0
|
0 commit comments