Changeset 10866 for NEMO/releases/basic_stats.sh
- Timestamp:
- 2019-04-12T16:10:59+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/releases/basic_stats.sh
r10864 r10866 1 1 #!/bin/sh 2 2 3 ## Basic statitics on code / comments lines in NEMO sources per release 3 ## Basic statistics for NEMO sources per release (code / comments / blank lines) 4 ## loc: lines of code 5 ## lon: " "" notes 6 ## lob: " "" blank 4 7 5 printf "%40s %7s %7s(ratio) %7s\n\n" '' code comm total8 printf "%40s %7s(ratio) %7s(ratio) %7s(ratio) %7s\n\n" '' code notes blank sum 6 9 7 10 for release_srcs in "release-3.4/NEMOGCM/NEMO/*" "release-3.6/NEMOGCM/NEMO/*" "release-4.0/src/*"; do 8 11 9 total_code=0; total_comm=0; total_line=012 sum_loc=0; sum_lon=0; sum_lob=0; sum_ful=0 10 13 11 for dir in $release_srcs; do 12 printf "%-40s " $dir 13 nb_code_lines=$( find $dir -name *.[fFh]90 -exec grep '^ *[^!]' {} \; | wc -l ) 14 nb_comm_lines=$( find $dir -name *.[fFh]90 -exec grep '^ *!' {} \; | wc -l ) 15 ratio=$( echo "scale = 3; ( $nb_comm_lines / ( $nb_code_lines + $nb_comm_lines ) ) * 100 " | bc | tr . , ) 16 printf "%7d %7d(%4.1f%%) %7d\n" $nb_code_lines $nb_comm_lines $ratio $(( nb_code_lines + nb_comm_lines )) 17 total_code=$(( total_code + nb_code_lines )) 18 total_comm=$(( total_comm + nb_comm_lines )) 19 total_line=$(( total_line + nb_code_lines + nb_comm_lines )) 14 for dir in ${release_srcs}; do 15 nb_loc=$( find $dir -name *.[fFh]90 -exec grep '^ *[^! ]' {} \; | wc -l ) 16 nb_lon=$( find $dir -name *.[fFh]90 -exec grep '^ *!' {} \; | wc -l ) 17 nb_lob=$( find $dir -name *.[fFh]90 -exec grep '^ *$' {} \; | wc -l ) 18 ratio_c=$( echo "scale = 3; ( ${nb_loc} / ( ${nb_loc} + ${nb_lon} + ${nb_lob} ) ) * 100" | bc | tr . , ) 19 ratio_n=$( echo "scale = 3; ( ${nb_lon} / ( ${nb_loc} + ${nb_lon} + ${nb_lob} ) ) * 100" | bc | tr . , ) 20 ratio_b=$( echo "scale = 3; ( ${nb_lob} / ( ${nb_loc} + ${nb_lon} + ${nb_lob} ) ) * 100" | bc | tr . , ) 21 printf "%-40s %7d(%4.1f%%) %7d(%4.1f%%) %7d(%4.1f%%) %7d\n" \ 22 $dir ${nb_loc} ${ratio_c} ${nb_lon} ${ratio_n} ${nb_lob} ${ratio_b} $(( nb_loc + nb_lon + nb_lob )) 23 sum_loc=$(( sum_loc + nb_loc )) 24 sum_lon=$(( sum_lon + nb_lon )) 25 sum_lob=$(( sum_lob + nb_lob )) 26 sum_ful=$(( sum_ful + nb_loc + nb_lon + nb_lob )) 20 27 done 21 28 22 ratio=$( echo "scale = 3; ( $total_comm / $total_line ) * 100 " | bc | tr . , ) 23 printf "%40s %7d %7d(%4.1f%%) %7d\n\n" total $total_code $total_comm $ratio $total_line 29 ratio_c=$( echo "scale = 3; ( ${sum_loc} / ${sum_ful} ) * 100" | bc | tr . , ) 30 ratio_n=$( echo "scale = 3; ( ${sum_lon} / ${sum_ful} ) * 100" | bc | tr . , ) 31 ratio_b=$( echo "scale = 3; ( ${sum_lob} / ${sum_ful} ) * 100" | bc | tr . , ) 32 printf "%40s %7d(%4.1f%%) %7d(%4.1f%%) %7d(%4.1f%%) %7d\n\n" \ 33 sum ${sum_loc} ${ratio_c} ${sum_lon} ${ratio_n} ${sum_lob} ${ratio_b} ${sum_ful} 24 34 25 35 done
Note: See TracChangeset
for help on using the changeset viewer.