Profiling In-band Signaling

We are in the stage of profiling the code and are looking for users to help contribute profile results on different architectures. If you could contribute to an architecture, we would greatly appreciate it.

You should be able to follow through the instructions sequentially, for which I'm going to provide Ubuntu specifics and general.

We have profile statistics for the following architectures already:

  • Pentium 4
  • Core Duo

Building VMLinux

Running oprofile with full kernel profiling is required. To do this you must acquire an uncompressed version of your kernel, vmlinux.

In Ubuntu, building VMLinux can be done as follows:

sudo apt-get install linux-kernel-devel fakeroot build-essential
sudo apt-get source linux-image-2.6.20-16-generic
sudo apt-get build-dep linux-image-2.6.20-16-generic
cd linux-source-2.6.20-2.6.20/
sudo make oldconfig
sudo make vmlinux 

If you are running a custom or self-built kernel, go to your kernel source tree and run the following command:

make vmlinux

Obtaining oprofile

In Ubuntu you can use apt-get or aptitude to retrieve oprofile. Installing glibc-dbg is also necessary to get full symbol statistics for libc.

sudo apt-get install oprofile glibc-dbg

To build oprofile manually, download it from the official oprofile site and follow the instructions. http://oprofile.sourceforge.net/download/

Before running the oprofile daemon, we must tell it where vmlinux is located. replace $VMLINUX_PATH with the path that vmlinux is located, such as /boot or /usr/src/linux/

sudo opcontrol --setup --vmlinux=$VMLINUX_PATH/vmlinux

Test that oprofile will at least start with no errors:

sudo opcontrol --start

You should receive output similar to this, which specifies that it is using the kernel interface:

$ sudo opcontrol --start
Using 2.6+ OProfile kernel interface.
Reading module info.
Using log file /var/lib/oprofile/oprofiled.log
Daemon started.
Profiler running.

Obtaining the In-band code

To get the most current copy of the profiling in-band code, use SVN:

svn co http://gnuradio.org/svn/gnuradio/branches/developers/gnychis/inband-profiling

To build the code, perform the following series of commands.

cd inband-profiling/
(./bootstrap && ./configure && make) | tee inband_log

Install the code:

sudo make install

If you encounter any errors building the code, please report your inband_log.

Obtaining the new USRP in-band RBF

Since the new in-band code uses new packet formats across the USB bus which the USRP needs to interpret, a new RBF must be used.

You can obtain the RBF that will be used for profiling here: http://www.andrew.cmu.edu/user/gnychis/usrp_inband_profiling.rbf

To install it, copy it to /usr/local/share/usrp/rev2/

In summary:

wget http://www.andrew.cmu.edu/user/gnychis/usrp_inband_profiling.rbf
sudo cp usrp_inband_profiling.rbf /usr/local/share/usrp/rev2/
sudo cp usrp_inband_profiling.rbf /usr/local/share/usrp/rev4/

Profiling the In-band Code

Enter the following directory within the inband-profiling branch which contains all of the applications which we will profile:

cd inband-profiling/usrp/host/apps-inband/

The following applications will be profiled:

  • test_usrp_inband_tx - TX only
  • test_usrp_inband_rx - RX only
  • test_usrp_inband_underrun - TX and RX

The applications do not take any parameters, here is an example of the RX run:

$ time ./test_usrp_inband_rx
[TEST_USRP_INBAND_RX] Opening the USRP
[TEST_USRP_INBAND_RX] Requesting RX channel allocation
[TEST_USRP_INBAND_RX] Receiving...
[TEST_USRP_INBAND_RX] Deallocating RX channel
[TEST_USRP_INBAND_RX] Closing the USRP

mb_runtime_thread_per_block: dtor (# workers = 1)

real    0m31.495s
user    0m8.805s
sys     0m0.436s

So let's get to the actual profiling! Start oprofile if you have not done so yet:

sudo opcontrol --start

Before EVERY oprofile run, reset the statistics or else they will carry over to other runs, and go ahead and run an application. Please provide your time per application with the reports. As soon as the application finishes, immediately save the statistics and perform a dump to ensure everything was written to disk. You now have a snapshot at the time your application finished. You will need to choose a different save name per run.

sudo opcontrol --reset
time ./test_usrp_inband_rx 
sudo opcontrol --save=test_usrp_inband_rx_1
sudo opcontrol --dump

Finally, let's retrieve the statistics. The applications you actually run in the top-most directory are scripts which run the true binaries in the .libs directory. opreport needs the true binary, which is prefixed with lt in the .libs directory.

opreport -l session:test_usrp_inband_rx_1 .libs/lt-test_usrp_inband_rx &> oprofile-test_usrp_inband_rx

And there you have it, if you look through oprofile-test_usrp_inband_rx you should see something similar to this:

CPU: P4 / Xeon with 2 hyper-threads, speed 2993 MHz (estimated)
Counted GLOBAL_POWER_EVENTS events (time during which processor is not stopped) with a unit mask of 0x01 (mandatory) count 240000
samples  %        image name               app name                 symbol name
40224    14.0335  libm-2.5.so              libm-2.5.so              sincosf
15753     5.4960  libpmt.so                libpmt.so                pmt_nthcdr(unsigned int, boost::shared_ptr<pmt_base>)
12494     4.3589  lt-test_usrp_inband_tx   lt-test_usrp_inband_tx   ui_nco<float, float>::sincos(std::complex<float>*, int, double)
12088     4.2173  libc-2.5.so              libc-2.5.so              malloc
11798     4.1161  libc-2.5.so              libc-2.5.so              free
.......

If you see (no symbols) under symbol name for images such as libc, you did not install debug symbols for the library. libc should be the only issue, scroll back up to read about installing this, we require that these symbols be included.

Submitting Your Results

Create a machine_specs file with information about your machine:

uname -a >> machine_specs
cat /proc/cpuinfo >> machine_specs

Create a times file with information about the times of each application, such as:

test_usrp_inband_rx
-------------------
real    0m31.495s
user    0m8.805s
sys     0m0.436s

test_usrp_inband_tx
-------------------
<fill me>

test_usrp_inband_underrun
-------------------------
<fill me>

tar and compress your output files like so, for an attachment (or zip them, whichever is easier for you):

tar czvf inband_results.tar.gz machine_specs times oprofile-test_usrp_inband_tx oprofile-test_usrp_inband_rx oprofile-test_usrp_inband_underrun

Send an e-mail to George: gnychis at cmu dot edu, with inband_results.tar.gz as an attachment.

We greatly appreciate any help with the profiling, and once we collect enough profile results we will host them and there will be discussion on the board if you'd like to participate.

Thank you for your time!