Commit b6a830d8 authored by Kirill Smelkov's avatar Kirill Smelkov

X switch cpu benchmarks to go format

parent 94d79c29
...@@ -727,7 +727,8 @@ nrunpar() { ...@@ -727,7 +727,8 @@ nrunpar() {
# bench_cpu - microbenchmark CPU # bench_cpu - microbenchmark CPU
bench_cpu() { bench_cpu() {
nrun sh -c "python -m test.pystone |tail -1" nrun sh -c "python -m test.pystone |tail -1 |sed -e \
\"s|^This machine benchmarks at \([0-9]\+\) pystones/second$|Benchmarkpystone/`hostname` 1 \1 pystone/s|\""
nrun ./tsha1.py 1024 nrun ./tsha1.py 1024
nrun ./tsha1_go 1024 nrun ./tsha1_go 1024
......
...@@ -62,5 +62,10 @@ func main() { ...@@ -62,5 +62,10 @@ func main() {
tend := time.Now() tend := time.Now()
δt := tend.Sub(tstart) δt := tend.Sub(tstart)
fmt.Printf("sha1(%dB) ~= %s x=tsha1.go\n", blksize, δt / time.Duration(n)) hostname, err := os.Hostname()
if err != nil {
hostname = "?"
}
fmt.Printf("Benchmarksha1/%s/go/%dB %d\t%.3f µs/op\n", hostname, blksize, n, float64(δt) / float64(n) / float64(time.Microsecond))
} }
...@@ -25,6 +25,7 @@ from __future__ import print_function ...@@ -25,6 +25,7 @@ from __future__ import print_function
import sys import sys
import hashlib import hashlib
from time import time from time import time
import socket
def main(): def main():
blksize = int(sys.argv[1]) blksize = int(sys.argv[1])
...@@ -45,7 +46,9 @@ def main(): ...@@ -45,7 +46,9 @@ def main():
tend = time() tend = time()
dt = tend - tstart dt = tend - tstart
print('sha1(%dB) ~= %.1fμs x=tsha1.py' % (blksize, dt * 1E6 / n)) # hostname generally != fqdn[0] XXX clarify/refine
hostname = socket.getfqdn().split('.')[0]
print('Benchmarksha1/%s/py/%dB %d\t%.3f µs/op' % (hostname, blksize, n, dt * 1E6 / n))
if __name__ == '__main__': if __name__ == '__main__':
main() main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment