Sign in Join
Wiki copytemporary

FPProfiler: what changed

Revision 3 to 4. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11## Introduction
22
33The Free Pascal Profiler is an effort to create an FPC native profiler, deployable on all platforms and architectures the Free Pascal compiler itself supports. It was initially developed by Darius Blaszyk.
44
55Free Pascal Profiler consists of two tools (fpp and fppview) and some units containing the profiling code that needs to be linked in.
66
77### FPP
88
99To compile your project, you pass the same parameters to FPP as you would to FPC. FPP then scans your source code and inserts profiling code in each begin..end block. It also amends the uses clause to link in the fpprof unit. Once done, it compiles your project, which now includes the profiling code. After that, it restores your units to their original state.
1010
1111#### FPPInsert
1212
1313This tool will only insert profiling code, nothing else. It can also do this recursively on one or more folders at a time.
1414
1515#### FPPRemove
1616
1717This tool will only remove profiling code, nothing else. It can also do this recursively on one or more folders at a time.
1818
1919### FPPView
2020
2121When you run your program that contains the profiling code, it generates an xml file containing all the profiling information. FPPView reads this xml file and generates reports from it. Call counts, timing and call graphs are supported at the moment.
2222
2323### LazProf
2424
2525A graphical frontend for Lazarus exists. For now it only is able to analyse the log files, but future versions will also enable to compile the application directly with fpp and analyse the results.
2626
2727Sample screenshots:
2828
2929![](/wiki-images/8/80/Fpprofiler_flatreport.png) ![](/wiki-images/5/56/Fpprofiler_callgraph.png) ![](/wiki-images/e/e2/Fpprofiler_memorychart.png)
3030
3131### Add or Remove fpprof calls to functions via codetools
3232
3333There is a small command line utility that adds or removes fpprof calls to start and end of functions. See Lazarus soures
3434
35-`components/codetools/examples/addfpprofcalls.lpr`
35+```text
36+components/codetools/examples/addfpprofcalls.lpr
37+```
3638
3739## Getting the sources
3840
3941Graeme Geldenhuys has created a git repository: <http://github.com/graemeg/fpprofiler>
4042
4143## Installing
4244
4345Currently building the tools from commandline is broken. To build them you should use Lazarus. Start by opening the lazarus project files:
4446
45-` .\fpp\fpp.lpi`\
46-` .\fpp\fppinsert.lpi`\
47-` .\fpp\fppremove.lpi`\
48-` .\fppview\fppview.lpi`
47+```text
48+ .\fpp\fpp.lpi
49+ .\fpp\fppinsert.lpi
50+ .\fpp\fppremove.lpi
51+ .\fppview\fppview.lpi
52+```
4953
5054and simply build the tools from the IDE. The executables will be placed in the directory:
5155
52-` .\bin\$(TargetCPU)-$(TargetOS)\`
56+```text
57+ .\bin\$(TargetCPU)-$(TargetOS)\
58+```
5359
5460To install the lazarus package, open the package file in Lazarus called:
5561
56-` .\lazprof\lazprof.lpk`
62+```text
63+ .\lazprof\lazprof.lpk
64+```
5765
5866Click on compile and then install. Lazarus will be rebuilt and additionally the package will register two menu items under:
5967
60-` View > Profile viewer`
68+```text
69+ View > Profile viewer
70+```
6171
62-` `*`Run > Run with profiling enabled`*
72+```text
73+ Run > Run with profiling enabled
74+```
6375
6476The latter command is still under development, so don't use it.
6577
6678## Platforms / architectures
6779
6880Because it is completely FPC native, it should work on all platforms and architectures that FPC supports.
6981
7082Tested platforms/architectures:
7183
7284| Platform | Architecture |
7385|----------|--------------|
7486| Linux | i386 |
7587| Windows | i386 |
7688| Mac OS X | i386 |
7789
7890People are encouraged to add their platform/architecture here if not listed.
7991
8092## Reporting bugs / feature requests
8193
8294If you find a bug and would like to report it, or you have an idea to expand fpprofiler, please report the issue in [mantis](http://bugs.freepascal.org/set_project.php?project_id=10;11) and drop a note on the FPC-devel mailinglist. This ensures the issue does not get forgotten. Of course, when a patch is provided, the issue is likely to be resolved much quicker. It's also highly recommended to provide a test program with the reported issue. This program will be added to the test suite to ensure no regressions will go unnoticed.
8395
8496## See also
8597
8698- FPC [[Profiling]] wiki page
8799- Delphi sampling profiler [1](http://delphitools.info/samplingprofiler/)
88100- GpProfiler [2](http://17slon.com/gp/gpprofile/index.htm) [3](http://code.google.com/p/gpprofile/)
89101- Asmprofiler [4](http://code.google.com/p/asmprofiler/)
90102
91103---
92104*From the Free Pascal wiki, page "FPProfiler", as it stood on 2024-01-04 after a change by Alextpp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
93105Category: Debugging
94106Category: Profiling

Back to history