time_all_stats_pred.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. DIR=/scratch/mikem/UserSupport/weizhe.li/runs_process_cn_False/normal_wnorm_448_400_7691563
  2. PREFIX=normal
  3. SUBDIRS=`ls -1 $DIR | grep $PREFIX`
  4. STAT_FILE="$PREFIX"_timing_all.txt
  5. rm -f $STAT_FILE
  6. ALL_GROUPS="$PREFIX"_all_groups.txt
  7. rm -f $ALL_GROUPS
  8. DP=details
  9. rm -rf $DP
  10. mkdir -p $DP
  11. for SD in $SUBDIRS
  12. do
  13. echo "Processing $SD subdirectory..."
  14. echo $SD
  15. PREFIX1=$SD
  16. find "$DIR"/"$SD"/sysout -name "$PREFIX1"* | xargs grep -e user -e sys > "$DP"/"$SD"_timing.txt
  17. awk '{ print $2 }' "$DP"/"$SD"_timing.txt > "$DP"/"$SD"_timing_2nd.txt
  18. sed 's/m/ /g; s/s//g' "$DP"/"$SD"_timing_2nd.txt > "$DP"/"$SD"_timing_2nd_no_ms.txt
  19. awk -v sd="$SD" '{mult+=$1*60+$2;} END {printf ("%.18f %s\n", mult, sd);}' "$DP"/"$SD"_timing_2nd_no_ms.txt >> $STAT_FILE
  20. awk '{ printf ("%.18f\n", $1 * 60 + $2) }' "$DP"/"$SD"_timing_2nd_no_ms.txt > "$DP"/"$SD"_timing_secs.txt
  21. awk 'NR%2 { split($0, a) ; next } { for (i=1; i<=NF; i++) printf (" %.18f", a[i]+$i) ; print "" }' "$DP"/"$SD"_timing_secs.txt >> $ALL_GROUPS
  22. done
  23. sort -k1 -n $STAT_FILE > "$STAT_FILE"_sorted.txt
  24. awk '{sum+=$1;} END {printf ("%.18f", sum);}' "$STAT_FILE"_sorted.txt > "$STAT_FILE"_total_seconds.txt
  25. sort -k1 -n $ALL_GROUPS > "$ALL_GROUPS"_sorted