Profiling

The profiler is a tool that gives dynamic execution time information. It is very useful to detect which parts of a program need to be optimized most.

To use the profiler, the first thing to do is to enable it.

To enable the profiler:

  • Open the Project Settings dialog.
  • In the Target section, enable Profile.
  • Click OK.
  • You must recompile your project for the changes to take effect.

By default the profiler will profile the entire program. However it is possible to enable or disable the profiler on certain clusters only. To do this:

  • Open the Project Settings dialog.
  • In the Clusters property, check the Profile boolean value in the clusters where you want the profiler to be enabled.
  • Click Apply or OK.
  • You must recompile your project for the changes to take effect.

It is also possible to dynamically start and stop the profiler in a program. To do this:

Tip: To profile only part of a program, turn off the profiler at the very beginning of the program, turn it on just before the part of the code that should be profiled, and turn it back off after this section. Typically, it results in the following code:

In the root feature:

local ps: PROFILING_SETTING -- Other local variables if necessary. do create ps.make ps.stop_profiling -- Real program execution. ps.start_profiling end

And in the feature(s) that needs to be profiled: local ps: PROFILING_SETTING -- Other local variables if necessary. do create ps.make ps.start_profiling -- What needs to be profiled. ps.stop_profiling end

Note: Even if the profiler should only work in certain sections of code, the Profiling check box of the Projects Settings dialog must be checked or the profile option must be set on certain clusters.

Once the profiler has been enabled and the program has been recompiled, it is necessary to launch the program.

Tip: It is possible to profile debuggable(frozen/melted) executables as well as finalized ones. It is more interesting to profile finalized executables, though, since the execution speed is more representative of what will be obtained by your end users.

When the program exits, a file named 'profinfo' should be generated next to it.

All that's left to do is launch the Profiler wizard and follow the instructions.

See Also:
Generating executables
Running a program
Tuning a program

cached: 11/21/2024 8:50:56.000 AM