summaryrefslogtreecommitdiff
path: root/doc/classes
diff options
context:
space:
mode:
authorsimpu <id.simpu@gmail.com>2020-06-04 18:48:57 +0530
committersimpu <id.simpu@gmail.com>2020-06-29 17:20:29 +0530
commitbfadb882b1d7aecd47020e177b5352638f078a75 (patch)
treebf0e00d9259ebe01da701e9a3066af3f3d3174bd /doc/classes
parent9fc65fd1f15b2ae2e26cf69c54819e7d6598fa05 (diff)
Added Custom Performance Monitor and feature to read intermediate values of Monitor
Custom monitors can be added/removed/checked using `Performance.add_custom_monitor`/`Performance.remove_custom_monitor`/`Performance.has_custom_monitor` The value can be viewed in the `Monitor` tab of Debugger. Text before `/` is used to categorize the custom monitor. `EditorPerformanceProfiler` class is created to separate logic from `ScriptEditorDebugger` User can click on the graph of monitors to read the value at that point. Graph includes intermediate base lines.
Diffstat (limited to 'doc/classes')
-rw-r--r--doc/classes/Performance.xml69
1 files changed, 69 insertions, 0 deletions
diff --git a/doc/classes/Performance.xml b/doc/classes/Performance.xml
index 2a0c153267..0a9079ce71 100644
--- a/doc/classes/Performance.xml
+++ b/doc/classes/Performance.xml
@@ -5,12 +5,55 @@
</brief_description>
<description>
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 [b]Monitor[/b] tab in the editor's [b]Debugger[/b] panel. By using the [method get_monitor] method of this class, you can access this data from your code.
+ You can add custom monitors using the [method add_custom_monitor] method. Custom monitors are available in [b]Monitor[/b] tab in the editor's [b]Debugger[/b] panel together with built-in monitors.
[b]Note:[/b] A few of these monitors are only available in debug mode and will always return 0 when used in a release build.
[b]Note:[/b] Many of these monitors are not updated in real-time, so there may be a short delay between changes.
+ [b]Note:[/b] Custom monitors do not support negative values. Negative values are clamped to 0.
</description>
<tutorials>
</tutorials>
<methods>
+ <method name="add_custom_monitor">
+ <return type="void">
+ </return>
+ <argument index="0" name="id" type="StringName">
+ </argument>
+ <argument index="1" name="callable" type="Callable">
+ </argument>
+ <argument index="2" name="arguments" type="Array" default="[ ]">
+ </argument>
+ <description>
+ Adds a custom monitor with name same as id. You can specify the category of monitor using '/' in id. If there are more than one '/' then default category is used. Default category is "Custom".
+ [codeblock]
+ Performance.add_custom_monitor("MyCategory/MyMonitor", some_callable) # Adds monitor with name "MyName" to category "MyCategory"
+ Performance.add_custom_monitor("MyMonitor", some_callable) # Adds monitor with name "MyName" to category "Custom"
+ # Note: "MyCategory/MyMonitor" and "MyMonitor" have same name but different ids so above code is valid
+ Performance.add_custom_monitor("Custom/MyMonitor", some_callable) # Adds monitor with name "MyName" to category "Custom"
+ # Note: "MyMonitor" and "Custom/MyMonitor" have same name and same category but different ids so above code is valid
+ Performance.add_custom_monitor("MyCategoryOne/MyCategoryTwo/MyMonitor", some_callable) # Adds monitor with name "MyCategoryOne/MyCategoryTwo/MyMonitor" to category "Custom"
+ [/codeblock]
+ The debugger calls the callable to get the value of custom monitor. The callable must return a number.
+ Callables are called with arguments supplied in argument array.
+ [b]Note:[/b] It throws an error if given id is already present.
+ </description>
+ </method>
+ <method name="get_custom_monitor">
+ <return type="Variant">
+ </return>
+ <argument index="0" name="id" type="StringName">
+ </argument>
+ <description>
+ Returns the value of custom monitor with given id. The callable is called to get the value of custom monitor.
+ [b]Note:[/b] It throws an error if the given id is absent.
+ </description>
+ </method>
+ <method name="get_custom_monitor_names">
+ <return type="Array">
+ </return>
+ <description>
+ Returns the names of active custom monitors in an array.
+ </description>
+ </method>
<method name="get_monitor" qualifiers="const">
<return type="float">
</return>
@@ -23,6 +66,32 @@
[/codeblock]
</description>
</method>
+ <method name="get_monitor_modification_time">
+ <return type="int">
+ </return>
+ <description>
+ Returns the last tick in which custom monitor was added/removed.
+ </description>
+ </method>
+ <method name="has_custom_monitor">
+ <return type="bool">
+ </return>
+ <argument index="0" name="id" type="StringName">
+ </argument>
+ <description>
+ Returns true if custom monitor with the given id is present otherwise returns false.
+ </description>
+ </method>
+ <method name="remove_custom_monitor">
+ <return type="void">
+ </return>
+ <argument index="0" name="id" type="StringName">
+ </argument>
+ <description>
+ Removes the custom monitor with given id.
+ [b]Note:[/b] It throws an error if the given id is already absent.
+ </description>
+ </method>
</methods>
<constants>
<constant name="TIME_FPS" value="0" enum="Monitor">