My build of nnn with minor changes
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

38 行
667 B

  1. #!/bin/sh
  2. #
  3. # Usage: ./misc/test/benchmark.sh ./nnn /tmp/testdir1 ./testdir2 ...
  4. #
  5. # Don't forget to build nnn in benchmark mode: make O_BENCH=1
  6. # Use a test dir filled with genfiles.sh to get interesting output
  7. # (or maybe /usr/lib/)
  8. LANG=C
  9. TIME_VAL=${TIME_VAL:-"real"}
  10. SAMPLES=${SAMPLES:-100}
  11. EXE=$1
  12. bench_val () {
  13. (time "$1" "$2") 2>&1 |\
  14. awk '$1=="'"$TIME_VAL"'"{match($2, /[0-9]*\.[0-9]*/) ; print substr($2, RSTART, RLENGTH)}'
  15. }
  16. bench_dir () {
  17. i=$SAMPLES
  18. printf "$2"
  19. while [ $((i--)) -gt 0 ] ; do
  20. printf "\t%s" "$(bench_val "$1" "$2")"
  21. done
  22. printf "\n"
  23. }
  24. shift
  25. for dir in "$@" ; do
  26. bench_dir "$EXE" "$dir"
  27. done