[Serusers] How to build in SER modules statically for profiling?

Jia Zou zouj03 at mails.tsinghua.edu.cn
Sat Aug 12 03:19:14 CEST 2006


  Thank you for your kind help. However,my problem is to profile the shared libraries rather than to profile forking processes. gprof can not generate any information about these shared libraries, and i also seems problem when using sprof, which is said to be able to offer profiling statistics about dynamic loaded libraries.
    So, I think another way is to build these modules statically, but don't know how to. So can anyone help me with that? thanks for your time!

                                                      Jacqueline Zou

======== 2006-08-11 14:56:12 您在来信中写道: ========

Your post belongs to serdev. Here is a serdev post from Hendrik Scholz some time back.
g-)


Hi! 

I'm about to profile our SER installation and since profiling 
doesn't run out of the box here's a rough guide: 

- you'll need to build SER from sources, thus get sources, 
  apply your patches and so on 
- before compilation get this patch (for CVS HEAD): 
  http://dump.wormulon.net/patches/ser-profiling.diff 
  Call 
  $ patch -p0 < ser-profiling.diff 
  from the SER base directory. 

  What it does it invoking monstartup() in each child process 
  since the profiling information get lost when fork()ing. 
  I added all childs including timer and fifoserver. If you are 
  only interested in certain worker processes you can cut down 
  the resource impact by selectively activating profiling. 
- enable profiling in Makefile.defs 
  - Set both -DPROFILING and PROFILE=-pg 
- compile and deploy as usual 
- Before starting SER using your standard init script you need 
  to set an environment variable that acts as a prefix to all 
  profiling data files. If you don't set it you'll only get one 
  file for the main process. 
  # export GMON_OUT_PREFIX=testrun 
  The gmon files will be named testrun.<PID> with the PID matching 
  $ serctl fifo ps 
  SER may change the current working directory and drop 
  privileges on the way therefore I suggest you invoke the init 
  script from the SER working directory (-w option) so you'll 
  end up with all files in one place. 
- Run SER for a while. 
  Not all gmon files will show up immediately, though. 
- You should now be able to get per-process statistics using 
  $ gprof /usr/sbin/ser testrun.<PID> 
- If cummulative statistics are what you are looking for use 
  $ gprof -s /usr/sbin/ser testrun.* 
  to create a new gmon.out which contains statistics over all 
  processes. 

I have yet to fully analyze the results. 

Cheers (and YMMV), 
 Hendrik 


-- 
freenet Cityline GmbH, Hamburger Chaussee 2-4, 24114 Kiel, Germany 
Phone: +49 (0)431 9020552, Fax: +49 (0)431 9020559 
Internet: http://www.freenet.de, eMail: hendrik.scholz at freenet-ag.de 
_______________________________________________ 
Serdev mailing list 
Serdev at lists.iptel.org 
http://lists.iptel.org/mailman/listinfo/serdev 





邹嘉 wrote: 
Hi, all!

I am currently involved in a research work which aims at optimizing the SIP stack, and we chose SER -0.9.6 as our researching platform. we need to profile SER to find out which part(parser? network? transactions? ) consumes the most CPU cycles. However, tools like gprof and Intel Vtune's sampling tool can not show any information about the functions in dynamically loaded modules, such as tm, registrar. So, a possible solution seems to build in these modules into the core statically.

I tried to do what the INSTALL doc says, compling with the following command:"make static_modules=tm PROFILE=-pg all", the final part of the result shows:
......
make[1]:***[callid.o] Error 1
make[1]: Leaving directory '/....../SER/ser-0.9.6/modules/tm'
gcc -Wl,-02 -Wl, -E -pg action.o crc.o .....modules/tm/dlg.o, modules/tm/h_table.o .....modules/tm/uac_unixsock.o -
gcc: modules/tm/callid.o:No such file or directory
gcc: modules/tm/h_table.o:No such file or directory
...
gcc: modules/tm/uac_unixsock.o:No such file or directory
make: **[ser] Error 1

And if I proceed to type: make install
the result shows:
sr_module.o(.text+0xbc): In function 'register_builtin_modules':
/.../ser-0.9.6/sr_module.c:89: undefined reference to 'tm_exports'
collect2:ld returned 1 exit status
make: ***[ser] Error 1

I am working with SER 0.9.6
And the linux kernel used in my machine is:
Linux 2.6.9-22.ELsmp 
the OS used is Redhat 9

if anyone has tried the same thing or knows the solution, please let me know.Thanks very very much!

Jacqueline Zou







_______________________________________________
Serusers mailing list
Serusers at lists.iptel.org
http://lists.iptel.org/mailman/listinfo/serusers


  


= = = = = = = = = = = = = = = = = = = = = = 
        致
礼!

              Jia Zou
              zouj03 at mails.tsinghua.edu.cn
               2006-08-12
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20060812/cbf38b97/attachment.htm>


More information about the sr-users mailing list