Index: /trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh	(revision 912)
+++ /trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh	(revision 913)
@@ -1,3 +1,3 @@
-#!/bin/ksh 
+#!/bin/ksh
 
 #**************************************************************
@@ -14,5 +14,5 @@
 #==================================================
 # The documentation of this file can be automatically generated
-# if you use the prefix #D- for comments to be extracted. 
+# if you use the prefix #D- for comments to be extracted.
 # Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
 #==================================================
@@ -46,10 +46,10 @@
 # NULL_STR
 # Default null string
-typeset -r NULL_STR="_0_" 
+typeset -r NULL_STR="_0_"
 
 #==================================================
 # libIGCM_CurrentTag
 # Current libIGCM tag, check compatibilty with *.card
-typeset -r libIGCM_CurrentTag="1.0" 
+typeset -r libIGCM_CurrentTag="2.0"
 
 #==================================================
@@ -60,22 +60,94 @@
 #==================================================
 # Declare a stack of functions calls
-
-# insert last argument of the Stack
-#set -A IGCM_debug_Stack ${NULL_STR}
-#set -A IGCM_debug_StackArgs ${NULL_STR}
 unset IGCM_debug_Stack
 unset IGCM_debug_StackArgs
+unset IGCM_debug_StackTiming
 IGCM_debug_Stack[0]=${NULL_STR}
 IGCM_debug_StackArgs[0]=${NULL_STR}
+IGCM_debug_StackTiming[0]=${NULL_STR}
 IGCM_debug_LenStack=0
 
 #D-#==================================================================
