[fpc-pascal] Basics of profiling -- some comments on fpprofiler bugs

Žilvinas Ledas zilvinas.ledas at dict.lt
Mon Sep 6 15:58:24 CEST 2010


  On 2010-09-06 15:48, Darius Blaszyk wrote:
> On Mon, 2010-09-06 at 13:01 +0200, Graeme Geldenhuys wrote:
>> Recently I took a look at Darius's old project 'fpprofiler. Links
>> below.  It was over 2 years since anybody worked on it, and riddled
>> with bugs. I fixed all memory leaks, added some improvements, and used
>> the new fcl-passrc code included with FPC Trunk (though it only uses
>> the tokenizer for speed reasons, so FPC 2.4.x should work to - maybe
>> with minor one line code change).
> I've tested fpprofiler on FPC 2.4 and it works, provided the fcl-passrc
> is from 2.5.1. I'll add this folder as external to the SVN repository.
Few notes (parts that need some improvement):
1) fpp.pp needs at least tkAsm in "case tokenlist[i].token of" in 
"procedure ModifyCode(AFileName: string; tokenlist: TPasTokenList);"
2) it works wrong with ifdef's (it leaves only ELSE code) -- (I modified 
my copy to output comments as well and had to "modify" pscanner.pp to 
have directives as simple comments);
3) in "procedure TPasTokenList.SaveToFile(const AFileName: string);" no 
need for writeLN's - writes are enough;
4) Asm procedures are handeled wrong (fpprof_exit_profile; is inserted 
before end;)
function IsCPUID_Available : Boolean; register; assembler;
asm
   ...
end;
5) records with cases (or some other type) is handeled wrong 
(fpprof_exit_profile; is inserted before end;) -- I don't remember what 
type it was exactly.

In my opinion 2) is the biggest problem now :)

P. S. These comments are with Graemes changes.
P. P. S. Good luck with improvements and updates!

Regards
Žilvinas




More information about the fpc-pascal mailing list