Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.60 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. scripts_to_run=/home/cst334/HW6/
  4. WAITING=0
  5. AVG_WAIT=0
  6. COUNTER=0
  7. echo 'Before:'
  8. for Job in "$scripts_to_run"*
  9. do
  10.         if [[ -x "$Job" ]]; then
  11.                 STARTTIME=$(date +%s)
  12.                 "$Job"
  13.                 ENDTIME=$(date +%s)
  14.                 BURST=$(($ENDTIME - $STARTTIME))
  15.                 echo "Burst Time: $BURST seconds... Waiting time: $WAITING"
  16.                 AVG_WAIT=$((AVG_WAIT + $WAITING))
  17.                 WAITING=$(($WAITING + $BURST))
  18.                 COUNTER=$(($COUNTER + 1))
  19.         fi
  20. done
  21. echo "Average Waiting is: $(($AVG_WAIT / $COUNTER))"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement