The continuing saga of profiling GnuCash

Jon Lapham lapham at extracta.com.br
Sun Aug 31 10:49:38 CDT 2003


Folks-

After many days of pulling my hair out trying to get profiling to work 
with GnuCash, I've decided that maybe it is time to talk to the guile 
people.  I think (?) that the problem is that GnuCash is called by a 
guile script, and somewhere in that morasse we are losing the ability to 
get profiling information.

Anyway, below is the message I would like to send to the guile people 
asking for advice.  As I do not speak guile/scm/lisp very well, could 
someone read through this and make sure I am stating things correctly?

Oh, and maybe this shouldn't even go to the guile-user mailing list, is 
there somewhere else more appropriate?

============================

GnuCash needs help from the Guile community for profiling GnuCash

GnuCash is mostly written in C, with some of the major programing flow
done using guile.  We would like to profile the C code in GnuCash using
gprof.  Simply compiling gnucash using the "-g -pg" CFLAGs, unfortunately,
does not produce a gmon.out profiling file.  We believe this is due to
the fact that GnuCash is initially run under by a guile script.

GnuCash is launched by the guile script shown below:

lapham at bilbo > cat gnucash
#!/bin/sh
exec gnucash-env guile -e main -s "$0" "$@"
!#

(use-modules (gnucash main))

(define (main args)
   (set-current-module (resolve-module '(gnucash main)))
   (gnc:main))

-- end code --

To solve this problem, Derek Atkins had the idea that we should use a
profiling version (-g -pg) of the guile app called in the above script.
To do this, I found the following code snippet from the Guile
documentation:

see:
http://www.gnu.org/software/guile/docs/guile-ref/A-Sample-Guile-Main-Program.html

lapham at bilbo > cat ~/temp/gnucash/guile_c/simple-guile.c
#include <libguile.h>

static void
inner_main (void *closure, int argc, char **argv)
{
   /* module initializations would go here */
   scm_shell (argc, argv);
}

int
main (int argc, char **argv)
{
   scm_boot_guile (argc, argv, inner_main, 0);
   return 0; /* never reached */
}

-- end code --

Compiling this using "-g -pg" and calling it from the GnuCash guile script
shown above produces a gmon.out file, but it does not contain any
information from the GnuCash C functions, just the "inner_main" and "main"
functions from simple-guile.c.

We do not want to profile the SCM parts of GnuCash, just the C parts.
Do you have any ideas on how we can do this?  Most of the references I've
found concerning profiling and guile are concerned with profiling scheme,
not C.

Thank you very much for any assistance.
-Jon

Links:

Guile Reference Manual
http://www.gnu.org/software/guile/docs/guile-ref/
http://www.gnu.org/software/guile/docs/faq/guile-faq.html#Is%20there%20a%20Scheme%20code%20profiler%20that%20works%20with%20Guile%3f

Mailing list interesting links
http://mail.gnu.org/archive/html/guile-devel/2000-12/msg00170.html
http://mail.gnu.org/archive/html/guile-devel/2001-04/msg00048.html
http://mail.gnu.org/archive/html/guile-devel/2001-07/msg00162.html
http://mail.gnu.org/archive/html/guile-user/2000-09/msg00137.html
http://mail.gnu.org/archive/html/guile-user/2001-11/msg00014.html


-- 
-**-*-*---*-*---*-*---*-----*-*-----*---*-*---*-----*-----*-*-----*---
  Jon Lapham  <lapham at extracta.com.br>          Rio de Janeiro, Brasil
  Work: Extracta Moléculas Naturais SA     http://www.extracta.com.br/
  Web: http://www.jandr.org/
***-*--*----*-------*------------*--------------------*---------------




More information about the gnucash-devel mailing list