blob: c4dde8a2bfe95ee2ab4b38e87daba3e5d15d9ff2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/bin/sh
# Build and time the probes in this directory: fork() cost (fk3.c) and
# the cost of one start (tiny.c at each width, and on z/OS the HLASM pair
# that has no C runtime at all). The numbers behind bench/README.md.
#
# sh bench/probes/run.sh
#
# N sets the iterations (default 100). TUNE adds flags to every C build,
# e.g. TUNE='-march=z15 -mtune=z15'. CC builds the C probes.
set -u
here=$(cd "$(dirname "$0")" && pwd)
cc=${CC:-ibm-clang}
extra=${TUNE:-}
n=${N:-100}
work=${TMPDIR:-$HOME/tmp}/zash-probes.$$
mkdir -p "$work" && cd "$work" || exit 1
trap 'cd /; rm -rf "$work"' EXIT
echo "== fork() cost, CPU of parent and child"
for m in 32 64; do
if ! $cc -O2 -m$m $extra -o "fk$m" "$here/fk3.c"; then
echo "fk$m: -m$m build failed, skipped"
continue
fi
for mb in 0 8 64; do ./"fk$m" "$mb" "$n"; done
done
echo "== start-up cost, $n starts of a program that does nothing"
for m in 32 64; do
$cc -O2 -m$m $extra -o "t$m" "$here/tiny.c" || {
echo "t$m: -m$m build failed, skipped"; continue; }
done
for m in 32 64; do
[ -x "t$m" ] || continue
printf 't%s' "$m"
time sh -c "i=0; while [ \$i -lt $n ]; do ./t$m; i=\$((i+1)); done"
done
# HLASM: no LE, no XPLINK, no C library, so the address space is measured
# on its own. Only z/OS has an assembler that reads this source.
if [ "$(uname -s)" = OS/390 ]; then
echo "== start-up cost with no C runtime (HLASM)"
for w in 31 64; do
as -o "tiny$w.o" "$here/tiny$w.s" && ld -o "tiny$w" "tiny$w.o" || {
echo "tiny$w: assemble failed, skipped"; continue; }
printf 'tiny%s ' "$w"
time sh -c "i=0; while [ \$i -lt $n ]; do ./tiny$w; i=\$((i+1)); done"
done
fi
|