Changeset 941 for trunk


Ignore:
Timestamp:
08/26/13 12:26:57 (11 years ago)
Author:
sdipsl
Message:

Adapt instrumentation for this kind of syntax:
# IGCM_sys_ncrcat -p ${dir} ${liste_file_tmp} --output ${output}
# IGCM_sys_ncrcat -x -v ${list_var} -p ${dir} ${liste_file_tmp} --output ${output}

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh

    r936 r941  
    106106 
    107107  eval set +A entityListe \${${1}} 
    108   destination=${2}   
     108  destination=${2} 
    109109  sumSizeKo=0 
    110110 
    111111  # Here we will try to compute size (file or directory size) from local path and not from archive. 
    112   for ((i = 0; i < ${#entityListe[*]}; i += 1)) ; do   
    113     if [ -f ${entityListe[$i]##/*/} ] ; then 
    114       # One file or a bunch of files has been copied without renaming 
     112  for ((i = 0; i < ${#entityListe[*]}; i += 1)) ; do 
     113    if [ -f ${entityListe[$i]} ] ; then 
     114      # One file or a bunch of files has been copied without renaming from a visible filesystem 
     115      iEntity=${entityListe[$i]} 
     116    elif [ -f ${entityListe[$i]##/*/} ] ; then 
     117      # One file or a bunch of files has been copied without renaming from an non visible filesystem 
    115118      # remove path /home/login/../ from entityListe elements 
    116119      iEntity=${entityListe[$i]##/*/} 
    117120    elif [ -f ${destination} ] ; then 
    118       # a file has been copied and rename 
     121      # a file has been copied and renamed 
    119122      iEntity=${destination} 
    120123    elif [ -f ${destination}/${entityListe[$i]##/*/} ] ; then 
     
    122125      iEntity=${destination}/${entityListe[$i]##/*/} 
    123126    elif [ -d ${entityListe[$i]} ] ; then 
    124       # directory has been copied from non remote place 
     127      # a directory has been copied from a non remote place 
    125128      iEntity=${entityListe[$i]} 
    126129    elif [ -d ${destination}/${entityListe[$i]##/*/} ] ; then 
    127       # directory has been copied from remote archive and not rename 
     130      # a directory has been copied from a remote archive and not renamed 
    128131      iEntity=${destination}/${entityListe[$i]##/*/} 
    129132    elif [ -d ${destination} ] ; then 
    130       # directory has been copied from remote archive and rename 
     133      # a directory has been copied from a remote archive and renamed 
    131134      iEntity=${destination} 
    132135    fi 
    133     sizeKo=$( du --apparent-size -sk ${iEntity} | awk {'print $1'} ) 
     136    sizeKo=$( du --apparent-size -sk ${iEntity} | gawk '{print $1}' ) 
    134137    sumSizeKo=$(( $sumSizeKo + $sizeKo )) 
    135138  done 
    136139  sumSizeMo=$( echo "scale=6;${sumSizeKo}/1024" | bc ) 
    137140  echo "${sumSizeKo}|${sumSizeMo}" 
    138  
    139141} 
    140142 
     
    264266  if ( $DEBUG_debug ) ; then 
    265267    typeset i decal command arguments startTime_ms endTime_ms 
    266     typeset instrumentation dest 
     268    typeset instrumentation dest prefix 
    267269    # they are not typeset because they are send "by adress" to son functions 
    268270    # we unset them to avoid "memory effect" 
     
    379381      entitySize=$( IGCM_debug_sizeOfTabContent fileList ${dest} ) 
    380382      ;; 
    381      
     383 
    382384    # NCO commands 
    383385    IGCM_sys_ncrcat|IGCM_sys_ncecat|IGCM_sys_ncra|IGCM_sys_ncks|IGCM_sys_cdo) 
     
    388390      # IGCM_sys_ncrcat -x -v ${list_var} -p ${dir} ${liste_file_tmp} --output ${output} 
    389391      instrumentation=true 
    390       # All files that are not the latest argument (only input files) 
     392      keepGoing=true 
     393      prefix=. 
    391394      i=0 
    392       keepGoing=true 
    393395      while ( ${keepGoing} ) ; do 
    394         if [ -f ${arguments[${#arguments[*]}-2-${i}]} ] ; then 
    395           fileList="${fileList} ${arguments[${#arguments[*]}-2-${i}]}" 
     396        # the last one is not interesting 
     397        if [ ${i} -eq ${#arguments[*]}-1 ] ; then 
     398          keepGoing=false 
     399        # look after "-p" option. Path prefix is the following arguments 
     400        elif [ ${arguments[${i}]} = "-p" ] ; then 
    396401          ((i = i + 1)) 
    397         elif [ ${i} -ge 1 ] ; then 
     402          prefix=${arguments[${i}]} 
     403          ((i = i + 1)) 
     404        elif [ ${i} -eq ${#arguments[*]}-1 ] ; then 
    398405          keepGoing=false 
     406        # looking for files 
     407        elif [ -f ${prefix}/${arguments[${i}]} ] ; then 
     408          fileList="${fileList} ${prefix}/${arguments[${i}]}" 
     409          ((i = i + 1)) 
     410        # other options are not interesting 
    399411        else 
    400412          ((i = i + 1)) 
    401413        fi 
    402414      done 
     415 
    403416      # i value is at least 1 
    404417      # just need one file to get the directory 
    405       source=${arguments[${#arguments[*]}-1-${i}]} 
     418      source=$( echo ${fileList} | gawk '{print $1}' ) 
    406419      # Nothing but the latest 
    407420      dest=${arguments[${#arguments[*]}-1]} 
Note: See TracChangeset for help on using the changeset viewer.