Table of Contents

Profiling Tor

oprofile

Also see https://gitweb.torproject.org/tor.git/blob_plain/master:/doc/HACKING

(performed on Ubuntu Oneiric)

apt-get install tor-dbg libcrypto++9-dbg libssl1.0.0-dbg oprofile
opcontrol --no-vmlinux
opcontrol --start
# [... now let it run...]

# output report:
opreport -g -l /usr/sbin/tor 

# to terminate:
opcontrol --shutdown
# reset:
opcontrol --reset

# dump:
 opcontrol --dump && opreport -l

If you want to profile kernel operations, too, load the kernel symbols:

# add debug kernel repo https://wiki.ubuntu.com/DebuggingProgramCrash
echo "deb http://ddebs.ubuntu.com $(lsb_release -cs) main restricted universe multiverse" | \
sudo tee -a /etc/apt/sources.list.d/ddebs.list
echo "deb http://ddebs.ubuntu.com $(lsb_release -cs)-updates main restricted universe multiverse
deb http://ddebs.ubuntu.com $(lsb_release -cs)-security main restricted universe multiverse
deb http://ddebs.ubuntu.com $(lsb_release -cs)-proposed main restricted universe multiverse" | \
sudo tee -a /etc/apt/sources.list.d/ddebs.list

# install symbols
apt-get install linux-image-$(uname -r)-dbgsym
opcontrol --shutdown
opcontrol --reset
opcontrol --setup --vmlinux=/usr/lib/debug/boot/vmlinux-$(uname -r)

Every hour as cronjob:

0 * * * * /usr/bin/opreport -g -l /usr/sbin/tor > /var/www/opreport.txt 2>/dev/null
0 * * * * /usr/bin/opcontrol --dump && /usr/bin/opreport -l > /var/www/opdump.txt 2>/dev/null

dstat

For one session until reboot ( 60 = every minute, 3600 = every hour)

apt-get install dstat
screen 
dstat -tnl --tcp -N eth1 -cmdgirsy --fs -C total,0,1,2,3 3600 > /var/www/dstat.txt
setup/profiling.txt · Last modified: 2011/11/07 01:39 by moritz