source: NEMO/releases/basic_stats.sh @ 11517

Last change on this file since 11517 was 10866, checked in by nicolasmartin, 2 years ago

Fix on regexp for counters and few improvments
Thanks again Simon for your attentiveness!

                                            code(ratio)   notes(ratio)   blank(ratio)     sum
release-3.4/NEMOGCM/NEMO/LIM_SRC_2          4399(62,0%)    1975(27,8%)     715(10,0%)    7089
release-3.4/NEMOGCM/NEMO/LIM_SRC_3          9045(61,7%)    4019(27,4%)    1587(10,8%)   14651
release-3.4/NEMOGCM/NEMO/NST_SRC            1675(67,9%)     358(14,5%)     432(17,5%)    2465
release-3.4/NEMOGCM/NEMO/OFF_SRC            1371(63,8%)     588(27,3%)     188( 8,7%)    2147
release-3.4/NEMOGCM/NEMO/OPA_SRC           64967(61,4%)   29926(28,3%)   10850(10,2%)  105743
release-3.4/NEMOGCM/NEMO/OPATAM_SRC        24646(60,9%)   12706(31,4%)    3108( 7,6%)   40460
release-3.4/NEMOGCM/NEMO/TOP_SRC           13939(61,6%)    5932(26,2%)    2728(12,0%)   22599
                                     sum  120042(61,5%)   55504(28,4%)   19608(10,0%)  195154
release-3.6/NEMOGCM/NEMO/LIM_SRC_2          4530(62,4%)    1991(27,4%)     733(10,1%)    7254
release-3.6/NEMOGCM/NEMO/LIM_SRC_3          7390(59,3%)    3631(29,1%)    1423(11,4%)   12444
release-3.6/NEMOGCM/NEMO/NST_SRC            3345(67,5%)    1091(22,0%)     518(10,4%)    4954
release-3.6/NEMOGCM/NEMO/OFF_SRC            1441(64,3%)     593(26,4%)     204( 9,1%)    2238
release-3.6/NEMOGCM/NEMO/OOO_SRC            3476(70,9%)     945(19,2%)     476( 9,7%)    4897
release-3.6/NEMOGCM/NEMO/OPA_SRC           78997(63,3%)   33269(26,6%)   12340( 9,9%)  124606
release-3.6/NEMOGCM/NEMO/SAS_SRC            1187(57,9%)     659(32,1%)     204( 9,9%)    2050
release-3.6/NEMOGCM/NEMO/TOP_SRC           15319(61,1%)    6823(27,2%)    2903(11,5%)   25045
                                     sum  115685(63,0%)   49002(26,7%)   18801(10,2%)  183488
release-4.0/src/ICE                         8638(58,8%)    4951(33,7%)    1094( 7,4%)   14683
release-4.0/src/NST                         4165(67,7%)    1537(25,0%)     446( 7,2%)    6148
release-4.0/src/OCE                        66946(63,9%)   29102(27,8%)    8593( 8,2%)  104641
release-4.0/src/OFF                          882(64,5%)     399(29,2%)      85( 6,2%)    1366
release-4.0/src/SAO                         2002(72,7%)     464(16,8%)     286(10,3%)    2752
release-4.0/src/SAS                         1186(60,8%)     606(31,0%)     157( 8,0%)    1949
release-4.0/src/TOP                        17069(62,3%)    7690(28,1%)    2596( 9,4%)   27355
                                     sum  100888(63,4%)   44749(28,1%)   13257( 8,3%)  158894
  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#!/bin/sh
2
3## Basic statistics for NEMO sources per release (code / comments / blank lines)
4## loc: lines of code
5## lon:   "   "" notes
6## lob:   "   "" blank
7
8printf "%40s %7s(ratio) %7s(ratio) %7s(ratio) %7s\n\n" '' code notes blank sum
9
10for release_srcs in "release-3.4/NEMOGCM/NEMO/*" "release-3.6/NEMOGCM/NEMO/*" "release-4.0/src/*"; do
11
12    sum_loc=0; sum_lon=0; sum_lob=0; sum_ful=0
13
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 ))
27    done
28
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}
34
35done
36
37exit 0
Note: See TracBrowser for help on using the repository browser.