How much memory eated by process

pidof apache2 | xargs pmap -d | grep '^mapped' | awk '{print $4}' | sed 's/K//' | perl -e 'do { $a+=$_; $b++ } for <>;print $a/1024, « mb\n», $a/1024/$b, « mb\n»'.
pidof nginx | xargs pmap -d | grep '^mapped' | awk '{print $4}' | sed 's/K//' | perl -e 'do { $a+=$_; $b++ } for <>;print $a/1024, « mb\n», $a/1024/$b, « mb\n»'