]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | # | |
3 | # | |
4 | # CDDL HEADER START | |
5 | # | |
6 | # The contents of this file are subject to the terms | |
7 | # of the Common Development and Distribution License | |
8 | # (the "License"). You may not use this file except | |
9 | # in compliance with the License. | |
10 | # | |
11 | # You can obtain a copy of the license at | |
12 | # src/OPENSOLARIS.LICENSE | |
13 | # or http://www.opensolaris.org/os/licensing. | |
14 | # See the License for the specific language governing | |
15 | # permissions and limitations under the License. | |
16 | # | |
17 | # When distributing Covered Code, include this CDDL | |
18 | # HEADER in each file and include the License file at | |
19 | # usr/src/OPENSOLARIS.LICENSE. If applicable, | |
20 | # add the following below this CDDL HEADER, with the | |
21 | # fields enclosed by brackets "[]" replaced with your | |
22 | # own identifying information: Portions Copyright [yyyy] | |
23 | # [name of copyright owner] | |
24 | # | |
25 | # CDDL HEADER END | |
26 | # | |
27 | ||
28 | # | |
29 | # Copyright 2007 Sun Microsystems, Inc. All rights reserved. | |
30 | # Use is subject to license terms. | |
31 | # | |
32 | ||
33 | function usage { | |
34 | echo "Usage" | |
35 | echo "$0 [-l] [-h] <#-of-users> nodename [test match pattern]" | |
36 | echo "-l : disable libinfo L1 cache" | |
37 | echo "-h : Help. This option displays information on how to run the script. " | |
38 | echo "[test match pattern] : This option runs only the test that is specified" | |
39 | echo | |
40 | echo "You must have set up users, groups, and SACLs with od_account_create" | |
41 | echo "with the same number of user accounts." | |
42 | echo "Supply a pattern to match to run a subset of tests" | |
43 | exit 1 | |
44 | } | |
45 | ||
46 | # default to libinfo cache enabled | |
47 | L1CACHE="1" | |
48 | ||
49 | while getopts "lh" OPT_LIST | |
50 | do | |
51 | case $OPT_LIST in | |
52 | l) L1CACHE="0";; # to run the libmicro tests with l1cache disabled | |
53 | h) usage;; | |
54 | *) usage;; | |
55 | esac | |
56 | done | |
57 | ||
58 | shift `expr $OPTIND - 1` | |
59 | ||
60 | if [ $# -lt 2 -o $# -gt 3 ]; then | |
61 | usage | |
62 | fi | |
63 | ||
64 | tattle="./tattle" | |
65 | ||
66 | bench_version=0.4.0 | |
67 | libmicro_version=`$tattle -V` | |
68 | ||
69 | case $libmicro_version in | |
70 | $bench_version) | |
71 | ;; | |
72 | *) | |
73 | echo "ERROR: libMicro version doesn't match 'bench' script version" | |
74 | exit 1 | |
75 | esac | |
76 | ||
77 | TMPROOT=/private/tmp/libmicro.$$ | |
78 | VARROOT=/private/var/tmp/libmicro.$$ | |
79 | mkdir -p $TMPROOT | |
80 | mkdir -p $VARROOT | |
81 | trap "rm -rf $TMPROOT $VARROOT && exit" 0 2 | |
82 | ||
83 | TFILE=$TMPROOT/data | |
84 | IFILE=$TMPROOT/ifile | |
85 | TDIR1=$TMPROOT/0/1/2/3/4/5/6/7/8/9 | |
86 | TDIR2=$TMPROOT/1/2/3/4/5/6/7/8/9/0 | |
87 | VFILE=$VARROOT/data | |
88 | VDIR1=$VARROOT/0/1/2/3/4/5/6/7/8/9 | |
89 | VDIR2=$VARROOT/1/2/3/4/5/6/7/8/9/0 | |
90 | ||
91 | OPTS="-E -C 200 -L -S -W" | |
92 | ||
93 | dd if=/dev/zero of=$TFILE bs=1024k count=10 2>/dev/null | |
94 | dd if=/dev/zero of=$VFILE bs=1024k count=10 2>/dev/null | |
95 | mkdir -p $TDIR1 $TDIR2 | |
96 | mkdir -p $VDIR1 $VDIR2 | |
97 | ||
98 | touch $IFILE | |
99 | /usr/bin/touch /private/var/tmp/lmbench | |
100 | ||
101 | ||
102 | # produce benchmark header for easier comparisons | |
103 | ||
104 | hostname=`uname -n` | |
105 | ||
106 | if [ -f /usr/sbin/psrinfo ]; then | |
107 | p_count=`psrinfo|wc -l` | |
108 | p_mhz=`psrinfo -v | awk '/operates/{print $6 "MHz"; exit }'` | |
109 | p_type=`psrinfo -vp 2>/dev/null | awk '{if (NR == 3) {print $0; exit}}'` | |
110 | p_ipaddr=`getent hosts $hostname | awk '{print $1}'` | |
111 | fi | |
112 | ||
113 | if [ -f /proc/cpuinfo ]; then | |
114 | p_count=`egrep processor /proc/cpuinfo | wc -l` | |
115 | p_mhz=`awk -F: '/cpu MHz/{printf("%5.0f00Mhz\n",$2/100); exit}' /proc/cpuinfo` | |
116 | p_type=`awk -F: '/model name/{print $2; exit}' /proc/cpuinfo` | |
117 | p_ipaddr=`getent hosts $hostname | awk '{print $1}'` | |
118 | else | |
119 | ## Mac OS X specific stuff | |
120 | # first, get ugly output, in case pretty output isn't available | |
121 | # | |
122 | p_count=`sysctl -n hw.physicalcpu` | |
123 | p_mhz=`sysctl -n hw.cpufrequency` | |
124 | p_type=`sysctl -n hw.model` | |
125 | ||
126 | if [ -x /usr/sbin/system_profiler ]; then | |
127 | # <rdar://4655981> requires this hunk of work-around | |
128 | # grep the XML for the characteristic we need. The key appears twice, so grep for the useful key (with 'string') | |
129 | # use sed to strip off the <string></string> and the tabs in front of the string. So much work for so little result. | |
130 | # | |
131 | p_mhz=`system_profiler -xml -detailLevel mini SPHardwareDataType | \ | |
132 | grep -A1 current_processor_speed | grep string | \ | |
133 | sed -E 's/<string>(.+)<\/string>/\1/' | sed 's- --g'` | |
134 | p_type=`system_profiler -xml -detailLevel mini SPHardwareDataType | \ | |
135 | grep -A1 cpu_type | grep string | \ | |
136 | sed -E 's/<string>(.+)<\/string>/\1/' | sed 's- --g'` | |
137 | fi | |
138 | ||
139 | # look for en0 (usually ethernet) if that isn't there try en1 (usually wireless) else give up | |
140 | p_ipaddr=`ipconfig getpacket en0 | grep yiaddr | tr "= " "\n" | grep [0-9]` | |
141 | if [ ! $p_ipaddr ]; then | |
142 | p_ipaddr=`ipconfig getpacket en1 | grep yiaddr | tr "= " "\n" | grep [0-9]` | |
143 | elif [ ! $p_ipaddr ]; then | |
144 | p_ipaddr="unknown" | |
145 | fi | |
146 | fi | |
147 | ||
148 | printf "\n\n!Libmicro_#: %30s\n" $libmicro_version | |
149 | printf "!Options: %30s\n" "$OPTS" | |
150 | printf "!Machine_name: %30s\n" "$hostname" | |
151 | printf "!OS_name: %30s\n" `uname -s` | |
152 | printf "!OS_release: %30s\n" `sw_vers -productVersion` | |
153 | printf "!OS_build: %30.18s\n" "`sw_vers -buildVersion`" | |
154 | printf "!Processor: %30s\n" `arch` | |
155 | printf "!#CPUs: %30s\n" $p_count | |
156 | printf "!CPU_MHz: %30s\n" "$p_mhz" | |
157 | printf "!CPU_NAME: %30s\n" "$p_type" | |
158 | printf "!IP_address: %30s\n" "$p_ipaddr" | |
159 | printf "!Run_by: %30s\n" $LOGNAME | |
160 | printf "!Date: %30s\n" "`date '+%D %R'`" | |
161 | printf "!Compiler: %30s\n" `$tattle -c` | |
162 | printf "!Compiler Ver.:%30s\n" "`$tattle -v`" | |
163 | printf "!sizeof(long): %30s\n" `$tattle -s` | |
164 | printf "!extra_CFLAGS: %30s\n" "`$tattle -f`" | |
165 | printf "!TimerRes: %30s\n\n\n" "`$tattle -r`" | |
166 | ||
167 | bin_dir="$TMPROOT/bin" | |
168 | ||
169 | mkdir -p $bin_dir | |
170 | cp bin-*/exec_bin $bin_dir/$A | |
171 | ||
172 | cp ./apple/bin-*/posix_spawn_bin $bin_dir/$A | |
173 | ||
174 | newline=0 | |
175 | ||
176 | # We commonly want to adjust this script for the number of users | |
177 | # and configuration of the accounts and configuration being tested. | |
178 | # | |
179 | # Users: | |
180 | NUSERS=$1 | |
181 | NODENAME=$2 | |
182 | UID_BASE=5000 | |
183 | UID_END=`expr $UID_BASE + $NUSERS - 1` | |
184 | USER_PREFIX=od_test_ | |
185 | # | |
186 | # Groups: | |
187 | GID_ALL_USERS=1211 | |
188 | GID_NO_USERS=1212 | |
189 | GROUP_BASE=od_test_group | |
190 | # | |
191 | # getaddrinfo on hosts: | |
192 | HOST_BASE=sfs0 | |
193 | HOST_RANGE=1-8 | |
194 | ||
195 | # | |
196 | # Everything below the while loop is input for the while loop | |
197 | # if you have any tests which can't run in the while loop, put | |
198 | # them above this comment | |
199 | # | |
200 | while read A B | |
201 | do | |
202 | # $A contains the command, $B contains the arguments | |
203 | # we echo blank lines and comments | |
204 | # we skip anything which fails to match *$1* (useful | |
205 | # if we only want to test one case, but a nasty hack) | |
206 | ||
207 | case $A in | |
208 | \#*) | |
209 | echo "$A $B" | |
210 | newline=1 | |
211 | continue | |
212 | ;; | |
213 | ||
214 | "") | |
215 | if [ $newline -eq 1 ] | |
216 | then | |
217 | newline=0 | |
218 | echo | |
219 | echo | |
220 | fi | |
221 | ||
222 | continue | |
223 | ;; | |
224 | ||
225 | *$3*) | |
226 | ;; | |
227 | ||
228 | *) | |
229 | continue | |
230 | ;; | |
231 | esac | |
232 | ||
233 | if [ ! -f $bin_dir/$A ] | |
234 | then | |
235 | cp bin-*/$A $bin_dir/$A | |
236 | fi | |
237 | ||
238 | echo | |
239 | ||
240 | (cd $TMPROOT && eval "bin/$A $B") | |
241 | ||
242 | echo | |
243 | echo | |
244 | done <<. | |
245 | ||
246 | # -P <# procs> | |
247 | # -T <# threads> - exclusive! | |
248 | ||
249 | # mbr_check_service_membership() | |
250 | mbr_check_service_membership $OPTS -N "mbr_check_service_membership" -s libMicro -u ${USER_PREFIX} -r ${NUSERS} | |
251 | mbr_check_service_membership $OPTS -N "mbr_check_service_membership_t2" -T 2 -s libMicro -u ${USER_PREFIX} -r ${NUSERS} | |
252 | mbr_check_service_membership $OPTS -N "mbr_check_service_membership_t4" -T 4 -s libMicro -u ${USER_PREFIX} -r ${NUSERS} | |
253 | mbr_check_service_membership $OPTS -N "mbr_check_service_membership_p2" -P 2 -s libMicro -u ${USER_PREFIX} -r ${NUSERS} | |
254 | mbr_check_service_membership $OPTS -N "mbr_check_service_membership_p4" -P 4 -s libMicro -u ${USER_PREFIX} -r ${NUSERS} | |
255 | ||
256 | # getpwnam() | |
257 | getpwnam $OPTS -N "getpwnam" -l ${L1CACHE} -r ${NUSERS} -u ${USER_PREFIX} | |
258 | getpwnam $OPTS -N "getpwnam_t2" -T 2 -l ${L1CACHE} -r ${NUSERS} -u ${USER_PREFIX} | |
259 | getpwnam $OPTS -N "getpwnam_p2" -P 2 -l ${L1CACHE} -r ${NUSERS} -u ${USER_PREFIX} | |
260 | ||
261 | # mbr_check_membership() | |
262 | mbr_check_membership $OPTS -N "mbr_check_membership" -u ${UID_BASE}-${UID_END} -g ${GID_ALL_USERS}-${GID_NO_USERS} | |
263 | mbr_check_membership $OPTS -N "mbr_check_membership_t2" -u ${UID_BASE}-${UID_END} -g ${GID_ALL_USERS}-${GID_NO_USERS} -T 2 | |
264 | mbr_check_membership $OPTS -N "mbr_check_membership_t4" -u ${UID_BASE}-${UID_END} -g ${GID_ALL_USERS}-${GID_NO_USERS} -T 4 | |
265 | mbr_check_membership $OPTS -N "mbr_check_membership_p2" -u ${UID_BASE}-${UID_END} -g ${GID_ALL_USERS}-${GID_NO_USERS} -P 2 | |
266 | mbr_check_membership $OPTS -N "mbr_check_membership_p4" -u ${UID_BASE}-${UID_END} -g ${GID_ALL_USERS}-${GID_NO_USERS} -P 4 | |
267 | ||
268 | # getpwuid() | |
269 | getpwuid $OPTS -N "getpwuid" -l ${L1CACHE} -u ${UID_BASE}-${UID_END} | |
270 | getpwuid $OPTS -N "getpwuid_t2" -l ${L1CACHE} -u ${UID_BASE}-${UID_END} -T 2 | |
271 | getpwuid $OPTS -N "getpwuid_t4" -l ${L1CACHE} -u ${UID_BASE}-${UID_END} -T 4 | |
272 | getpwuid $OPTS -N "getpwuid_p2" -l ${L1CACHE} -u ${UID_BASE}-${UID_END} -P 2 | |
273 | getpwuid $OPTS -N "getpwuid_p4" -l ${L1CACHE} -u ${UID_BASE}-${UID_END} -P 4 | |
274 | ||
275 | # getgrgid() | |
276 | getgrgid $OPTS -N "getgrgid" -l ${L1CACHE} -g ${GID_ALL_USERS}-${GID_NO_USERS} | |
277 | getgrgid $OPTS -N "getgrgid_t2" -l ${L1CACHE} -g ${GID_ALL_USERS}-${GID_NO_USERS} -T 2 | |
278 | getgrgid $OPTS -N "getgrgid_t4" -l ${L1CACHE} -g ${GID_ALL_USERS}-${GID_NO_USERS} -T 4 | |
279 | getgrgid $OPTS -N "getgrgid_p2" -l ${L1CACHE} -g ${GID_ALL_USERS}-${GID_NO_USERS} -P 2 | |
280 | getgrgid $OPTS -N "getgrgid_p4" -l ${L1CACHE} -g ${GID_ALL_USERS}-${GID_NO_USERS} -P 4 | |
281 | ||
282 | # getpwent() | |
283 | getpwent $OPTS -N "getpwent" -l ${L1CACHE} | |
284 | getpwent $OPTS -N "getpwent_t2" -l ${L1CACHE} -T 2 | |
285 | getpwent $OPTS -N "getpwent_t4" -l ${L1CACHE} -T 4 | |
286 | getpwent $OPTS -N "getpwent_p2" -l ${L1CACHE} -P 2 | |
287 | getpwent $OPTS -N "getpwent_p4" -l ${L1CACHE} -P 4 | |
288 | ||
289 | # getgrent() | |
290 | getgrent $OPTS -N "getgrent" -l ${L1CACHE} | |
291 | getgrent $OPTS -N "getgrent_t2" -l ${L1CACHE} -T 2 | |
292 | getgrent $OPTS -N "getgrent_t4" -l ${L1CACHE} -T 4 | |
293 | getgrent $OPTS -N "getgrent_p2" -l ${L1CACHE} -P 2 | |
294 | getgrent $OPTS -N "getgrent_p4" -l ${L1CACHE} -P 4 | |
295 | ||
296 | # getaddrinfo() host | |
297 | #getaddrinfo_host $OPTS -N "getaddrinfo_host" -r ${HOST_RANGE} -h ${HOST_BASE}%d | |
298 | #getaddrinfo_host $OPTS -N "getaddrinfo_host_t2" -r ${HOST_RANGE} -h ${HOST_BASE}%d -T 2 | |
299 | #getaddrinfo_host $OPTS -N "getaddrinfo_host_t4" -r ${HOST_RANGE} -h ${HOST_BASE}%d -T 4 | |
300 | #getaddrinfo_host $OPTS -N "getaddrinfo_host_p2" -r ${HOST_RANGE} -h ${HOST_BASE}%d -P 2 | |
301 | #getaddrinfo_host $OPTS -N "getaddrinfo_host_p4" -r ${HOST_RANGE} -h ${HOST_BASE}%d -P 4 | |
302 | ||
303 | # getaddrinfo() port | |
304 | getaddrinfo_port $OPTS -N "getaddrinfo_port" -l ${L1CACHE} | |
305 | getaddrinfo_port $OPTS -N "getaddrinfo_port_t2" -l ${L1CACHE} -T 2 | |
306 | getaddrinfo_port $OPTS -N "getaddrinfo_port_t4" -l ${L1CACHE} -T 4 | |
307 | getaddrinfo_port $OPTS -N "getaddrinfo_port_p2" -l ${L1CACHE} -P 2 | |
308 | getaddrinfo_port $OPTS -N "getaddrinfo_port_p4" -l ${L1CACHE} -P 4 | |
309 | ||
310 | # getgrnam() | |
311 | getgrnam $OPTS -N "getgrnam" -l ${L1CACHE} -g ${GROUP_BASE} -r 2 | |
312 | getgrnam $OPTS -N "getgrnam_t2" -l ${L1CACHE} -T 2 -g ${GROUP_BASE} -r 2 | |
313 | getgrnam $OPTS -N "getgrnam_t4" -l ${L1CACHE} -T 4 -g ${GROUP_BASE} -r 2 | |
314 | getgrnam $OPTS -N "getgrnam_p2" -l ${L1CACHE} -P 2 -g ${GROUP_BASE} -r 2 | |
315 | getgrnam $OPTS -N "getgrnam_p4" -l ${L1CACHE} -P 4 -g ${GROUP_BASE} -r 2 | |
316 | ||
317 | # ODQueryCreateWithNode() | |
318 | od_query_create_with_node $OPTS -N "ODQueryCreateWithNode_cache_${NUSERS}u" -c 50 -r ${NUSERS} -t u -B 50 -n ${NODENAME} | |
319 | od_query_create_with_node $OPTS -N "ODQueryCreateWithNode_cache_${NUSERS}u_t2" -T 2 -c 50 -r ${NUSERS} -t u -B 50 -n ${NODENAME} | |
320 | od_query_create_with_node $OPTS -N "ODQueryCreateWithNode_cache_${NUSERS}u_t4" -T 4 -c 50 -r ${NUSERS} -t u -B 50 -n ${NODENAME} | |
321 | od_query_create_with_node $OPTS -N "ODQueryCreateWithNode_cache_${NUSERS}u_p2" -P 2 -c 50 -r ${NUSERS} -t u -B 50 -n ${NODENAME} | |
322 | od_query_create_with_node $OPTS -N "ODQueryCreateWithNode_cache_${NUSERS}u_p4" -P 4 -c 50 -r ${NUSERS} -t u -B 50 -n ${NODENAME} | |
323 | ||
324 | . |