-
Notifications
You must be signed in to change notification settings - Fork 282
Profiling
FMXExpress edited this page Oct 15, 2020
·
2 revisions
Profiling a source file can be done using the following steps:
- Create (Ctrl+N) or open (Ctrl+O) a source file.
- At Tools >> Compiler Options, select a compiler set that supports profiling (-pg).
- Click Profile Analysis (next to the Debug button) to compile and profile the currently visible file. When closing the created program, a timing analysis will open.
Profiling a project file can be done using the following steps:
- Create (Ctrl+N) or open (Ctrl+O) a source file.
- At Tools >> Compiler Options, select a compiler set that supports profiling (-pg).
- Click Profile Analysis (next to the Debug button) to compile and profile the project.
- When closing the created program, a timing analysis will open.
- Only functions that consume more than 0.01 second of CPU time will show up in the analysis.
- When changing compiler sets, make sure to rebuild before profiling.
- Optimization (-Ox) can remove code that yields no net change. One should be careful when profiling these kinds of code:
tbefore = GetTime();
DoSomething();
tdiff = GetTime() - tbefore;
- If the function DoSomething() does not affect output in any way and when other code is independent from it, the call to it can be removed by the compiler and tdiff will be zero! Consider printing something calculated inside DoSomething() after calculating tdiff. This way, other code will be dependent on DoSomething() because you print some result of it afterwards.
- The strip flag (-s) will remove profiling information added by -pg. Consider disabling it.