Changeset 10866


Ignore:
Timestamp:
2019-04-12T16:10:59+02:00 (20 months ago)
Author:
nicolasmartin
Message:

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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/releases/basic_stats.sh

    r10864 r10866  
    11#!/bin/sh 
    22 
    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 
    47 
    5 printf "%40s %7s %7s(ratio) %7s\n\n" '' code comm total 
     8printf "%40s %7s(ratio) %7s(ratio) %7s(ratio) %7s\n\n" '' code notes blank sum 
    69 
    710for release_srcs in "release-3.4/NEMOGCM/NEMO/*" "release-3.6/NEMOGCM/NEMO/*" "release-4.0/src/*"; do 
    811 
    9     total_code=0; total_comm=0; total_line=0 
     12    sum_loc=0; sum_lon=0; sum_lob=0; sum_ful=0 
    1013 
    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 )) 
    2027    done 
    2128 
    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} 
    2434 
    2535done 
Note: See TracChangeset for help on using the changeset viewer.