SDK 1.0 Profiler

From Ubicom Developer

Jump to: navigation, search

Do the following for enabling profiler in the firmware.

  1. Edit the script gen_config.sh in Ubicom/sdk/projects/ultra
  2. Add the following line
     -c IPPROFILE 1 -c IPPROFILE_ENABLED 1 -c IPPROFILE_IP_ADDRESS 0xc0a80014 \
    This will enable the utility on the board to send packets to LAN PC IP address 192.168.0.20 (To change the IP, edit the script and change IPPROFILE_IP_ADDRESS variable value)}
  3. Change $LPJ_NAME to ultra7k_prof.lpj from ultra.lpj

Follow all of the steps just like before to build the image, load the image. Run the profiler tool on the LAN PC (with IP address) 192.168.0.20(IPPROFILE_IP_ADDRESS) and you will see system information coming in the tool.

More information about the profiler tool at http://developer.ubicom.com/documents/ubicom/sdk/doc/html/toc/ip3kprof.html

Launch Profiler

Launch the profiler on a Windows PC like below. Profiler is found at /home/work/Ubicom/sdk/tools/bin/win32

ip3kprof.exe ultra.elf vmlinux

Profiling Applications

The profiler tool can profile running linux applications.

Run the application, then ps (get the process id of your application – PID) then cat /proc/PID/maps look for the line that has execute permission, and note the start address (something like 42240000, the first hex number on the line)

Run the profiler tool using the –L option to specify the start address, and the .gdb file for your application.

For example, run the profiler for the application called “loop” as:

\home\work\Ubicom\sdk\tools\bin\win32\ip3kprof.exe 
               \home\work\Ubicom\sdk\projects\ultra\ultra.elf  
               \home\work\Ubicom\uClinux\linux-2.6.x\vmlinux  
               -L427f0000 
               \home\work\Ubicom\uClinux\user\loop\loop.gdb

Like

ip3kprof.exe ultra.elf vmlinux -L{loop addr} app.gdb

You can add a –L option (load address) and .gdb file name for each running program. The first parameter to the profiler must be the ultra.elf file.

The profiler will show time for every function in every elf file specified. All time for other processes will be collected in one “Unknown” function entry.

Profiling Firmwares with Kernel Loadable Modules

Firmwares having Kernel Loadable Modules need some extra step because symbols from the Loadable Modules are not present in the elf file. Do the following steps to make profiler aware of the symbols in Loadable Modules.

  1. On your develpment PC do the following
  2. mkdir proc_modules
  3. cp linux-2.6.x/vmlinux proc_modules
  4. change to the proc_modules directory by typing "cd proc_modules"
  5. On the target system, load the module(s) you are interested in profiling into the kernel.
  6. In the target (e.g the IP700 series router board) console execute "lsmod" or cat /proc/modules to find out what modules have been loaded into the kernel.
  7. Put the module names found in the previous step (e.g. ath_hal, usb_core, etc) of all modules in a file called procm/proc_modules. One module name per line.
  8. Next exexute: perl ../modules/create_profiler_image_with_modules.pl proc_modules vmlinux vmlinux_rel -I ../romfs/lib/modules.


Then launch the profiler as follows

ip3kprof.exe ultra.elf vmlinux_rel vmlinux