type TCastleProfiler = class(TObject)
This item has no description.
| Public | TTime = class(TObject) |
| Public | TTimes = class(TTimeList) |
| Public | TTimeList = TObjectList<TTime>; |
| Public | DefaultFloatPrecision = 2; |
| Public | var FEnabled: boolean; |
| Public | FFloatPrecision: Cardinal; |
| Public | Times: TTimes; |
| Public | CurrentStack: TTimeList; |
| Public | constructor Create; |
| Public | destructor Destroy; override; |
| Public | function Summary: string; |
| Public | procedure Clear; deprecated 'This method is not reliable (may cause crashes when used between Start/Stop) and also not comfortable. To display partial profile information, better use Stop with 2nd argument true.'; |
| Public | function Start(const Description: String): TCastleProfilerTime; |
| Public | procedure Stop(const TimeStart: TCastleProfilerTime; const LogSummary: Boolean = false; const LogSummaryOnlyIfNonTrivial: Boolean = false); |
| Public | property Enabled: boolean read FEnabled write FEnabled; |
| Public | TTimeList = TObjectList<TTime>; |
|
This item has no description. | |
| Public | DefaultFloatPrecision = 2; |
|
This item has no description. | |
| Public | var FEnabled: boolean; |
|
This item has no description. | |
| Public | FFloatPrecision: Cardinal; |
|
This item has no description. | |
| Public | Times: TTimes; |
|
Collected times tree. | |
| Public | CurrentStack: TTimeList; |
|
The currently started (but not stopped) TTime structures. | |
| Public | constructor Create; |
|
This item has no description. | |
| Public | destructor Destroy; override; |
|
This item has no description. | |
| Public | function Summary: string; |
|
Summary of the gathered speed measurements. | |
| Public | procedure Clear; deprecated 'This method is not reliable (may cause crashes when used between Start/Stop) and also not comfortable. To display partial profile information, better use Stop with 2nd argument true.'; |
|
Warning: this symbol is deprecated: This method is not reliable (may cause crashes when used between Start/Stop) and also not comfortable. To display partial profile information, better use Stop with 2nd argument true. Clear currently gathered times. Do not call this when some time measure is started but not yet stopped Currently, this will cause such time measure to be rejected, and stopping it will cause a one-time warning, but don't depend on this exact behavior in the future. We will always gracefully accept this case (not crash). | |
| Public | function Start(const Description: String): TCastleProfilerTime; |
|
Start a task which execution time will be measured. You must later call Stop with the returned TCastleProfilerTime value. Typical usage looks like this: procedure TMyClass.LoadSomething; var TimeStart: TCastleProfilerTime; begin TimeStart := Profiler.Start('Loading something (TMyClass)'); try // do the time-consuming loading now... finally Profiler.Stop(TimeStart); end; end;
If you don't use the "finally" clause to always call the matching Stop, and an exception may occur in LoadSomething, then you will have an unmatched Start / Stop calls. The profiler output is undefined in this case. (However, we guarantee that the profiler will not crash or otherwise cause problems in the application.) So, you do not really have to wrap this in "try ... finally ... end" clause, if it's acceptable that the profiler output is useless in exceptional situations. See also
| |
| Public | procedure Stop(const TimeStart: TCastleProfilerTime; const LogSummary: Boolean = false; const LogSummaryOnlyIfNonTrivial: Boolean = false); |
|
Stop a task. This call must match earlier Start call. If LogSummary, and profiling is Enabled, we will output (to CastleLog) a summary of things that happened within this particular TCastleProfilerTime instance (between it's start and stop). This is useful when you are interested not only in adding this TCastleProfilerTime to the profiler tree, but also in immediately viewing the times in this TCastleProfilerTime subtree. If LogSummary and LogSummaryOnlyIfNonTrivial, then the summary will be output only if it's larger than some ignorable amount of time (right now: 1 milisecond). This is useful to output only things that take non-trivial amount of time. See also
| |
| Public | property Enabled: boolean read FEnabled write FEnabled; |
|
Whether to gather speed measurements. When not enabled, the Start and Stop methods do as little as possible to not waste time. | |