[fpc-pascal] Basics of profiling -- some comments on fpprofiler bugs
Darius Blaszyk
dhkblaszyk at zeelandnet.nl
Fri Sep 17 00:28:36 CEST 2010
On Mon, 2010-09-06 at 16:58 +0300, Žilvinas Ledas wrote:
> 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 :)
I have added some tests for all the issues you describe above (asm /
ifdef and case). According to me only asm seems to be not working
correctly. Could you have a look and run the tests to see if you get the
same issue? If confirmed I will work on fixing asm (and any other issue
that pops up).
Regards, Darius
More information about the fpc-pascal
mailing list