Class TCastleFrameProfiler
Unit
Declaration
type TCastleFrameProfiler = class(TObject)
Description
Profiler gathering statistics about each game frame. Useful to measure where you spend time during the game frame. In contrast to TCastleProfiler, this is not flexible to gather all possible data, or to keep all historic data. It is only specialized to gather some specific data, in each frame, to have statistics from the most recent frames.
You have to enable the statistics gathering by setting Enabled to True. That's it. In the log (see https://castle-engine.io/manual_log.php ) you will see a frame statistics, displayed after every 60 frames gathered.
Optionally, you can also report additional measurements during the frame. Do this by calling Start and Stop with String parameter, like this:
procedure TMyGameState.Update; begin FrameProfiler.Start('MyTimeConsumingOperation'); MyTimeConsumingOperation; FrameProfiler.Stop('MyTimeConsumingOperation'); end;
Use this class only through the singleton instance FrameProfiler.
The easiest way to enable this and view the data is through Castle Game Engine inspector. Just press F8 in a debug build to view it.
Source: src/base/castletimeutils_frameprofiler.inc (line 102).
Hierarchy
- TObject
- TCastleFrameProfiler
Overview
Fields
![]() |
nested const DefaultFramesForSummary = 60; |
Methods
![]() |
constructor Create; |
![]() |
procedure StartFrame; |
![]() |
procedure Start(const Metric: TFrameMetric); overload; |
![]() |
procedure Stop(const Metric: TFrameMetric); overload; |
![]() |
procedure Start(const UserMetric: String); overload; |
![]() |
procedure Stop(const UserMetric: String); overload; |
![]() |
function SummaryTotalFrameTime: TFloatTime; |
![]() |
function SummaryTime(const FrameMetric: TFrameMetric): TFloatTime; overload; |
![]() |
function SummaryTime(const UserMetric: String): TFloatTime; overload; |
Properties
![]() |
property Enabled: Boolean read FEnabled write SetEnabled; |
![]() |
property FramesForSummary: Cardinal read FFramesForSummary write FFramesForSummary
default DefaultFramesForSummary; |
![]() |
property OnSummaryAvailable: TNotifyEvent read FOnSummaryAvailable write FOnSummaryAvailable; |
![]() |
property LogSummary: Boolean read FLogSummary write FLogSummary default false; |
Description
Fields
![]() |
nested const DefaultFramesForSummary = 60; |
|
This item has no description. Source: src/base/castletimeutils_frameprofiler.inc (line 149). | |
Methods
![]() |
constructor Create; |
|
This item has no description. Source: src/base/castletimeutils_frameprofiler.inc (line 151). | |
![]() |
procedure StartFrame; |
|
This item has no description. Source: src/base/castletimeutils_frameprofiler.inc (line 155). | |
![]() |
procedure Start(const Metric: TFrameMetric); overload; |
|
This item has no description. Source: src/base/castletimeutils_frameprofiler.inc (line 156). | |
![]() |
procedure Stop(const Metric: TFrameMetric); overload; |
|
This item has no description. Source: src/base/castletimeutils_frameprofiler.inc (line 157). | |
![]() |
procedure Start(const UserMetric: String); overload; |
|
This item has no description. Source: src/base/castletimeutils_frameprofiler.inc (line 158). | |
![]() |
procedure Stop(const UserMetric: String); overload; |
|
This item has no description. Source: src/base/castletimeutils_frameprofiler.inc (line 159). | |
![]() |
function SummaryTotalFrameTime: TFloatTime; |
|
Summary of times, use only from OnSummaryAvailable. Source: src/base/castletimeutils_frameprofiler.inc (line 169). | |
![]() |
function SummaryTime(const FrameMetric: TFrameMetric): TFloatTime; overload; |
|
This item has no description. Source: src/base/castletimeutils_frameprofiler.inc (line 170). | |
![]() |
function SummaryTime(const UserMetric: String): TFloatTime; overload; |
|
This item has no description. Source: src/base/castletimeutils_frameprofiler.inc (line 171). | |
Properties
![]() |
property Enabled: Boolean read FEnabled write SetEnabled; |
|
No data is gathered when Enabled = false, the calls to StartFrame, Start, Stop are ignored then. Source: src/base/castletimeutils_frameprofiler.inc (line 154). | |
![]() |
property FramesForSummary: Cardinal read FFramesForSummary write FFramesForSummary
default DefaultFramesForSummary; |
|
Gather this many frames for a summary. Source: src/base/castletimeutils_frameprofiler.inc (line 162). | |
![]() |
property OnSummaryAvailable: TNotifyEvent read FOnSummaryAvailable write FOnSummaryAvailable; |
|
Notification when the summary is available, i.e. we have gathered FramesForSummary frames. Source: src/base/castletimeutils_frameprofiler.inc (line 175). | |
![]() |
property LogSummary: Boolean read FLogSummary write FLogSummary default false; |
|
When the summary is available, output details to log. Source: src/base/castletimeutils_frameprofiler.inc (line 178). | |
Generated by PasDoc 0.17.0.snapshot.
