Class TCastleProfiler
Unit
Declaration
type TCastleProfiler = class(TObject)
Description
Profiler, to measure the speed of execution of your code. This is usually used only through the singleton Profiler.
The profiler is automatically used by various Castle Game Engine loading routines. It presents the easiest way to answer questions like "which game asset is the most expensive to load".
To get the profile:
Set
EnabledtoTrueas early as possible, like in the "initialization" section of your main game unit.The engine will automatically send to log a profile after
TCastleApplication.OnInitializefinished, which is a usual place when loading takes place in simple CGE applications.You don't need to do anything, just make sure you have logging enabled (call InitializeLog).
You can display the profile
Summaryat any point in your application, in any way you like. For example byWritelnLogMultiline('Time Profile', Profiler.Summary);An alternative way to display the profile is to pass
Trueas a 2nd argument to anyStopcall. This allows to display a profile limited to givenStart..Stoppair.
To send your own time information to the profile, call Start and Stop methods around a given time-consuming task. We will measure time and automatically build a tree of tasks (when one larger task contains several smaller tasks).
Contrary to profilers like Valgrind or Gprof (see https://castle-engine.io/optimization#_profile_measure_speed_and_memory_usage , https://castle-engine.io/profiling_using_valgrind ), this profiler does not automatically gather everything. On the other hand, this profiler works on all platforms supported by CGE, and is trivial to use.
Source: base/castletimeutils_profiler.inc (line 97).
Hierarchy
- TObject
- TCastleProfiler
Generated by PasDoc 0.17.0.snapshot.