Skip to content

$trace

7 natives. Read-only natives only look things up; the rest change something. Parameter types use the language's names (Types).

begin_capture

$trace.begin_capture(capture_chrome_trace: bool, capture_summary: bool, capture_platform: bool, only_on_ticks_per_frame: int, stream_summary: bool, summary_path: string, package: var)

Start capturing performance information.

ParameterTypeMeaning
capture_chrome_traceboolIf true, start capturing a Chrome trace.
capture_summaryboolIf true, start capturing summary performance stats.
capture_platformboolIf true, start recording a platform profile.
only_on_ticks_per_frameintIf non-zero, only captures summary data on frames that ticked the specified number of times.
stream_summaryboolIf true, start streaming summary performance stats to a CSV file.
summary_pathstringOptional path of the CSV file to write. If no path provided, but a package is provided, writes to '/out/perf.PLATFORM.BUILD.LEVEL.csv'. Otherwise writes to '/out/perf.PLATFORM.BUILD.csv'
packagevarReference to a package file used for naming. Or string name.

counter

$trace.counter(name: string, category: string, value: int)

Record a named counter value in the performance tracing system.

ParameterTypeMeaning
namestringName of the counter.
categorystringCategory of the counter. If none provided, assumed to be 'sim'.
valueintValue of the counter.

end_capture

$trace.end_capture(capture_chrome_trace: bool, trace_path: string, package: var)

Stop capturing performance information.

ParameterTypeMeaning
capture_chrome_traceboolIf true, write a Chrome trace.
trace_pathstringOptional path of the trace to write. Paths ending in '.json.gz' will write gzipped JSON. All other paths will write uncompressed JSON. If no path provided, but a package is provided, writes to '/out/trace.PLATFORM.BUILD.LEVEL.json.gz'. Otherwise writes to '/out/trace.PLATFORM.BUILD.json.gz'
packagevarReference to a package file used for naming. Or string name.

pop_duration

$trace.pop_duration()

Stop timing a section of script in the performance tracing system.

push_duration

$trace.push_duration(name: string, category: string)

Start timing a section of script in the performance tracing system. Important: you must make a balanced number of push and pop operations. Do not attempt to hold a duration open across a frame.

ParameterTypeMeaning
namestringName of the duration.
categorystringCategory of the duration. If none provided, assumed to be 'sim'.

write_performance_summary_for_vci

$trace.write_performance_summary_for_vci(package: var)

Write a performance summary to a JSON file for VCI to process.

ParameterTypeMeaning
packagevarReference to a package file used for naming. Or string name.