Archive | March 2011

Casting Crown – Who Am I?

Who am I?
That the Lord of all the earth
Would care to know my name
Would care to feel my hurt
Who am I?
That the bright and morning star
Would choose to light the way
For my ever wandering heart

Not because of who I am
But because of what You’ve done
Not because of what I’ve done
But because of who You are

I am a flower quickly fading
Here today and gone tomorrow
A wave tossed in the ocean
A vapor in the wind
Still You hear me when I’m calling
Lord, You catch me when I’m falling
And You’ve told me who I am
I am Yours, I am Yours

Who am I?
That the eyes that see my sin
Would look on me with love
And watch me rise again
Who am I?
That the voice that calmed the sea
Would call out through the rain
And calm the storm in me

I am Yours, I am Yours
Whom shall I fear, whom shall I fear
‘Cause I am Yours, I am Yours

Memory usage by process

The Solaris pmap command will provide the total memory usage of each process.

The following shell script prints the memory usage of each process, sorted by ascending memory usage.
/usr/bin/printf "%-6s %-9s %s\n" "PID" "Total" "Command"
/usr/bin/printf "%-6s %-9s %s\n" "---" "-----" "-------"
for PID in `/usr/bin/ps -e | /usr/bin/awk '$1 ~ /[0-9]+/ { print $1 }'`
CMD=`/usr/bin/ps -o comm -p $PID | /usr/bin/tail -1`
# Avoid "pmap: cannot examine 0: system process"-type errors
# by redirecting STDERR to /dev/null
TOTAL=`/usr/bin/pmap $PID 2>/dev/null | /usr/bin/tail -1 | \
/usr/bin/awk '{ print $2 }'`
[ -n "$TOTAL" ] && /usr/bin/printf "%-6s %-9s %s\n" "$PID" "$TOTAL" "$CMD"
done | /usr/bin/sort -n -k2

Example output:

PID Total Command
--- ----- -------
10214 1552K tee
10216 1552K tee
10431 1552K tee
10433 1552K tee
10430 1648K /bin/sh
10213 1728K /bin/sh
10436 1776K /bin/sh
10432 1792K /bin/sh
10215 1816K /bin/sh
1526 3912K /bin/sh
22547 3912K /bin/sh
22551 3912K /bin/sh
12384 4016K /bin/sh
1370 4032K /bin/sh
22462 4216K -csh
16458 4280K -csh
175 4920K vi
22468 5680K bash
16500 5744K bash
22460 9512K /usr/lib/ssh/sshd
22550 10872K /usr/bin/sort
10292 180360K /oracle/jrrt-3.1.2-1.6.0/bin/sparcv9/java
1532 750400K /oracle/jrrt-3.1.2-1.6.0/bin/sparcv9/java
1392 1056824K /oracle/jrrt-3.1.2-1.6.0/bin/sparcv9/java
12406 1160120K /oracle/jrrt-3.1.2-1.6.0/bin/sparcv9/java
10498 1233680K /oracle/jrrt-3.1.2-1.6.0/bin/sparcv9/java