+#D-function IGCM_debug_getDate_ms
+#D- * Purpose: Give number of milliseconds since 01-jan-1970
+function IGCM_debug_getDate_ms
+{
+  typeset nanosecs testnum
+  # nano secondes since 01-jan-1970
+  nanosecs=$( date +%s%N )
+
+  # truncate the last 6 digits to get milliseconds since 01-jan-1970
+  ms=${nanosecs:0:${#nanosecs}-6}
+
+  echo "$ms"
+}
+
+#D-#==================================================================
+#D-function IGCM_debug_sizeOfTabContent
+#D- * Purpose: Give sumed size of a list of files
+function IGCM_debug_sizeOfTabContent
+{
+  typeset dm_liste sizeFile sizeKo sizeMo
+  eval set +A dm_liste \${${1}}
+  sizeKo=0
+  for ((i = 0; i < ${#dm_liste[*]}; i += 1)) ; do
+    # echo "dm_liste[$i]=${dm_liste[$i]}"
+    # remove path /home/login/../ from dm_liste elements
+    sizeFile=$( du --apparent-size -k ${dm_liste[$i]##/*/} )
+    sizeKo=$(( $sizeKo + $sizeFile ))
+  done
+  sizeMo=$( echo "scale=6;${sizeKo}/1024" | bc )
+  echo "${sizeKo}|${sizeMo}"
+}
+
+#D-#==================================================================
+#D-function IGCM_debug_SendAMQP
+#D- * Purpose: Send body; encoded body and config.card to rabbitMQ
+function IGCM_debug_sendAMQP
+{
+  typeset decal first additionnalOption encodedBody
+
+  # Encode message Body
+  encodedBody=$( echo "${Body}" | base64 -w 0 )
+
+  # Send config.card ?
+  if [ X${1} = Xactivate ] ; then
+    # Encode config.card
+    cat ${SUBMIT_DIR}/config.card | base64 -w 0 > ${SUBMIT_DIR}/config.card.base64
+    # Prepare additionnal option
+    additionnalOption="-f ${SUBMIT_DIR}/config.card.base64"
+  else
+    additionnalOption=
+  fi
+
+  # Only cosmetics : stack file
+  decal=0
+  while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
+    printf ' ' >> ${StackFileLocation}/stack
+    (( decal = decal + 1 ))
+  done
+  # Log to stack file
+  echo sendAMQPMsg -h localhost -p 5672 ${additionnalOption} -b "${Body}"      >> ${StackFileLocation}/stack
+
+  # Log separately AMQP send message command
+  echo sendAMQPMsg -h localhost -p 5672 ${additionnalOption} -b ${encodedBody} >> /tmp/send.AMQP.${jobid}.history.txt
+
+  # Send the message
+  sendAMQPMsg -h localhost -p 5672 ${additionnalOption} -b ${encodedBody}
+  status=$?
+  if [ ${status} -gt 0 ] ; then
+    IGCM_debug_Print 2 "IGCM_debug_Push/PopStack/ActivateBigBro : command sendAMQPMsg failed error code ${status}"
+    echo  sendAMQPMsg -h localhost -p 5672 -b "${Body}"
+    exit
+  fi
+}
+
+#D-#==================================================================
 #D-function IGCM_debug_CallStack
-#D-* Purpose: Echo the Stack
+#D-* Purpose: Print the call stack tree from the oldest to the youngest (opposite of the display standard)
 #D-
 function IGCM_debug_CallStack {
   if ( $DEBUG_debug ) ; then
-    # La pile d'appels est affichée de la plus vieille à la plus récente 
-    # (c'est donc l'inverse de la norme d'affichage).
+    # Cosmetics
     typeset i decal
     i=0
@@ -89,5 +161,4 @@
       ((i = i + 1))
     done
-    #echo "!------------------------!"
   fi
 }
@@ -98,8 +169,9 @@
 #D-
 function IGCM_debug_PushStack {
-
   if ( $DEBUG_debug ) ; then
-    typeset decal inputs
+    typeset decal inputs startTime_ms
     echo >> ${StackFileLocation}/stack
+
+    # Only cosmetics : stack file
     decal=0
     while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
@@ -108,14 +180,22 @@
     done
 
-    # STORE input list in an indexed array
+    # Save input list in an indexed array
     INPUTS=( $@ )
+
+    # Get timing information
+    startTime_ms=$( IGCM_debug_getDate_ms )
+
     # We add function call name on beginning of the stack
     set +A IGCM_debug_Stack -- ${1} ${IGCM_debug_Stack[*]}
 
+    # Save timing in milliseconds in an indexed array
+    set +A IGCM_debug_StackTiming -- ${startTime_ms} ${IGCM_debug_StackTiming[*]}
+
     # We include the "null" Args in the beginning of the StackArgs
-    set +A IGCM_debug_StackArgs ${NULL_STR} ${IGCM_debug_StackArgs[*]} 
+    set +A IGCM_debug_StackArgs ${NULL_STR} ${IGCM_debug_StackArgs[*]}
+
     # Then, we shift StackArgs tabular
-    if [ $# -gt 1 ]; then 
-      IGCM_debug_StackArgs[0]=$(echo ${INPUTS[*]:1} | sed -e "s/\ /,/g")
+    if [ $# -gt 1 ]; then
+      IGCM_debug_StackArgs[0]=$(echo ${INPUTS[*]:1} | sed -e "s/\ /,/g" )
     fi
 
@@ -123,39 +203,16 @@
     echo "> ${IGCM_debug_LenStack} : ${@}" >> ${StackFileLocation}/stack
 
-    # Fill the rabbitMQ queue
-
-    # TO BE A FUNCTION BEGIN #
-
     if [ X${ActivateBigBro} = Xtrue ] ; then
-      # Only cosmetics
-      decal=0
-      while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
-        printf ' ' >> ${StackFileLocation}/stack
-        (( decal = decal + 1 ))
-      done
-      # RabbitMQ message
+      # RabbitMQ message code
       code=2000
-      #
+      # RabbitMQ message body
       Body=$( echo "{\"code\":\"${code}\",\"simuid\":\"${simuid}\",\"jobid\":\"${jobid}\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${INPUTS[*]}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" )
-      encodedBody=$( echo "${Body}" | base64 -w 0 )
-      #
-      #sendAMQPMsg -h localhost -p 5672 -f ${SUBMIT_DIR}/config.card.base64 -b ${encodedBody}
-      echo sendAMQPMsg -h localhost -p 5672 -b "${Body}"      >> ${StackFileLocation}/stack
-      echo sendAMQPMsg -h localhost -p 5672 -b ${encodedBody} >> /tmp/send.AMQP.${jobid}.history.txt
-      sendAMQPMsg -h localhost -p 5672 -b ${encodedBody}
-      status=$?
-      if [ ${status} -gt 0 ] ; then
-        IGCM_debug_Print 2 "IGCM_debug_PushStack : command sendAMQPMsg failed error code ${status}"
-        echo  sendAMQPMsg -h localhost -p 5672 -b "${Body}"
-        exit
-      fi
-    fi
-
-    # TO BE A FUNCTION END #
+      # Fill the rabbitMQ queue
+      IGCM_debug_sendAMQP
+    fi
 
     # Increment LenStack
     (( IGCM_debug_LenStack = IGCM_debug_LenStack + 1 ))
 
-    # If you want to print CallStack each time :
     #IGCM_debug_CallStack
   fi
@@ -168,13 +225,106 @@
 function IGCM_debug_PopStack {
   if ( $DEBUG_debug ) ; then
-    typeset decal
+    typeset decal command arguments startTime_ms endTime_ms
+    typeset fileList source dest
+
+    # INTRODUCE SIMPLE ERROR GENERATOR TO TEST SUPERVISOR
+    # PROBABILITY ERROR IS 0.0001 PER COMMAND OR FUNCTION CALL
+    # THERE ARE ~500 COMMAND OR FUNCTION CALL PER PERIOD
+    if ( ${RandomError} ) ; then
+      if [ $((RANDOM%10000)) -le 10 ] ; then
+        IGCM_debug_Print 1 "Random error has been triggered"
+        echo "RANDOM ERROR" >> ${StackFileLocation}/stack
+        ExitFlag=true
+      fi
+    fi
+
     if [ "${IGCM_debug_Stack[0]}" = "${1}" ]; then
+      # Everything is cool
+
+      # Get timing information
+      endTime_ms=$( IGCM_debug_getDate_ms )
+
+      # Save Stack information before poping the stack
+      command=${IGCM_debug_Stack[0]}
+
+      # Go from comma separated (list) to space separated in an array
+      set -A arguments $( echo ${IGCM_debug_StackArgs[0]} | sed -e "s/,/\ /g" )
+
+      # Save Stack information before poping the stack
+      startTime_ms=${IGCM_debug_StackTiming[0]}
+
+      # Pop the stack
       (( IGCM_debug_LenStack = IGCM_debug_LenStack - 1 ))
       set -A IGCM_debug_Stack -- ${IGCM_debug_Stack[*]:1}
       set -A IGCM_debug_StackArgs -- ${IGCM_debug_StackArgs[*]:1}
+      set -A IGCM_debug_StackTiming -- ${IGCM_debug_StackTiming[*]:1}
     else
       echo 'IGCM_debug_Exit : stack is corrupted ! LenStack =' ${IGCM_debug_LenStack}
       IGCM_debug_Exit $@
     fi
+
+    # Special actions depending on command to prepare IGCM_debug_PrintInfosAction call
+    # We are interested in:
+    #  0. Which command performs the work
+    #  1. Size of entity we are working with
+    #  2. Where are we reading
+    #  3. Where are we writing
+    #  4. How long it took
+
+    case ${command} in
+    # Copy from archive machine or from buffer
+    IGCM_sys_Get|IGCM_sys_GetBuffer)
+      if [ ${#arguments[*]} -eq 2 ] ; then
+        source=${arguments[0]}
+        dest=${arguments[1]}
+        # Size of file whose name are stored in a variable
+        entitySize=$( IGCM_debug_sizeOfTabContent source )
+      elif ( [ ${#arguments[*]} -eq 3 ] && [ ${arguments[0]} = '/l' ] ) ; then
+        # Keep the array name hosting the all list
+        fileList=${arguments[0]}
+        # just need the first file to get the directory
+        eval source=\${${arguments[0]}[0]}
+        dest=${arguments[1]}
+        # Size of file whose name are stored in an array
+        entitySize=$( IGCM_debug_sizeOfTabContent fileList[*] )
+      elif [ [ ${#arguments[*]} -ge 3 ] ; then
+       # All but the latest
+        fileList=${arguments[*]:0:${#arguments[*]}-2}
+        # just need the first file to get the directory
+        source=${arguments[0]}
+        # Nothing but the latest
+        dest=${arguments[${#arguments[*]}-1]}
+        # Size of file whose name are stored in a list
+        entitySize=$( IGCM_debug_sizeOfTabContent fileList )
+      fi
+      ;;
+
+    # Copy from compute node
+    IGCM_sys_Get_Master|IGCM_sys_Get_Dir)
+      if [ ${#arguments[*]} -eq 2 ] ; then
+        source=${arguments[0]}
+        dest=${arguments[1]}
+        # Size of file whose name are stored in a variable
+        entitySize=$( IGCM_debug_sizeOfTabContent source )
+      fi
+      ;;
+
+    # Rebuild command
+    IGCM_sys_rebuild|IGCM_sys_rebuild_station)
+      # All but the first
+      fileList=${arguments[*]:1:${#arguments[*]}-1}
+      # just need a file to get the directory
+      source=${arguments[1]}
+      # Nothing but the first
+      dest=${arguments[0]}
+      # Size of file whose name are stored in a list
+      entitySize=$( IGCM_debug_sizeOfTabContent fileList )
+      ;;
+    esac
+
+    # Print information related to instrumentation
+    IGCM_debug_PrintInfosAction ${command} ${entitySize} ${startTime_ms} ${endTime_ms} ${dest} ${source}
+
+    # Only cosmetics : stack file
     decal=0
     while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
@@ -183,97 +333,40 @@
     done
 
-    # INTRODUCE SIMPLE ERROR GENERATOR TO TEST SUPERVISOR
-    # PROBABILITY ERROR IS 0.0001 PER COMMAND OR FUNCTION CALL
-    # THERE ARE ~500 COMMAND OR FUNCTION CALL PER PERIOD
-    # 
-    if ( ${RandomError} ) ; then
-      if [ $((RANDOM%10000)) -le 10 ] ; then
-        IGCM_debug_Print 1 "A random error has been triggered"
-        echo "RANDOM ERROR" >> ${StackFileLocation}/stack
-        ExitFlag=true
-      fi
-    fi
-
     if ( ${ExitFlag} ) ; then
       # Inform the stack file
       echo '!!! ExitFlag has been activated !!!' >> ${StackFileLocation}/stack
-      # Inform the rabbitMQ queue
-
-      # TO BE A FUNCTION BEGIN #
 
       if [ X${ActivateBigBro} = Xtrue ] ; then
-        # Only cosmetics
-        decal=0
-        while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
-          printf ' ' >> ${StackFileLocation}/stack
-          (( decal = decal + 1 ))
-        done
-        # RabbitMQ message
+        # RabbitMQ message code
         code=9000
-        #
+        # RabbitMQ message body
         Body=$( echo "{\"code\":\"${code}\",\"simuid\":\"${simuid}\",\"jobid\":\"${jobid}\",\"status\":\"NOK\",\"out\":\"true\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${INPUTS[*]}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" )
-        encodedBody=$( echo "${Body}" | base64 -w 0 )
-        #
-        #sendAMQPMsg -h localhost -p 5672 -f ${SUBMIT_DIR}/config.card -b ${encodedBody}
-        echo sendAMQPMsg -h localhost -p 5672 -b "${Body}"      >> ${StackFileLocation}/stack
-        echo sendAMQPMsg -h localhost -p 5672 -b ${encodedBody} >> /tmp/send.AMQP.${jobid}.history.txt
-        sendAMQPMsg -h localhost -p 5672 -b ${encodedBody}
-        status=$?
-        if [ ${status} -gt 0 ] ; then
-          IGCM_debug_Print 2 "IGCM_debug_PopStack : command sendAMQPMsg failed error code ${status}"
-          echo  sendAMQPMsg -h localhost -p 5672 -b "${Body}"
-          exit
-        fi
+        # Fill the rabbitMQ queue
+        IGCM_debug_sendAMQP
       fi
-
-      # TO BE A FUNCTION END #
-
     else
       # Inform the stack file
       echo "< ${IGCM_debug_LenStack} : ${@}" >> ${StackFileLocation}/stack
-
-      # Inform the rabbitMQ queue
-
-      # TO BE A FUNCTION BEGIN #
-
       if [ X${ActivateBigBro} = Xtrue ] ; then
-        # Only cosmetics
-        decal=0
-        while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
-          printf ' ' >> ${StackFileLocation}/stack
-          (( decal = decal + 1 ))
-        done
-        # RabbitMQ message
+        # RabbitMQ message code
         code=3000
-        #
+        # RabbitMQ message body
         Body=$( echo "{\"code\":\"${code}\",\"simuid\":\"${simuid}\",\"jobid\":\"${jobid}\",\"status\":\"OK\",\"out\":\"true\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${INPUTS[*]}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" )
-        encodedBody=$( echo "${Body}" | base64 -w 0 )
-        #
-        echo sendAMQPMsg -h localhost -p 5672 -b "${Body}"      >> ${StackFileLocation}/stack
-        echo sendAMQPMsg -h localhost -p 5672 -b ${encodedBody} >> /tmp/send.AMQP.${jobid}.history.txt
-        sendAMQPMsg -h localhost -p 5672 -b ${encodedBody}
-        status=$?
-        if [ ${status} -gt 0 ] ; then
-          IGCM_debug_Print 2 "IGCM_debug_PopStack : command sendAMQPMsg failed error code ${status}"
-          echo  sendAMQPMsg -h localhost -p 5672 -b "${Body}"
-          exit
-        fi
+        # Fill the rabbitMQ queue
+        IGCM_debug_sendAMQP
       fi
-
-      # TO BE A FUNCTION END #
-
-    fi
-
+    fi
+
+    # Reset array if necessary
     if [ ${IGCM_debug_LenStack} = 0 ]; then
-      # Reset array only when necessary
       #echo
       #IGCM_debug_Print 3 "Clean stack array"
       #echo
-      #set -A IGCM_debug_Stack ${NULL_STR}
-      #set -A IGCM_debug_StackArgs ${NULL_STR}
       unset IGCM_debug_Stack
       unset IGCM_debug_StackArgs
+      unset IGCM_debug_StackTiming
       IGCM_debug_Stack[0]=${NULL_STR}
       IGCM_debug_StackArgs[0]=${NULL_STR}
+      IGCM_debug_StackTiming[0]=${NULL_STR}
     fi
   fi
@@ -288,17 +381,12 @@
   IGCM_debug_PushStack "IGCM_debug_ActivateBigBro"
 
-  # Fill the rabbitMQ queue
   if [ X${BigBrother} = Xtrue ] ; then
     # ID to identify a simulation
     simuid=${config_UserChoices_JobName}.${config_UserChoices_ExperimentName}.${config_UserChoices_SpaceName}.${config_UserChoices_TagName}.p86denv.TGCC.CURIE
+
     # ID to identify a job. Several Jobs are needed to complete a simulation
     jobid=${config_UserChoices_JobName}.${config_UserChoices_ExperimentName}.${config_UserChoices_SpaceName}.${config_UserChoices_TagName}.p86denv.TGCC.CURIE.${CumulPeriod}
-    # Only cosmetics
-    decal=0
-    while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
-      printf ' ' >> ${StackFileLocation}/stack
-      (( decal = decal + 1 ))
-    done
-    # RabbitMQ message
+
+    # RabbitMQ message code
     if ( ${FirstInitialize} ) ; then
       code=0000
@@ -306,18 +394,10 @@
       code=1000
     fi
+    # RabbitMQ message body
     Body=$( echo "{\"code\":\"${code}\",\"simuid\":\"${simuid}\",\"jobid\":\"${jobid}\",\"status\":\"OK\",\"out\":\"false\",\"nesting\":\"${IGCM_debug_LenStack}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" )
-    encodedBody=$( echo "${Body}" | base64 -w 0 )
-    #
-    cat ${SUBMIT_DIR}/config.card | base64 -w 0 > ${SUBMIT_DIR}/config.card.base64
-    #
-    echo sendAMQPMsg -h localhost -p 5672 -f ${SUBMIT_DIR}/config.card.base64 -b "${Body}"      >> ${StackFileLocation}/stack
-    echo sendAMQPMsg -h localhost -p 5672 -f ${SUBMIT_DIR}/config.card.base64 -b ${encodedBody} >> /tmp/send.AMQP.${jobid}.history.txt
-    sendAMQPMsg -h localhost -p 5672 -f ${SUBMIT_DIR}/config.card.base64 -b ${encodedBody}
-    status=$?
-    if [ ${status} -gt 0 ] ; then
-      IGCM_debug_Print 2 "IGCM_debug_ActivateBigBro : command failed error code ${status}"
-      echo  sendAMQPMsg -h localhost -p 5672 -b "${Body}"
-      IGCM_debug_Exit "IGCM_debug_ActivateBigBro"
-    fi
+    # Fill the rabbitMQ queue (specifying config.card must be send)
+    IGCM_debug_sendAMQP activate
+
+    # Turn the flag on
     ActivateBigBro=true
   fi
@@ -332,10 +412,10 @@
   IGCM_debug_PushStack "IGCM_debug_Exit"
   echo "IGCM_debug_Exit : " "${@}"
-  echo 
+  echo
   echo "!!!!!!!!!!!!!!!!!!!!!!!!!!"
-  echo "!!   ERROR TRIGGERED    !!" 
-  echo "!!   EXIT FLAG SET      !!" 
-  echo "!------------------------!" 
-  echo 
+  echo "!!   ERROR TRIGGERED    !!"
+  echo "!!   EXIT FLAG SET      !!"
+  echo "!------------------------!"
+  echo
   IGCM_debug_CallStack
   ExitFlag=true
@@ -358,4 +438,15 @@
       IGCM_debug_CallStack
     fi
+
+    if [ X${ActivateBigBro} = Xtrue ] ; then
+      # RabbitMQ message code
+      code=9999
+      # RabbitMQ message body
+      Body=$( echo "{\"code\":\"${code}\",\"simuid\":\"${simuid}\",\"jobid\":\"${jobid}\",\"status\":\"FATAL\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" )
+      # Fill the rabbitMQ queue
+      IGCM_debug_sendAMQP
+    fi
+
+    # Not sure about that one ...
     if ( $DEBUG_debug ) ; then
       echo "Your files on ${R_OUT} :"
@@ -364,34 +455,7 @@
     fi
 
-    # TO BE A FUNCTION BEGIN #
-
-    if [ X${ActivateBigBro} = Xtrue ] ; then
-      # Only cosmetics
-      decal=0
-      while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
-        printf ' ' >> ${StackFileLocation}/stack
-        (( decal = decal + 1 ))
-      done
-      # RabbitMQ message
-      code=9999
-      #
-      Body=$( echo "{\"code\":\"${code}\",\"simuid\":\"${simuid}\",\"jobid\":\"${jobid}\",\"status\":\"FATAL\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" )
-      encodedBody=$( echo "${Body}" | base64 -w 0 )
-      #
-      echo sendAMQPMsg -h localhost -p 5672 -b "${Body}"      >> ${StackFileLocation}/stack
-      echo sendAMQPMsg -h localhost -p 5672 -b ${encodedBody} >> /tmp/send.AMQP.${jobid}.history.txt
-      sendAMQPMsg -h localhost -p 5672 -b ${encodedBody}
-      status=$?
-      if [ ${status} -gt 0 ] ; then
-        IGCM_debug_Print 2 "IGCM_debug_PopStack : command sendAMQPMsg failed error code ${status}"
-        echo  sendAMQPMsg -h localhost -p 5672 -b "${Body}"
-        exit
-      fi
-    fi
-
-    # TO BE A FUNCTION END #
-
     # Mail notification
     IGCM_sys_SendMail
+
     # And Good Bye
     date
@@ -448,11 +512,11 @@
     1) for i in "$@" ; do
       ${cmd_echo} $(date +"%Y-%m-%d %T") "--Debug1-->" ${i}
-      done ;; 
+      done ;;
     2) for i in "$@" ; do
       ${cmd_echo} $(date +"%Y-%m-%d %T") "--------Debug2-->" ${i}
-      done ;; 
+      done ;;
     3) for i in "$@" ; do
       ${cmd_echo} $(date +"%Y-%m-%d %T") "--------------Debug3-->" ${i}
-      done ;; 
+      done ;;
     esac
   fi
@@ -473,4 +537,56 @@
     IGCM_debug_Print ${level} ${list}
   fi
+}
+
+#D-#==================================================================
+#D-function IGCM_debug_PrintInfosAction
+#D-* Purpose: Print information related to instrumentation
+function IGCM_debug_PrintInfosActions
+{
+  typeset actionType=$1
+  typeset entitySize=$2
+  typeset start_ms=$3
+  typeset end_ms=$4
+
+  typeset dest=$5
+  typeset source=$6
+
+  typeset diff_ms entitySizeKo entitySizeMo flux_Ko_ms flux_Ko_s flux_Mo_s
+  typeset name dirOut dirSource
+
+  name="doNotKnow"
+
+  diff_ms=$(( $end_ms - $start_ms ))
+  # echo "diff_ms=$diff_ms"
+
+  entitySizeKo=$( echo ${entitySize} | gawk -F"|" '{print $1}' )
+  # echo "entitySizeKo=$entitySizeKo"
+  entitySizeMo=$( echo ${entitySize} | gawk -F"|" '{print $2}' )
+
+  # flux en Ko / ms
+  flux_Ko_ms=$( echo "scale=6;${entitySizeKo}/${diff_ms}" | bc )
+  # echo "flux_Ko_ms=$flux_Ko_ms"
+
+  # flux en Ko / s
+  flux_Ko_s=$(( $flux_Ko_ms * 1000 ))
+  # echo "flux_Ko_s=$flux_Ko_s"
+
+  # flux en Mo / s
+  flux_Mo_s=$( echo "scale=6;${flux_Ko_s}/1024" | bc )
+  # echo "flux_Mo_s=$flux_Mo_s"
+
+  if [ -d $dest ] ; then
+    dirOut=$( readlink -f ${dest} )
+  else
+    dirOut=$( readlink -f $( dirname ${dest} ) )
+  fi
+
+  if [ -d $source ] ; then
+    dirSource=$( readlink -f ${source} )
+  else
+    dirSource=$( readlink -f $( dirname ${source} )
+  fi
+
+  echo "==>act:${actionType}|sz:${entitySizeMo}|ms:${diff_ms}|fx(ko):${flux_Ko_s}|fx(mo):${flux_Mo_s}|nm:${name}|dirSource:${dirSource}|dirOut:${dirOut}"
 }
 
