Changeset 913
- Timestamp:
- 08/12/13 15:06:43 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh
r894 r913 1 #!/bin/ksh 1 #!/bin/ksh 2 2 3 3 #************************************************************** … … 14 14 #================================================== 15 15 # The documentation of this file can be automatically generated 16 # if you use the prefix #D- for comments to be extracted. 16 # if you use the prefix #D- for comments to be extracted. 17 17 # Extract with command: cat lib* | grep "^#D-" | cut -c "4-" 18 18 #================================================== … … 46 46 # NULL_STR 47 47 # Default null string 48 typeset -r NULL_STR="_0_" 48 typeset -r NULL_STR="_0_" 49 49 50 50 #================================================== 51 51 # libIGCM_CurrentTag 52 52 # Current libIGCM tag, check compatibilty with *.card 53 typeset -r libIGCM_CurrentTag=" 1.0"53 typeset -r libIGCM_CurrentTag="2.0" 54 54 55 55 #================================================== … … 60 60 #================================================== 61 61 # Declare a stack of functions calls 62 63 # insert last argument of the Stack64 #set -A IGCM_debug_Stack ${NULL_STR}65 #set -A IGCM_debug_StackArgs ${NULL_STR}66 62 unset IGCM_debug_Stack 67 63 unset IGCM_debug_StackArgs 64 unset IGCM_debug_StackTiming 68 65 IGCM_debug_Stack[0]=${NULL_STR} 69 66 IGCM_debug_StackArgs[0]=${NULL_STR} 67 IGCM_debug_StackTiming[0]=${NULL_STR} 70 68 IGCM_debug_LenStack=0 71 69 72 70 #D-#================================================================== 71 #D-function IGCM_debug_getDate_ms 72 #D- * Purpose: Give number of milliseconds since 01-jan-1970 73 function IGCM_debug_getDate_ms 74 { 75 typeset nanosecs testnum 76 # nano secondes since 01-jan-1970 77 nanosecs=$( date +%s%N ) 78 79 # truncate the last 6 digits to get milliseconds since 01-jan-1970 80 ms=${nanosecs:0:${#nanosecs}-6} 81 82 echo "$ms" 83 } 84 85 #D-#================================================================== 86 #D-function IGCM_debug_sizeOfTabContent 87 #D- * Purpose: Give sumed size of a list of files 88 function IGCM_debug_sizeOfTabContent 89 { 90 typeset dm_liste sizeFile sizeKo sizeMo 91 eval set +A dm_liste \${${1}} 92 sizeKo=0 93 for ((i = 0; i < ${#dm_liste[*]}; i += 1)) ; do 94 # echo "dm_liste[$i]=${dm_liste[$i]}" 95 # remove path /home/login/../ from dm_liste elements 96 sizeFile=$( du --apparent-size -k ${dm_liste[$i]##/*/} ) 97 sizeKo=$(( $sizeKo + $sizeFile )) 98 done 99 sizeMo=$( echo "scale=6;${sizeKo}/1024" | bc ) 100 echo "${sizeKo}|${sizeMo}" 101 } 102 103 #D-#================================================================== 104 #D-function IGCM_debug_SendAMQP 105 #D- * Purpose: Send body; encoded body and config.card to rabbitMQ 106 function IGCM_debug_sendAMQP 107 { 108 typeset decal first additionnalOption encodedBody 109 110 # Encode message Body 111 encodedBody=$( echo "${Body}" | base64 -w 0 ) 112 113 # Send config.card ? 114 if [ X${1} = Xactivate ] ; then 115 # Encode config.card 116 cat ${SUBMIT_DIR}/config.card | base64 -w 0 > ${SUBMIT_DIR}/config.card.base64 117 # Prepare additionnal option 118 additionnalOption="-f ${SUBMIT_DIR}/config.card.base64" 119 else 120 additionnalOption= 121 fi 122 123 # Only cosmetics : stack file 124 decal=0 125 while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do 126 printf ' ' >> ${StackFileLocation}/stack 127 (( decal = decal + 1 )) 128 done 129 # Log to stack file 130 echo sendAMQPMsg -h localhost -p 5672 ${additionnalOption} -b "${Body}" >> ${StackFileLocation}/stack 131 132 # Log separately AMQP send message command 133 echo sendAMQPMsg -h localhost -p 5672 ${additionnalOption} -b ${encodedBody} >> /tmp/send.AMQP.${jobid}.history.txt 134 135 # Send the message 136 sendAMQPMsg -h localhost -p 5672 ${additionnalOption} -b ${encodedBody} 137 status=$? 138 if [ ${status} -gt 0 ] ; then 139 IGCM_debug_Print 2 "IGCM_debug_Push/PopStack/ActivateBigBro : command sendAMQPMsg failed error code ${status}" 140 echo sendAMQPMsg -h localhost -p 5672 -b "${Body}" 141 exit 142 fi 143 } 144 145 #D-#================================================================== 73 146 #D-function IGCM_debug_CallStack 74 #D-* Purpose: Echo the Stack147 #D-* Purpose: Print the call stack tree from the oldest to the youngest (opposite of the display standard) 75 148 #D- 76 149 function IGCM_debug_CallStack { 77 150 if ( $DEBUG_debug ) ; then 78 # La pile d'appels est affichée de la plus vieille à la plus récente 79 # (c'est donc l'inverse de la norme d'affichage). 151 # Cosmetics 80 152 typeset i decal 81 153 i=0 … … 89 161 ((i = i + 1)) 90 162 done 91 #echo "!------------------------!"92 163 fi 93 164 } … … 98 169 #D- 99 170 function IGCM_debug_PushStack { 100 101 171 if ( $DEBUG_debug ) ; then 102 typeset decal inputs 172 typeset decal inputs startTime_ms 103 173 echo >> ${StackFileLocation}/stack 174 175 # Only cosmetics : stack file 104 176 decal=0 105 177 while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do … … 108 180 done 109 181 110 # S TOREinput list in an indexed array182 # Save input list in an indexed array 111 183 INPUTS=( $@ ) 184 185 # Get timing information 186 startTime_ms=$( IGCM_debug_getDate_ms ) 187 112 188 # We add function call name on beginning of the stack 113 189 set +A IGCM_debug_Stack -- ${1} ${IGCM_debug_Stack[*]} 114 190 191 # Save timing in milliseconds in an indexed array 192 set +A IGCM_debug_StackTiming -- ${startTime_ms} ${IGCM_debug_StackTiming[*]} 193 115 194 # We include the "null" Args in the beginning of the StackArgs 116 set +A IGCM_debug_StackArgs ${NULL_STR} ${IGCM_debug_StackArgs[*]} 195 set +A IGCM_debug_StackArgs ${NULL_STR} ${IGCM_debug_StackArgs[*]} 196 117 197 # Then, we shift StackArgs tabular 118 if [ $# -gt 1 ]; then 119 IGCM_debug_StackArgs[0]=$(echo ${INPUTS[*]:1} | sed -e "s/\ /,/g" )198 if [ $# -gt 1 ]; then 199 IGCM_debug_StackArgs[0]=$(echo ${INPUTS[*]:1} | sed -e "s/\ /,/g" ) 120 200 fi 121 201 … … 123 203 echo "> ${IGCM_debug_LenStack} : ${@}" >> ${StackFileLocation}/stack 124 204 125 # Fill the rabbitMQ queue126 127 # TO BE A FUNCTION BEGIN #128 129 205 if [ X${ActivateBigBro} = Xtrue ] ; then 130 # Only cosmetics 131 decal=0 132 while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do 133 printf ' ' >> ${StackFileLocation}/stack 134 (( decal = decal + 1 )) 135 done 136 # RabbitMQ message 206 # RabbitMQ message code 137 207 code=2000 138 # 208 # RabbitMQ message body 139 209 Body=$( echo "{\"code\":\"${code}\",\"simuid\":\"${simuid}\",\"jobid\":\"${jobid}\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${INPUTS[*]}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" ) 140 encodedBody=$( echo "${Body}" | base64 -w 0 ) 141 # 142 #sendAMQPMsg -h localhost -p 5672 -f ${SUBMIT_DIR}/config.card.base64 -b ${encodedBody} 143 echo sendAMQPMsg -h localhost -p 5672 -b "${Body}" >> ${StackFileLocation}/stack 144 echo sendAMQPMsg -h localhost -p 5672 -b ${encodedBody} >> /tmp/send.AMQP.${jobid}.history.txt 145 sendAMQPMsg -h localhost -p 5672 -b ${encodedBody} 146 status=$? 147 if [ ${status} -gt 0 ] ; then 148 IGCM_debug_Print 2 "IGCM_debug_PushStack : command sendAMQPMsg failed error code ${status}" 149 echo sendAMQPMsg -h localhost -p 5672 -b "${Body}" 150 exit 151 fi 152 fi 153 154 # TO BE A FUNCTION END # 210 # Fill the rabbitMQ queue 211 IGCM_debug_sendAMQP 212 fi 155 213 156 214 # Increment LenStack 157 215 (( IGCM_debug_LenStack = IGCM_debug_LenStack + 1 )) 158 216 159 # If you want to print CallStack each time :160 217 #IGCM_debug_CallStack 161 218 fi … … 168 225 function IGCM_debug_PopStack { 169 226 if ( $DEBUG_debug ) ; then 170 typeset decal 227 typeset decal command arguments startTime_ms endTime_ms 228 typeset fileList source dest 229 230 # INTRODUCE SIMPLE ERROR GENERATOR TO TEST SUPERVISOR 231 # PROBABILITY ERROR IS 0.0001 PER COMMAND OR FUNCTION CALL 232 # THERE ARE ~500 COMMAND OR FUNCTION CALL PER PERIOD 233 if ( ${RandomError} ) ; then 234 if [ $((RANDOM%10000)) -le 10 ] ; then 235 IGCM_debug_Print 1 "Random error has been triggered" 236 echo "RANDOM ERROR" >> ${StackFileLocation}/stack 237 ExitFlag=true 238 fi 239 fi 240 171 241 if [ "${IGCM_debug_Stack[0]}" = "${1}" ]; then 242 # Everything is cool 243 244 # Get timing information 245 endTime_ms=$( IGCM_debug_getDate_ms ) 246 247 # Save Stack information before poping the stack 248 command=${IGCM_debug_Stack[0]} 249 250 # Go from comma separated (list) to space separated in an array 251 set -A arguments $( echo ${IGCM_debug_StackArgs[0]} | sed -e "s/,/\ /g" ) 252 253 # Save Stack information before poping the stack 254 startTime_ms=${IGCM_debug_StackTiming[0]} 255 256 # Pop the stack 172 257 (( IGCM_debug_LenStack = IGCM_debug_LenStack - 1 )) 173 258 set -A IGCM_debug_Stack -- ${IGCM_debug_Stack[*]:1} 174 259 set -A IGCM_debug_StackArgs -- ${IGCM_debug_StackArgs[*]:1} 260 set -A IGCM_debug_StackTiming -- ${IGCM_debug_StackTiming[*]:1} 175 261 else 176 262 echo 'IGCM_debug_Exit : stack is corrupted ! LenStack =' ${IGCM_debug_LenStack} 177 263 IGCM_debug_Exit $@ 178 264 fi 265 266 # Special actions depending on command to prepare IGCM_debug_PrintInfosAction call 267 # We are interested in: 268 # 0. Which command performs the work 269 # 1. Size of entity we are working with 270 # 2. Where are we reading 271 # 3. Where are we writing 272 # 4. How long it took 273 274 case ${command} in 275 # Copy from archive machine or from buffer 276 IGCM_sys_Get|IGCM_sys_GetBuffer) 277 if [ ${#arguments[*]} -eq 2 ] ; then 278 source=${arguments[0]} 279 dest=${arguments[1]} 280 # Size of file whose name are stored in a variable 281 entitySize=$( IGCM_debug_sizeOfTabContent source ) 282 elif ( [ ${#arguments[*]} -eq 3 ] && [ ${arguments[0]} = '/l' ] ) ; then 283 # Keep the array name hosting the all list 284 fileList=${arguments[0]} 285 # just need the first file to get the directory 286 eval source=\${${arguments[0]}[0]} 287 dest=${arguments[1]} 288 # Size of file whose name are stored in an array 289 entitySize=$( IGCM_debug_sizeOfTabContent fileList[*] ) 290 elif [ [ ${#arguments[*]} -ge 3 ] ; then 291 # All but the latest 292 fileList=${arguments[*]:0:${#arguments[*]}-2} 293 # just need the first file to get the directory 294 source=${arguments[0]} 295 # Nothing but the latest 296 dest=${arguments[${#arguments[*]}-1]} 297 # Size of file whose name are stored in a list 298 entitySize=$( IGCM_debug_sizeOfTabContent fileList ) 299 fi 300 ;; 301 302 # Copy from compute node 303 IGCM_sys_Get_Master|IGCM_sys_Get_Dir) 304 if [ ${#arguments[*]} -eq 2 ] ; then 305 source=${arguments[0]} 306 dest=${arguments[1]} 307 # Size of file whose name are stored in a variable 308 entitySize=$( IGCM_debug_sizeOfTabContent source ) 309 fi 310 ;; 311 312 # Rebuild command 313 IGCM_sys_rebuild|IGCM_sys_rebuild_station) 314 # All but the first 315 fileList=${arguments[*]:1:${#arguments[*]}-1} 316 # just need a file to get the directory 317 source=${arguments[1]} 318 # Nothing but the first 319 dest=${arguments[0]} 320 # Size of file whose name are stored in a list 321 entitySize=$( IGCM_debug_sizeOfTabContent fileList ) 322 ;; 323 esac 324 325 # Print information related to instrumentation 326 IGCM_debug_PrintInfosAction ${command} ${entitySize} ${startTime_ms} ${endTime_ms} ${dest} ${source} 327 328 # Only cosmetics : stack file 179 329 decal=0 180 330 while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do … … 183 333 done 184 334 185 # INTRODUCE SIMPLE ERROR GENERATOR TO TEST SUPERVISOR186 # PROBABILITY ERROR IS 0.0001 PER COMMAND OR FUNCTION CALL187 # THERE ARE ~500 COMMAND OR FUNCTION CALL PER PERIOD188 #189 if ( ${RandomError} ) ; then190 if [ $((RANDOM%10000)) -le 10 ] ; then191 IGCM_debug_Print 1 "A random error has been triggered"192 echo "RANDOM ERROR" >> ${StackFileLocation}/stack193 ExitFlag=true194 fi195 fi196 197 335 if ( ${ExitFlag} ) ; then 198 336 # Inform the stack file 199 337 echo '!!! ExitFlag has been activated !!!' >> ${StackFileLocation}/stack 200 # Inform the rabbitMQ queue201 202 # TO BE A FUNCTION BEGIN #203 338 204 339 if [ X${ActivateBigBro} = Xtrue ] ; then 205 # Only cosmetics 206 decal=0 207 while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do 208 printf ' ' >> ${StackFileLocation}/stack 209 (( decal = decal + 1 )) 210 done 211 # RabbitMQ message 340 # RabbitMQ message code 212 341 code=9000 213 # 342 # RabbitMQ message body 214 343 Body=$( echo "{\"code\":\"${code}\",\"simuid\":\"${simuid}\",\"jobid\":\"${jobid}\",\"status\":\"NOK\",\"out\":\"true\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${INPUTS[*]}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" ) 215 encodedBody=$( echo "${Body}" | base64 -w 0 ) 216 # 217 #sendAMQPMsg -h localhost -p 5672 -f ${SUBMIT_DIR}/config.card -b ${encodedBody} 218 echo sendAMQPMsg -h localhost -p 5672 -b "${Body}" >> ${StackFileLocation}/stack 219 echo sendAMQPMsg -h localhost -p 5672 -b ${encodedBody} >> /tmp/send.AMQP.${jobid}.history.txt 220 sendAMQPMsg -h localhost -p 5672 -b ${encodedBody} 221 status=$? 222 if [ ${status} -gt 0 ] ; then 223 IGCM_debug_Print 2 "IGCM_debug_PopStack : command sendAMQPMsg failed error code ${status}" 224 echo sendAMQPMsg -h localhost -p 5672 -b "${Body}" 225 exit 226 fi 344 # Fill the rabbitMQ queue 345 IGCM_debug_sendAMQP 227 346 fi 228 229 # TO BE A FUNCTION END #230 231 347 else 232 348 # Inform the stack file 233 349 echo "< ${IGCM_debug_LenStack} : ${@}" >> ${StackFileLocation}/stack 234 235 # Inform the rabbitMQ queue236 237 # TO BE A FUNCTION BEGIN #238 239 350 if [ X${ActivateBigBro} = Xtrue ] ; then 240 # Only cosmetics 241 decal=0 242 while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do 243 printf ' ' >> ${StackFileLocation}/stack 244 (( decal = decal + 1 )) 245 done 246 # RabbitMQ message 351 # RabbitMQ message code 247 352 code=3000 248 # 353 # RabbitMQ message body 249 354 Body=$( echo "{\"code\":\"${code}\",\"simuid\":\"${simuid}\",\"jobid\":\"${jobid}\",\"status\":\"OK\",\"out\":\"true\",\"nesting\":\"${IGCM_debug_LenStack}\",\"command\":\"${INPUTS[*]}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" ) 250 encodedBody=$( echo "${Body}" | base64 -w 0 ) 251 # 252 echo sendAMQPMsg -h localhost -p 5672 -b "${Body}" >> ${StackFileLocation}/stack 253 echo sendAMQPMsg -h localhost -p 5672 -b ${encodedBody} >> /tmp/send.AMQP.${jobid}.history.txt 254 sendAMQPMsg -h localhost -p 5672 -b ${encodedBody} 255 status=$? 256 if [ ${status} -gt 0 ] ; then 257 IGCM_debug_Print 2 "IGCM_debug_PopStack : command sendAMQPMsg failed error code ${status}" 258 echo sendAMQPMsg -h localhost -p 5672 -b "${Body}" 259 exit 260 fi 355 # Fill the rabbitMQ queue 356 IGCM_debug_sendAMQP 261 357 fi 262 263 # TO BE A FUNCTION END # 264 265 fi 266 358 fi 359 360 # Reset array if necessary 267 361 if [ ${IGCM_debug_LenStack} = 0 ]; then 268 # Reset array only when necessary269 362 #echo 270 363 #IGCM_debug_Print 3 "Clean stack array" 271 364 #echo 272 #set -A IGCM_debug_Stack ${NULL_STR}273 #set -A IGCM_debug_StackArgs ${NULL_STR}274 365 unset IGCM_debug_Stack 275 366 unset IGCM_debug_StackArgs 367 unset IGCM_debug_StackTiming 276 368 IGCM_debug_Stack[0]=${NULL_STR} 277 369 IGCM_debug_StackArgs[0]=${NULL_STR} 370 IGCM_debug_StackTiming[0]=${NULL_STR} 278 371 fi 279 372 fi … … 288 381 IGCM_debug_PushStack "IGCM_debug_ActivateBigBro" 289 382 290 # Fill the rabbitMQ queue291 383 if [ X${BigBrother} = Xtrue ] ; then 292 384 # ID to identify a simulation 293 385 simuid=${config_UserChoices_JobName}.${config_UserChoices_ExperimentName}.${config_UserChoices_SpaceName}.${config_UserChoices_TagName}.p86denv.TGCC.CURIE 386 294 387 # ID to identify a job. Several Jobs are needed to complete a simulation 295 388 jobid=${config_UserChoices_JobName}.${config_UserChoices_ExperimentName}.${config_UserChoices_SpaceName}.${config_UserChoices_TagName}.p86denv.TGCC.CURIE.${CumulPeriod} 296 # Only cosmetics 297 decal=0 298 while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do 299 printf ' ' >> ${StackFileLocation}/stack 300 (( decal = decal + 1 )) 301 done 302 # RabbitMQ message 389 390 # RabbitMQ message code 303 391 if ( ${FirstInitialize} ) ; then 304 392 code=0000 … … 306 394 code=1000 307 395 fi 396 # RabbitMQ message body 308 397 Body=$( echo "{\"code\":\"${code}\",\"simuid\":\"${simuid}\",\"jobid\":\"${jobid}\",\"status\":\"OK\",\"out\":\"false\",\"nesting\":\"${IGCM_debug_LenStack}\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" ) 309 encodedBody=$( echo "${Body}" | base64 -w 0 ) 310 # 311 cat ${SUBMIT_DIR}/config.card | base64 -w 0 > ${SUBMIT_DIR}/config.card.base64 312 # 313 echo sendAMQPMsg -h localhost -p 5672 -f ${SUBMIT_DIR}/config.card.base64 -b "${Body}" >> ${StackFileLocation}/stack 314 echo sendAMQPMsg -h localhost -p 5672 -f ${SUBMIT_DIR}/config.card.base64 -b ${encodedBody} >> /tmp/send.AMQP.${jobid}.history.txt 315 sendAMQPMsg -h localhost -p 5672 -f ${SUBMIT_DIR}/config.card.base64 -b ${encodedBody} 316 status=$? 317 if [ ${status} -gt 0 ] ; then 318 IGCM_debug_Print 2 "IGCM_debug_ActivateBigBro : command failed error code ${status}" 319 echo sendAMQPMsg -h localhost -p 5672 -b "${Body}" 320 IGCM_debug_Exit "IGCM_debug_ActivateBigBro" 321 fi 398 # Fill the rabbitMQ queue (specifying config.card must be send) 399 IGCM_debug_sendAMQP activate 400 401 # Turn the flag on 322 402 ActivateBigBro=true 323 403 fi … … 332 412 IGCM_debug_PushStack "IGCM_debug_Exit" 333 413 echo "IGCM_debug_Exit : " "${@}" 334 echo 414 echo 335 415 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!" 336 echo "!! ERROR TRIGGERED !!" 337 echo "!! EXIT FLAG SET !!" 338 echo "!------------------------!" 339 echo 416 echo "!! ERROR TRIGGERED !!" 417 echo "!! EXIT FLAG SET !!" 418 echo "!------------------------!" 419 echo 340 420 IGCM_debug_CallStack 341 421 ExitFlag=true … … 358 438 IGCM_debug_CallStack 359 439 fi 440 441 if [ X${ActivateBigBro} = Xtrue ] ; then 442 # RabbitMQ message code 443 code=9999 444 # RabbitMQ message body 445 Body=$( echo "{\"code\":\"${code}\",\"simuid\":\"${simuid}\",\"jobid\":\"${jobid}\",\"status\":\"FATAL\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" ) 446 # Fill the rabbitMQ queue 447 IGCM_debug_sendAMQP 448 fi 449 450 # Not sure about that one ... 360 451 if ( $DEBUG_debug ) ; then 361 452 echo "Your files on ${R_OUT} :" … … 364 455 fi 365 456 366 # TO BE A FUNCTION BEGIN #367 368 if [ X${ActivateBigBro} = Xtrue ] ; then369 # Only cosmetics370 decal=0371 while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do372 printf ' ' >> ${StackFileLocation}/stack373 (( decal = decal + 1 ))374 done375 # RabbitMQ message376 code=9999377 #378 Body=$( echo "{\"code\":\"${code}\",\"simuid\":\"${simuid}\",\"jobid\":\"${jobid}\",\"status\":\"FATAL\",\"timestamp\":\"$( date +"%Y-%m-%d-%T" )\"}" )379 encodedBody=$( echo "${Body}" | base64 -w 0 )380 #381 echo sendAMQPMsg -h localhost -p 5672 -b "${Body}" >> ${StackFileLocation}/stack382 echo sendAMQPMsg -h localhost -p 5672 -b ${encodedBody} >> /tmp/send.AMQP.${jobid}.history.txt383 sendAMQPMsg -h localhost -p 5672 -b ${encodedBody}384 status=$?385 if [ ${status} -gt 0 ] ; then386 IGCM_debug_Print 2 "IGCM_debug_PopStack : command sendAMQPMsg failed error code ${status}"387 echo sendAMQPMsg -h localhost -p 5672 -b "${Body}"388 exit389 fi390 fi391 392 # TO BE A FUNCTION END #393 394 457 # Mail notification 395 458 IGCM_sys_SendMail 459 396 460 # And Good Bye 397 461 date … … 448 512 1) for i in "$@" ; do 449 513 ${cmd_echo} $(date +"%Y-%m-%d %T") "--Debug1-->" ${i} 450 done ;; 514 done ;; 451 515 2) for i in "$@" ; do 452 516 ${cmd_echo} $(date +"%Y-%m-%d %T") "--------Debug2-->" ${i} 453 done ;; 517 done ;; 454 518 3) for i in "$@" ; do 455 519 ${cmd_echo} $(date +"%Y-%m-%d %T") "--------------Debug3-->" ${i} 456 done ;; 520 done ;; 457 521 esac 458 522 fi … … 473 537 IGCM_debug_Print ${level} ${list} 474 538 fi 539 } 540 541 #D-#================================================================== 542 #D-function IGCM_debug_PrintInfosAction 543 #D-* Purpose: Print information related to instrumentation 544 function IGCM_debug_PrintInfosActions 545 { 546 typeset actionType=$1 547 typeset entitySize=$2 548 typeset start_ms=$3 549 typeset end_ms=$4 550 551 typeset dest=$5 552 typeset source=$6 553 554 typeset diff_ms entitySizeKo entitySizeMo flux_Ko_ms flux_Ko_s flux_Mo_s 555 typeset name dirOut dirSource 556 557 name="doNotKnow" 558 559 diff_ms=$(( $end_ms - $start_ms )) 560 # echo "diff_ms=$diff_ms" 561 562 entitySizeKo=$( echo ${entitySize} | gawk -F"|" '{print $1}' ) 563 # echo "entitySizeKo=$entitySizeKo" 564 entitySizeMo=$( echo ${entitySize} | gawk -F"|" '{print $2}' ) 565 566 # flux en Ko / ms 567 flux_Ko_ms=$( echo "scale=6;${entitySizeKo}/${diff_ms}" | bc ) 568 # echo "flux_Ko_ms=$flux_Ko_ms" 569 570 # flux en Ko / s 571 flux_Ko_s=$(( $flux_Ko_ms * 1000 )) 572 # echo "flux_Ko_s=$flux_Ko_s" 573 574 # flux en Mo / s 575 flux_Mo_s=$( echo "scale=6;${flux_Ko_s}/1024" | bc ) 576 # echo "flux_Mo_s=$flux_Mo_s" 577 578 if [ -d $dest ] ; then 579 dirOut=$( readlink -f ${dest} ) 580 else 581 dirOut=$( readlink -f $( dirname ${dest} ) ) 582 fi 583 584 if [ -d $source ] ; then 585 dirSource=$( readlink -f ${source} ) 586 else 587 dirSource=$( readlink -f $( dirname ${source} ) 588 fi 589 590 echo "==>act:${actionType}|sz:${entitySizeMo}|ms:${diff_ms}|fx(ko):${flux_Ko_s}|fx(mo):${flux_Mo_s}|nm:${name}|dirSource:${dirSource}|dirOut:${dirOut}" 475 591 } 476 592
Note: See TracChangeset
for help on using the changeset viewer.