emacs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/bash
  2. if [ $# -ne 2 ]; then
  3. cat<<EOF
  4. Usage: $0 <module> <output file>
  5. Runs various benchmarks for the Agda file <module>.
  6. EOF
  7. exit 1
  8. else
  9. MODULE="$1"
  10. OUTPUT="$2"
  11. fi
  12. printf "Benchmarks for $MODULE\n\n" > "$OUTPUT"
  13. printf "Configuration:\n" >> "$OUTPUT"
  14. if [[ `uname` == 'Darwin' ]]; then
  15. uname -ms >> "$OUTPUT"
  16. else
  17. uname -io >> "$OUTPUT"
  18. fi
  19. agda --version >> "$OUTPUT"
  20. ghc --version >> "$OUTPUT"
  21. emacs --version | head -1 >> "$OUTPUT"
  22. printf "Byte-compiled files:\n" >> "$OUTPUT"
  23. ELDIR=$(dirname `agda-mode locate`)
  24. for FILE in "$ELDIR"/*.el; do
  25. ELCFILE=$(basename "$FILE" .el).elc
  26. if [ -r "$ELDIR"/"$ELCFILE" ]; then
  27. printf " %s\n" "$ELCFILE" >> "$OUTPUT"
  28. fi
  29. done
  30. printf "\n" >> "$OUTPUT"
  31. printf "Batch-mode:\n" >> "$OUTPUT"
  32. rm -f "$MODULE"i
  33. 'time' -p agda -v0 "$MODULE" 2>>"$OUTPUT"
  34. for MODE in None NonInteractive Interactive; do
  35. printf "\nHaskell only, %s:\n" $MODE >> "$OUTPUT"
  36. rm -f "$MODULE"i
  37. printf '\nioTCM "%s" %s (cmd_load "%s" [])\n' "$MODULE" $MODE "$MODULE" | \
  38. time -p agda --ghci-interaction > /dev/null 2>>"$OUTPUT"
  39. done
  40. # for MODE in none non-interactive interactive; do
  41. # printf "\nIn Emacs, %s: " $MODE >> "$OUTPUT"
  42. # emacs -Q \
  43. # --eval "(load-file (let ((coding-system-for-read 'utf-8))
  44. # (shell-command-to-string \"agda-mode locate\")))" \
  45. # "$MODULE" \
  46. # --eval "(progn
  47. # (defun test nil
  48. # (agda2-measure-load-time '$MODE nil
  49. # (lambda (time)
  50. # (with-temp-buffer
  51. # (insert time)
  52. # (append-to-file (point-min) (point-max) \"$OUTPUT\"))
  53. # (kill-emacs))))
  54. # (run-with-idle-timer 1 nil 'test))" \
  55. # 2>/dev/null
  56. # printf "\n" >> "$OUTPUT"
  57. # done