VISU - PHP Game Framework

CompatGPUProfiler
in package
implements ProfilerInterface

This profiler represents a backwards compatibilty / legacy profiler for mainly MacOS. MacOS dropped support for GL_TIMESTAMP queries and now just returns the result 0 wihtout any error. This profiler will use the blocking glBeginQuery / glEndQuery calls instead. Which suck for performance, not being able to nest etc. But it's better than nothing.

Table of Contents

Interfaces

ProfilerInterface

Properties

$enabled  : bool
Enable / disable the profiler
$sampleCount  : int
The number of samples collected for each query.
$cpuScopeSampleCount  : array<string, int>
An array of CPU sample counts per scope This is because every scope can have multiple samples per frame
$cpuTimeElapsed  : array<string, array<string|int, int>>
An array CPU time samples for each scope
$cpuTimeElapsedFrame  : array<string, array<string|int, int>>
Because we can make multiple mesurements per frame, we store the individual CPU time samples here They will be summed into the "cpuTimeElapsed" array when finalize() is called
$currentScope  : string|null
The currently profiled scope
$gpuScopeSampleCount  : array<string, int>
An array of GPU sample counts per scope This is because every scope can have multiple samples per frame
$gpuTimeElapsed  : array<string, array<string|int, int>>
An array of elapsed time samples for each scope
$gpuTriangles  : array<string, array<string|int, int>>
An array of triangle samples for each scope
$queries  : array<string, array<string|int, array<int, int>>>
An array of query handles per scope
$sampledScopes  : array<string|int, string>
An array of scopes that have been sampled within the current frame This array is generated based on the "startedScopes" array when finalize() is called
$scopeCpuStart  : int|null
The CPU time when the current scope was started
$startedScopes  : array<string|int, string>
An array of scopes that have been started in the current frame

Methods

end()  : void
Ends the current profiling scope
finalize()  : void
Finalizes the profiling and fetches the results from the GPU
getAverageCpuTime()  : float
Returns the average CPU time for the given scope
getAverageGpuTime()  : float
Returns the average GPU time for the given scope
getAveragesPerScope()  : array<string, array<string, float|int>>
Returns the averages for each scope and metric
getAverageTriangleCount()  : float
Returns the average triangle count for the given scope
getSampledScopes()  : array<string|int, string>
Returns an array of sampled scopes for the current frame
start()  : void
Starts a profiling scope

Properties

$sampleCount

The number of samples collected for each query.

public int $sampleCount = 64

$cpuScopeSampleCount

An array of CPU sample counts per scope This is because every scope can have multiple samples per frame

private array<string, int> $cpuScopeSampleCount = []

$cpuTimeElapsed

An array CPU time samples for each scope

private array<string, array<string|int, int>> $cpuTimeElapsed = []

$cpuTimeElapsedFrame

Because we can make multiple mesurements per frame, we store the individual CPU time samples here They will be summed into the "cpuTimeElapsed" array when finalize() is called

private array<string, array<string|int, int>> $cpuTimeElapsedFrame = []

$currentScope

The currently profiled scope

private string|null $currentScope = null

$gpuScopeSampleCount

An array of GPU sample counts per scope This is because every scope can have multiple samples per frame

private array<string, int> $gpuScopeSampleCount = []

$gpuTimeElapsed

An array of elapsed time samples for each scope

private array<string, array<string|int, int>> $gpuTimeElapsed = []

$gpuTriangles

An array of triangle samples for each scope

private array<string, array<string|int, int>> $gpuTriangles = []

$queries

An array of query handles per scope

private array<string, array<string|int, array<int, int>>> $queries = []

$sampledScopes

An array of scopes that have been sampled within the current frame This array is generated based on the "startedScopes" array when finalize() is called

private array<string|int, string> $sampledScopes = []

$scopeCpuStart

The CPU time when the current scope was started

private int|null $scopeCpuStart = null

$startedScopes

An array of scopes that have been started in the current frame

private array<string|int, string> $startedScopes = []

Methods

end()

Ends the current profiling scope

public end(string $scope) : void
Parameters
$scope : string

The name of the scope to end

finalize()

Finalizes the profiling and fetches the results from the GPU

public finalize() : void

getAverageCpuTime()

Returns the average CPU time for the given scope

public getAverageCpuTime(string $scope) : float
Parameters
$scope : string
Return values
float

getAverageGpuTime()

Returns the average GPU time for the given scope

public getAverageGpuTime(string $scope) : float
Parameters
$scope : string
Return values
float

getAveragesPerScope()

Returns the averages for each scope and metric

public getAveragesPerScope() : array<string, array<string, float|int>>
Return values
array<string, array<string, float|int>>

getAverageTriangleCount()

Returns the average triangle count for the given scope

public getAverageTriangleCount(string $scope) : float
Parameters
$scope : string
Return values
float

getSampledScopes()

Returns an array of sampled scopes for the current frame

public getSampledScopes() : array<string|int, string>
Return values
array<string|int, string>

start()

Starts a profiling scope

public start(string $scope) : void
Parameters
$scope : string

        
On this page

Search results