Skip to main content

LensStudio:Preview.TraceSession

Class

Performance trace being recorded, returned by IPreviewProfiling.startTrace().

Index

Example

Trace the preview while it renders a few frames. Finish the session in finally so the trace is written even when a capture fails.

import { LensPreview } from 'LensStudio:LensPreview';

export async function traceFrames(preview: LensPreview, traceFile: Editor.Path, frames = 3): Promise<void> {
const session = preview.profiling.startTrace(traceFile);
if (!session) throw new Error('Another trace is already recording');
try {
for (let i = 0; i < frames; ++i) {
await preview.tryScreenshot(20000);
}
} finally {
session.finish();
}
}

Extends

Methods

finish()

finish(): void

Stops recording and writes the trace to the path given to startTrace(). The file is written asynchronously and may appear shortly after finish() returns.

Returns

void


getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ScriptObject.isOfType


isSame()

isSame(other): boolean

Returns true if this object refers to the same instance as the given object.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

ScriptObject.isSame