View Full Version : profiling with freepascal

09-05-2007, 11:11 AM

Recently i tried to profile my program using gprof. Compiling with -pg resulted in the following:

bartek@bartek-laptop:~/Dev/Infor$ fpc -pg infor
Free Pascal Compiler version 2.1.3 [2007/05/04] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Linux for i386
Compiling infor.pp
Linking infor
/usr/local/lib/fpc/2.1.3/units/i386-linux/rtl/si_c21g.o: In function `SI_C21G__FPC_LIBC21_GPROF_GMON_START':
si_c21g.pp:(.text+0x2d): undefined reference to `__libc_atexit'
infor.pp(177,1) Error: Error while linking
infor.pp(177,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/local/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)

Linux Kubuntu 7.04
FPC 2.1.3 ( fixes_2_2 branch )

Thanks in advance

09-05-2007, 09:27 PM
"Because it is such bad weather today, let's break backward compatibility."

This is the impression I sometimes get from the glibc maintainers. The gmon interface is highly unstable and breaks from time to time. We are rewriting gmon in Pascal to finally solve this problem structurally.

Try 2.0.4, for some people that works better than 2.1.

10-05-2007, 09:58 AM
:D Then I will wait for the re-write. It's not that important for me at the moment, therefore I can wait. Thanks for your effort.

17-05-2007, 08:36 PM
Valgrind might be another option? At least on *nix.

18-05-2007, 03:23 PM
I'm using *nix. You mean the callgrind tool from valgrind. Yeah I used that. It does its job. But I simply wanted to compare the results and see which are more accurate.