- Improve statistics.

This commit is contained in:
agibert 2009-04-06 00:06:45 +00:00
parent 13d62a6230
commit 6774f165e9

85
nds2rm
View File

@ -5,9 +5,9 @@
# (C) 2009 Arnaud G. Gibert # (C) 2009 Arnaud G. Gibert
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
# $RCSfile: nds2rm,v $ # $RCSfile: nds2rm,v $
# $Revision: 1.11 $ # $Revision: 1.12 $
# $Name: $ # $Name: $
# $Date: 2009/04/03 21:32:14 $ # $Date: 2009/04/06 00:06:45 $
# $Author: agibert $ # $Author: agibert $
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
@ -1103,7 +1103,9 @@ function suffix_mng()
IFS=' ' IFS=' '
found_cnt=0 found_cnt=0
ok_cnt=0 ok_cnt=0
ok_dup_cnt=0
ko_cnt=0 ko_cnt=0
ko_dup_cnt=0
dup_cnt=0 dup_cnt=0
ignored_cnt=0 ignored_cnt=0
@ -1141,10 +1143,8 @@ function suffix_mng()
dat_fp[${idx}]="${fp}" dat_fp[${idx}]="${fp}"
dat_status[${idx}]="${status}" dat_status[${idx}]="${status}"
if [[ "${status}" == "OK" ]] if [[ "${status}" == "KO" ]]
then then
ok_cnt=$((${ok_cnt} + 1))
else
ko_cnt=$((${ko_cnt} + 1)) ko_cnt=$((${ko_cnt} + 1))
fi fi
else else
@ -1152,6 +1152,13 @@ function suffix_mng()
file_name="${file/) \[*/}) [${status}] {${crc}} <${fp}>-${dup_id}.${CSFX}" file_name="${file/) \[*/}) [${status}] {${crc}} <${fp}>-${dup_id}.${CSFX}"
dup_cnt=$((${dup_cnt} + 1)) dup_cnt=$((${dup_cnt} + 1))
if [[ "${status}" == "OK" ]]
then
ok_dup_cnt=$((${ok_dup_cnt} + 1))
else
ko_dup_cnt=$((${ko_dup_cnt} + 1))
fi
fi fi
print_verbose "moving ${file} to ${file_name}" print_verbose "moving ${file} to ${file_name}"
@ -1236,10 +1243,16 @@ function stats_proceed()
cs_ko_cnt=0 cs_ko_cnt=0
ks_ok_cnt=0 ks_ok_cnt=0
ks_ko_cnt=0 ks_ko_cnt=0
renum_cnt=0
ko_not_ok_cnt=0
ok_total_count=0
ko_total_count=0
proceeded_cnt=0 proceeded_cnt=0
missing_cnt=0 missing_cnt=0
# Summarize stats files
while read file while read file
do do
set ${file} set ${file}
@ -1256,17 +1269,32 @@ function stats_proceed()
found_cnt=$((${ok_cnt} + ${ko_cnt} + ${dup_cnt} + ${ignored_cnt})) found_cnt=$((${ok_cnt} + ${ko_cnt} + ${dup_cnt} + ${ignored_cnt}))
proceeded_cnt=$((${found_cnt} - ${ignored_cnt})) proceeded_cnt=$((${found_cnt} - ${ignored_cnt}))
# Compute ok ko_nok and missing count
i=1 i=1
while [[ ${i} -le ${loaded_cnt} ]] while [[ ${i} -le ${loaded_cnt} ]]
do do
if [[ ${dat_status[${i}]} == "?" ]] case ${dat_status[${i}]}
then in
("OK")
ok_cnt=$((${ok_cnt} + 1))
;;
("KO")
ko_nok_cnt=$((${ko_nok_cnt} + 1))
;;
("?")
missing_cnt=$((${missing_cnt} + 1)) missing_cnt=$((${missing_cnt} + 1))
fi ;;
esac
i=$(( ${i} + 1 )) i=$(( ${i} + 1 ))
done done
ok_total_cnt=$((${ok_cnt} + ${ok_dup_cnt}))
ko_total_cnt=$((${ko_cnt} + ${ko_dup_cnt}))
} }
@ -1278,24 +1306,40 @@ function stats_proceed()
function stats_print() function stats_print()
{ {
echo " " 1>&2 echo "run statistics:" 1>&2
echo 1>&2
printf "%4d roms set to OK\n" ${ss_ok_cnt} 1>&2 printf "%4d roms set to OK\n" ${ss_ok_cnt} 1>&2
printf "%4d roms changed to OK\n" ${cs_ok_cnt} 1>&2 printf "%4d roms changed to OK\n" ${cs_ok_cnt} 1>&2
printf "%4d roms kept to OK\n" ${ks_ok_cnt} 1>&2 printf "%4d roms kept to OK\n" ${ks_ok_cnt} 1>&2
printf "%4d roms are OK\n" ${ok_cnt} 1>&2
echo echo 1>&2
printf "%4d roms set to KO\n" ${ss_ko_cnt} 1>&2 printf "%4d roms set to KO\n" ${ss_ko_cnt} 1>&2
printf "%4d roms changed to KO\n" ${cs_ko_cnt} 1>&2 printf "%4d roms changed to KO\n" ${cs_ko_cnt} 1>&2
printf "%4d roms kept to KO\n" ${ks_ko_cnt} 1>&2 printf "%4d roms kept to KO\n" ${ks_ko_cnt} 1>&2
printf "%4d roms are KO\n" ${ko_cnt} 1>&2
echo echo 1>&2
printf "%4d roms are renumbered\n" ${renum_cnt} 1>&2
echo 1>&2
echo "global statistics:" 1>&2
printf "%4d roms are in dsrom.dat\n" ${loaded_cnt} 1>&2 printf "%4d roms are in dsrom.dat\n" ${loaded_cnt} 1>&2
printf "%4d roms are found\n" ${found_cnt} 1>&2 printf "%4d roms are found\n" ${found_cnt} 1>&2
printf "%4d roms are ignored\n" ${ignored_cnt} 1>&2 printf "%4d roms are ignored\n" ${ignored_cnt} 1>&2
printf "%4d roms are proceeded\n" ${proceeded_cnt} 1>&2 printf "%4d roms are proceeded\n" ${proceeded_cnt} 1>&2
printf "%4d roms are renumbered\n" ${renum_cnt} 1>&2
printf "%4d roms are duplicated\n" ${dup_cnt} 1>&2 printf "%4d roms are duplicated\n" ${dup_cnt} 1>&2
echo 1>&2
printf "%4d total roms are OK\n" ${ok_total_cnt} 1>&2
printf "%4d roms are dup OK\n" ${ok_dup_cnt} 1>&2
printf "%4d roms are OK\n" ${ok_cnt} 1>&2
echo 1>&2
printf "%4d total roms are KO\n" ${ko_total_cnt} 1>&2
printf "%4d roms are dup KO\n" ${ko_dup_cnt} 1>&2
printf "%4d roms are KO\n" ${ko_cnt} 1>&2
printf "%4d roms are KO not OK\n" ${ko_nok_cnt} 1>&2
echo 1>&2
printf "%4d roms are missing\n" ${missing_cnt} 1>&2 printf "%4d roms are missing\n" ${missing_cnt} 1>&2
} }
@ -1382,6 +1426,7 @@ function test_correct_mode()
# Suffix Management # Suffix Management
suffix_mng suffix_mng
echo " " 1>&2
# Dump ROMs List # Dump ROMs List
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
@ -1421,11 +1466,11 @@ cd ${TMP_DIR}
# Initialise stats variables # Initialise stats variables
ok_cnt=0 # ok_cnt=0
ko_cnt=0 # ko_cnt=0
found_cnt=0 # found_cnt=0
missing_cnt=0 #missing_cnt=0
renum_cnt=0 # renum_cnt=0