Performance
Exposes performance-related data.
Performance.swift:26class Performance
This class provides access to a number of different monitors related to performance, such as memory usage, draw calls, and FPS. These are the same as the values displayed in the Monitor tab in the editor’s Debugger panel. By using the getMonitor(_:)
method of this class, you can access this data from your code.
You can add custom monitors using the addCustomMonitor(id:callable:arguments:)
method. Custom monitors are available in Monitor tab in the editor’s Debugger panel together with built-in monitors.
Superclasses
class Object
Base class for all other classes in the engine.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
Type members
static func addCustomMonitor(id: StringName, callable: Callable, arguments: GArray
) Adds a custom monitor with the name
id
. You can specify the category of the monitor using slash delimiters inid
(for example:"Game/NumberOfNPCs"
). If there is more than one slash delimiter, then the default category is used. The default category is"Custom"
. Prints an error if givenid
is already present.static func getCustomMonitor(id: StringName
) -> Variant Returns the value of custom monitor with given
id
. The callable is called to get the value of custom monitor. See alsohasCustomMonitor(id:)
. Prints an error if the givenid
is absent.static func getCustomMonitorNames(
) -> VariantCollection<StringName> Returns the names of active custom monitors in an
GArray
.static func getMonitor(Performance.Monitor
) -> Double Returns the value of one of the available built-in monitors. You should provide one of the
Monitor
constants as the argument, like this:static func getMonitorModificationTime(
) -> UInt Returns the last tick in which custom monitor was added/removed (in microseconds since the engine started). This is set to
getTicksUsec
when the monitor is updated.static func hasCustomMonitor(id: StringName
) -> Bool Returns
true
if custom monitor with the givenid
is present,false
otherwise.static func removeCustomMonitor(id: StringName
) Removes the custom monitor with given
id
. Prints an error if the givenid
is already absent.class var godotClassName: StringName