Locks 798 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/rc
  2. rfork e
  3. cmd=$1
  4. echo '#' $1
  5. echo measuring $1... >'#c/cons'
  6. rm -f /tmp/bench.time
  7. rc -c $cmd >'#c/cons' # warm cache and be able to see the output of the cmd...
  8. #
  9. # collect stats. A single run this time.
  10. #
  11. echo >/dev/sysstat
  12. bind -a '#W' /dev
  13. echo start >/dev/wsctl
  14. time rc -c $cmd >/dev/null >>[2]/tmp/bench.time
  15. echo stop >/dev/wsctl
  16. cp /dev/wsdata /tmp/wsdata
  17. cp /dev/sysstat /tmp/sysstat
  18. tail -1 /tmp/bench.time
  19. tail -1 /tmp/bench.time >'#c/cons'
  20. sed 's/[sur]//g' </tmp/bench.time |
  21. awk 'BEGIN{u=0.0; s=0.0; t=0.0}
  22. {u += $1; s += $2; t += $3}
  23. END{printf("times %g %g %g\n", u/NR, s/NR, t/NR);}'
  24. awk '{printf("%s\t", $0); system("src -n -s " $2 " /amd64/9k8cpu")}' </tmp/wsdata
  25. rm -f /tmp/bench.time /tmp/wsdata
  26. cat /dev/debug
  27. echo #/dev/sysstat for 10 runs
  28. cat /tmp/sysstat
  29. exit ''