[fpc-devel] internal profiler 2

Aleš Katona ales at chello.sk
Thu Sep 7 12:54:05 CEST 2006


Today I tried to find the reason behind Lazarus GTK2 slowdowns by using
profilers. After both failed me (callgrind crashed with stabs info error
and gprof reported things which didn't get called {writeln was in to
test}) I tought it might not be such a bad idea to make a simple
internal (ala -ghl style) profiler which would generate some sort of
binary info file (which could then be read by various front-ends)

The idea behind fist instance I have is to do something like -Cr for
example. Put some code before and after every function/method call.

I'm asking if this is possible (even if you don't want it in normal fpc)
without too much work. Eg: is is possible to take some code-generator
class, and find this "CALL" handler and somehow make it insert code
before and after without much fuzz?

Also, is it possible to do this using only pascal? (so all platforms
would work, eg: "insert this function before every CALL and this
function after every CALL" or is translation on ASM level required? {and
thus each OS and platform would need translation and testing})

I know it's more complicated than this, but if there's some usable
interface I could use to the CG I might give it a shot.

Ales





More information about the fpc-devel mailing list