Difference between revisions of "ProfilingResult class"
CGHelpdesk (talk | contribs) (Created page with "{{CGscriptClass_Template |Name=<nowiki>ProfilingResult</nowiki> |Description=<nowiki>Class to view the current result of the profiling done.</nowiki> |Constructors= {{CGscriptCon...") |
|||
(4 intermediate revisions by one other user not shown) | |||
Line 2: | Line 2: | ||
|Name=<nowiki>ProfilingResult</nowiki> | |Name=<nowiki>ProfilingResult</nowiki> | ||
|Description=<nowiki>Class to view the current result of the profiling done.</nowiki> | |Description=<nowiki>Class to view the current result of the profiling done.</nowiki> | ||
− | |Constructors= | + | |InheritsFrom=object|Constructors= |
{{CGscriptConstructors_Template|Description=<nowiki>Get result of current script</nowiki>}} | {{CGscriptConstructors_Template|Description=<nowiki>Get result of current script</nowiki>}} | ||
|Methods= | |Methods= | ||
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Reset</nowiki>|Description=<nowiki>Remove all profiling results.</nowiki>}} | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Reset</nowiki>|Description=<nowiki>Remove all profiling results.</nowiki>}} | ||
− | {{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>The string representation of the object.</nowiki>}} | + | {{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Inherited=object|Description=<nowiki>The string representation of the object.</nowiki>}} |
|Properties= | |Properties= | ||
− | {{CGscriptProperties_Template|ReturnType= | + | {{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>CompileTime</nowiki>|HasGetter=1|Description=<nowiki>Number of milliseconds spent on parsing script. Always recorded even if profiling has not been enabled.</nowiki>}} |
{{CGscriptProperties_Template|ReturnType=Dictionary|Name=<nowiki>CountResult</nowiki>|HasGetter=1|Description=<nowiki>Dictionary of line number and dictionary of line position and number of times executed. Lines not executed are not reported</nowiki>}} | {{CGscriptProperties_Template|ReturnType=Dictionary|Name=<nowiki>CountResult</nowiki>|HasGetter=1|Description=<nowiki>Dictionary of line number and dictionary of line position and number of times executed. Lines not executed are not reported</nowiki>}} | ||
− | {{CGscriptProperties_Template|ReturnType= | + | {{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>DependencyGraphTime</nowiki>|HasGetter=1|Description=<nowiki>Number of milliseconds spent on calculating where expressions in bulk. Always recorded even if profiling has not been enabled.</nowiki>}} |
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>EnableProfiling</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>When set to true the duration and number of times a statement is executed is recorded.</nowiki>}} | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>EnableProfiling</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>When set to true the duration and number of times a statement is executed is recorded.</nowiki>}} | ||
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}} | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}} | ||
− | {{CGscriptProperties_Template|ReturnType= | + | {{CGscriptProperties_Template|ReturnType=Array of strings|Name=<nowiki>Script</nowiki>|HasGetter=1|Description=<nowiki>Array of lines in input script.</nowiki>}} |
+ | {{CGscriptProperties_Template|ReturnType=Dictionary|Name=<nowiki>SlowLines</nowiki>|HasGetter=1|Description=<nowiki>Dictionary of line number and time it took. Does not report lines that took less than 100msec</nowiki>}} | ||
{{CGscriptProperties_Template|ReturnType=Dictionary|Name=<nowiki>TimeResult</nowiki>|HasGetter=1|Description=<nowiki>Dictionary of line number and dictionary of line position (-1 == whole line) and time spent in milliseconds. Lines not executed are not reported</nowiki>}} | {{CGscriptProperties_Template|ReturnType=Dictionary|Name=<nowiki>TimeResult</nowiki>|HasGetter=1|Description=<nowiki>Dictionary of line number and dictionary of line position (-1 == whole line) and time spent in milliseconds. Lines not executed are not reported</nowiki>}} | ||
− | {{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}} | + | {{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType= | + | {{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>WhereExpTime</nowiki>|HasGetter=1|Description=<nowiki>Number of milliseconds spent on calculating where expressions in bulk. Always recorded even if profiling has not been enabled.</nowiki>}} |
}} | }} | ||
+ | |||
+ | === Examples === | ||
+ | |||
+ | <source lang="javascript"> | ||
+ | ProfilingResult pr; | ||
+ | pr.EnableProfiling = true; | ||
+ | for(number i = 0; i < 100; i=i+1) | ||
+ | ; | ||
+ | print(pr.CompileTime); // 0.1198 | ||
+ | print(pr.CountResult); // {"4": {"0": 1, "4": 1}, "5": {"0": 100}, "7": {"4": 1}} | ||
+ | print(pr.DependencyGraphTime); // 0 | ||
+ | print(pr.TimeResult); // {"4": {"0": 0.0827, "-1": 0.0844, "4": 0.0017}, "5": {"0": 0.0102, "-1": 0.0102}, "7": {"-1": 0.006, "4": 0.006}, "8": {"-1": 0.0209, "4": 0.0209}, "9": {"-1": 0.0022, "4": 0.0022}} | ||
+ | print(pr.WhereExpTime); // 0 | ||
+ | </source> |
Latest revision as of 06:24, 2 July 2020
ProfilingResult
Class to view the current result of the profiling done.
Parent class
Inherits from object
Constructors
- () - Get result of current script
Methods
- Empty Reset() - Remove all profiling results.
- (From object) string ToString() - The string representation of the object.
Properties
- number CompileTime { get; } - Number of milliseconds spent on parsing script. Always recorded even if profiling has not been enabled.
- Dictionary CountResult { get; } - Dictionary of line number and dictionary of line position and number of times executed. Lines not executed are not reported
- number DependencyGraphTime { get; } - Number of milliseconds spent on calculating where expressions in bulk. Always recorded even if profiling has not been enabled.
- bool EnableProfiling { get; set; } - When set to true the duration and number of times a statement is executed is recorded.
- string ObjectTypeName { get; } - The name of the type of object.
- Array of string Script { get; } - Array of lines in input script.
- Dictionary SlowLines { get; } - Dictionary of line number and time it took. Does not report lines that took less than 100msec
- Dictionary TimeResult { get; } - Dictionary of line number and dictionary of line position (-1 == whole line) and time spent in milliseconds. Lines not executed are not reported
- (From object) TypeInformation TypeInformation { get; } - Get information about this class.
- number WhereExpTime { get; } - Number of milliseconds spent on calculating where expressions in bulk. Always recorded even if profiling has not been enabled.
Examples
ProfilingResult pr;
pr.EnableProfiling = true;
for(number i = 0; i < 100; i=i+1)
;
print(pr.CompileTime); // 0.1198
print(pr.CountResult); // {"4": {"0": 1, "4": 1}, "5": {"0": 100}, "7": {"4": 1}}
print(pr.DependencyGraphTime); // 0
print(pr.TimeResult); // {"4": {"0": 0.0827, "-1": 0.0844, "4": 0.0017}, "5": {"0": 0.0102, "-1": 0.0102}, "7": {"-1": 0.006, "4": 0.006}, "8": {"-1": 0.0209, "4": 0.0209}, "9": {"-1": 0.0022, "4": 0.0022}}
print(pr.WhereExpTime); // 0