My build of nnn with minor changes
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

38 lignes
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