#!/bin/bash -x
#
# Caio Begotti for the Mozilla/Brasil project
# <caio1982@gmail.com> http://www.mozilla.org.br
#
# A very simple script to capture some stats of Mozilla
# and Firefox. Before running this .sh please run
# the beforeinfo.sh script.

# set whether 'mozilla' or 'firefox' as the binary target
TBIN="mozilla"

# specify the location of the log file but leaves its $ as is
TLOG="/tmp/${TBIN}.log"

# just to make sure the log is empty
echo "" > ${TLOG}

# you probably wants a label for the top values also
top -b -n1 | head -n7 | tac | head -n1 >> ${TLOG}
top -b -n1 | grep ${TBIN} >> ${TLOG}
echo -e '\n' >> ${TLOG}

# as so for the ps output
ps aux | head -n1 >> ${TLOG}
ps aux | grep ${TBIN} >> ${TLOG}
echo -e '\n' >> ${TLOG}

# results from memstat are not perfect; anyway...
memstat | grep ${TBIN}-bin >> ${TLOG}
echo -e '\n' >> ${TLOG}

# only to compare with the first free stdout
free -m -t >> ${TLOG}
