本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
552B

  1. #! /bin/bash
  2. bench() {
  3. filename="/tmp/$1-$2.bench"
  4. if test -e "${filename}";
  5. then
  6. echo "Already exists ${filename}"
  7. else
  8. backup=`git rev-parse --abbrev-ref HEAD`
  9. git checkout $1
  10. echo -n "Creating ${filename}... "
  11. go test ./... -run=NONE -bench=$2 > "${filename}" -benchmem
  12. echo "OK"
  13. git checkout ${backup}
  14. sleep 5
  15. fi
  16. }
  17. to=$1
  18. current=`git rev-parse --abbrev-ref HEAD`
  19. bench ${to} $2
  20. bench ${current} $2
  21. benchcmp $3 "/tmp/${to}-$2.bench" "/tmp/${current}-$2.bench"
上海开阖软件有限公司 沪ICP备12045867号-1