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.

TODO: In the future we plan to implement UI to automatically show this in a pretty manner, like TCastleDebugOverlay .

Hierarchy

  • TObject
  • TCastleFrameProfiler

Overview

Methods

Public constructor Create;
Public procedure StartFrame;
Public procedure Start(const Metric: TFrameMetric);
Public procedure Stop(const Metric: TFrameMetric);
Public procedure Start(const UserMetric: String);
Public procedure Stop(const UserMetric: String);

Properties

Public property Enabled: Boolean read FEnabled write FEnabled;

Description

Methods

Public constructor Create;
 
Public procedure StartFrame;
 
Public procedure Start(const Metric: TFrameMetric);
 
Public procedure Stop(const Metric: TFrameMetric);
 
Public procedure Start(const UserMetric: String);
 
Public procedure Stop(const UserMetric: String);
 

Properties

Public property Enabled: Boolean read FEnabled write FEnabled;

No data is gathered when Enabled = false, the calls to StartFrame, Start, Stop are ignored then.


Generated by PasDoc 0.15.0.