flex speed
Bob Friesenhahn
bfriesen at simple.dallas.tx.us
Tue Aug 5 00:54:52 CEST 2003
This naturally brings up the subject: Has anyone profiled bogofilter
using a profiling tool like 'gcc -pg' and 'gprof'?
Experience with software that I maintain is that a profiler often
reveals unexpected behavior which produces correct results, but not
very efficiently. Relatively minor changes to the code can sometimes
result in a big win in terms of performance.
This bit of code in configure.ac can help make it more convenient to
use the various profiling tools:
# Enable prof-based profiling support
AC_ARG_ENABLE(prof,
[ --enable-prof enable 'prof' profiling support (default disabled)],
[with_prof=$enableval],
[with_prof='no'])
# Enable gprof-based profiling support
AC_ARG_ENABLE(gprof,
[ --enable-gprof enable 'gprof' profiling support (default disabled)],
[with_gprof=$enableval],
[with_gprof='no'])
# Enable gcov-based profiling support
AC_ARG_ENABLE(gcov,
[ --enable-gcov enable 'gcov' profiling support (default disabled)],
[with_gcov=$enableval],
[with_gcov='no'])
.
.
.
# Add '-p' if prof source profiling support enabled
if test "$with_prof" = 'yes'
then
CFLAGS="-p $CFLAGS"
CXXFLAGS="-p $CXXFLAGS"
LDFLAGS="-p $LDFLAGS"
fi
# Add '-pg' if gprof source profiling support enabled
if test "$with_gprof" = 'yes'
then
CFLAGS="-pg $CFLAGS"
CXXFLAGS="-pg $CXXFLAGS"
LDFLAGS="-pg $LDFLAGS"
fi
# Add '-ftest-coverage -fprofile-arcs' if gcov source profiling
support enabled
# This is a gcc-specific feature
if test "$with_gcov" = 'yes'
then
CFLAGS="-ftest-coverage -fprofile-arcs $CFLAGS"
CXXFLAGS="-ftest-coverage -fprofile-arcs $CXXFLAGS"
LDFLAGS="-ftest-coverage -fprofile-arcs $LDFLAGS"
fi
I have a script which converts the output of 'gprof' into a graph
description for use with 'dot' to produce a very pretty weighted
call-graph.
Bob
======================================
Bob Friesenhahn
bfriesen at simple.dallas.tx.us
http://www.simplesystems.org/users/bfriesen
More information about the Bogofilter
mailing list