[fpc-pascal] Trying to use gprof profiler, but linking keeps failing

Martin Frb lazarus at mfriebe.de
Sun Mar 22 20:24:38 CET 2026


On 22/03/2026 19:02, mailinglists--- via fpc-pascal wrote:
> On 2026-03-22 07:28, Martin Frb via fpc-pascal wrote:
>>
>> May I be so curious to ask how the results compared to valgrind?
>
> I went back to the same commit and retested with Valgrind. The 
> profiling results were very close: 84% (gprof) vs. 80% (Valgrind) of 
> call time spent in one method. Both reported the same overall issue. 
> Valgrind also listed other methods, but they primarily lead up to the 
> actual performance culprit. Overall, I felt gprof provided clearer 
> results.
>
> The biggest difference, however, was performance. With gprof, the 
> application runs normally; I couldn't visually observe a noticeable 
> runtime difference compared to when profiling is disabled. With 
> Valgrind, it’s like playing a game at 2 FPS vs. the normal 60 FPS. It 
> is nearly unusable in comparison.

Well, about what I would have expected. I don't know gprof, never took 
the time to set it up, but I am using valgrind.

I would expect gprof to have less granularity, so it will concentrate on 
the big issues, which is ok.
What I like with valgrind is, that sometimes I can even get results for 
individual lines in a routine.

Don't know if you know, but in case, if you ever need it, one useful 
trick: Start valgrind with profiling disabled. then enable it just 
before you start the code that needs to be profiled, and disable it as 
soon as it finishes (well yes, that means a few minutes of eager 
waiting). But that way you remove any other execution from the result.



More information about the fpc-pascal mailing list