[liblouis-liblouisxml] Profiling

  • From: Christian Egli <christian.egli@xxxxxx>
  • To: liblouis-liblouisxml <liblouis-liblouisxml@xxxxxxxxxxxxx>
  • Date: Mon, 03 Jun 2013 12:16:14 +0200

Hi all

While trying to hunt down the bug with the hash_collision test I found
out how you can profile liblouis, i.e. how you can find out how much
time is spent in each call in liblouis for a translation. I added a new
section to the HACKING file. Basically you do the following:

  $ ./configure --disable-shared
  $ make clean all CFLAGS='-g -O0 -pg' LDFLAGS='-all-static'

Then translate some stuff with a large table:

  $ ./tools/lou_translate tests/tables/large.ctb 

Finally look at the call profile:

  $ libtool --mode=execute gprof ./tools/lou_translate gmon.out

The output will look something like this:

  %   cumulative   self              self     total           
 time   seconds   seconds    calls   s/call   s/call  name    
 50.00      1.28     1.28    17576     0.00     0.00  add_0_multiple
 49.22      2.54     1.26    17632     0.00     0.00  add_1_single
  0.39      2.55     0.01   106880     0.00     0.00  findCharOrDots
  0.39      2.56     0.01    17668     0.00     0.00  eqasc2uni
  0.00      2.56     0.00   264269     0.00     0.00  getAChar
  0.00      2.56     0.00   123267     0.00     0.00  compile_findCharOrDots
  0.00      2.56     0.00    52829     0.00     0.00  getToken
  0.00      2.56     0.00    17807     0.00     0.00  allocateSpaceInTable
  0.00      2.56     0.00    17689     0.00     0.00  definedCharOrDots
  0.00      2.56     0.00    17633     0.00     0.00  addRule
  0.00      2.56     0.00    17633     0.00     0.00  charactersDefined
  0.00      2.56     0.00    17613     0.00     0.00  compileRule
  0.00      2.56     0.00    17610     0.00     0.00  getALine

Of course these tests should be done with a more typical table not the
kind of edge case table that I was using. I welcome some feedback.

Thanks
Christian

-- 
Christian Egli
Swiss Library for the Blind, Visually Impaired and Print Disabled
Grubenstrasse 12, CH-8045 Zürich, Switzerland

-----
Tag der offenen Tuer
Die SBS laedt Sie herzlich ein: 29. Juni 2013 von 9 bis 16 Uhr.
Mehr Informationen erhalten Sie unter http://www.sbs.ch/offenetuer
For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts:

  • » [liblouis-liblouisxml] Profiling - Christian Egli