Advertisement
Guest User

Untitled

a guest
Oct 19th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #!/bin/bash
  2. PACKET_SIZE=1000
  3. SIM_TIME=10.5
  4. BANDWITH=1048576
  5.  
  6. for i in {1..20}
  7. do
  8. a=$(cat csmacd$i.tr | grep "^r" -c)
  9. tp=$(bc <<< "scale = 5; (($a * $PACKET_SIZE) / $SIM_TIME)")
  10. eff=$(bc <<< "scale = 5; (($tp * 8) / $BANDWITH)")
  11. perd=$(cat csmacd$i.tr | grep "^d" -c)
  12. echo "Simulación $i" >> trcompute_output.txt
  13. echo "Eficiencia: $(bc <<< "scale = 5; ($eff * 100)")%" >> trcompute_output.txt
  14. echo "Throughput: $tp bytes/s" >> trcompute_output.txt
  15. echo "Perdidas: $perd paquetes" >> trcompute_output.txt
  16. echo "--------------------------" >> trcompute_output.txt
  17. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement