Advertisement
CSenshi

OS - FUSE (files measure time)

Jul 12th, 2019
527
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.39 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # to run please change mode
  4. # chmod +x check_dir.bash
  5.  
  6. if [ "$#" -ne 1 ]; then
  7.     echo "Illegal number of parameters"
  8.     echo 'Call : ./check_dir.sh mounted_dir'
  9.     exit 1
  10. fi
  11.  
  12. MOUNT_DIR=$1
  13. cd $MOUNT_DIR
  14.  
  15.  
  16. BB='1'
  17.  
  18. for b in $(seq 1 1024);
  19. do
  20.     KB=$KB$BB
  21. done;
  22.  
  23. MB=''
  24. for b in $(seq 1 1024);
  25. do
  26.     MB=$MB$KB
  27. done;
  28.  
  29. write_KB(){
  30.     echo "Test 1 : Writing 1 KB Data"
  31.    
  32.     START=$(date +%s.%N)
  33.     echo $KB > "KB_Test.txt"
  34.     END=$(date +%s.%N)
  35.    
  36.     DIFF=$(echo "$END - $START" | bc)
  37.     echo "Elapsed time : $DIFF seconds"
  38.     echo $mytime
  39. }
  40.  
  41. write_MB(){
  42.     echo "Test 2 : Writing 1 MB Data"
  43.    
  44.     START=$(date +%s.%N)
  45.     echo $MB > "MB_Test.txt"
  46.     END=$(date +%s.%N)
  47.    
  48.     DIFF=$(echo "$END - $START" | bc)
  49.     echo "Elapsed time : $DIFF seconds"
  50.     echo $mytime
  51. }
  52.  
  53.  
  54. write_GB(){
  55.     echo "Test 3 : Writing 1 GB Data"
  56.    
  57.     START=$(date +%s.%N)
  58.     for i in $(seq 1 1024);
  59.     do
  60.         if ! ((i % 10)); then
  61.             END=$(date +%s.%N)
  62.             DIFF=$(echo "$END - $START" | bc)
  63.             echo "$i MB.  Elasped time : $DIFF seconds"
  64.         fi
  65.         echo $MB >> "GB_test.txt"
  66.     done;
  67.     END=$(date +%s.%N)
  68.    
  69.     DIFF=$(echo "$END - $START" | bc)
  70.     echo "Elapsed time : $DIFF seconds"
  71.     echo $mytime
  72. }
  73.  
  74. # writes 1 KB data
  75. write_KB
  76.  
  77. # writes 1 MB data
  78. write_MB
  79.  
  80. # writes 1 GB data
  81. write_GB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement