LensStudio:Preview.TraceSession
ClassPerformance 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()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean