[Pw_forum] Memory usage by pw.x

Guido Fratesi fratesi at mater.unimib.it
Thu Aug 30 18:04:26 CEST 2012


I'm sorry for a previous incomplete message.

>   sed -ri "s/(^ *)(allocate.*$)/\1\2\n\1  CALL mem_whatever()/i" $(find
> /where/is/espresso -name \*.f90)

That was very useful, thank you.

I now get 1.9GB out of 2.4, which starts giving some usable estimate, 
but I do understand that getting the accurate value is very complex.

To my purpose, I'll monitor the memory occupancy by a script, which 
follows below in case someone finds it useful...

Guido

================

command=pw.x

maxsecs=$((60*60*24))
delay=1
nsteps=$((maxsecs/delay))

echo "#when  RAM  PID (0 for all $command instances)"}

for ((i=0;((i<nsteps));i++)); do
   #timer=`date +%H:%M:%S`
   #timer=`date +"%H:%M:%S %s.%N"`
   timer=`date +"%s.%N"`
   ps -eo comm,rss,pid |
     awk -v comm=$command -v timer=$timer '
       BEGIN {tot=0}
       ($1==comm) {
         tot+=$2;
         print timer, $2, $3;
       }
       END {if (tot) print timer, tot, 0}
     '
   sleep 1
done



-- 
Guido Fratesi

Dipartimento di Scienza dei Materiali
Universita` degli Studi di Milano-Bicocca
via Cozzi 53, 20125 Milano, Italy




More information about the users mailing list