Class ProfilerEvent

The ProfilerEvent class is a definition for events and class to start recording them.

Simple usage:

	ProfilerEvent.sample("Editor Update", () => { .. my code ..}))

Setting an attribute:

	ProfilerEvent.sample("Editor Update", (eventSample) => {
		... my code ...
		eventSample.setAttribute("Objects updated", objectCount);
	}

Better performance:

	static eventEditorUpdate = new ProfilerEvent("Editor update");
	ProfilerEvent.sample(eventEditorUpdate, () => { .. my code ..}))

Better performance with an attribute:

	private static eventEditorUpdate = new ProfilerEvent("Editor update");
	private static attributeObjectsUpdated = new ProfilerAttribute("Objects updated");
	ProfilerEvent.sample(eventEditorUpdate, (eventSample) => {
		... my code ...
		eventSample.setAttribute(attributeObjectsUpdated, objectCount);
	}

Constructors

  • Constructs event with given name and adds it to static map.

    Parameters

    • name: string

      User-friendly name of this event.

    Returns ProfilerEvent

Properties

identifier: number

Identifier of profiler event that is unique within the script events provider.

name: string

User-friendly name of profiler event.

_markers: Map<string, ProfilerEvent>

Methods

  • Returns object that starts measuring the event. This has better performance because the ProfilerEvent instance is explicitly available here.

    Parameters

    • eventDefinition: ProfilerEvent

      Instance of profiler event to be sampled.

    Returns ProfilerEventSample

  • Returns profiler marker by name.

    Parameters

    • name: string

      Name of the event to be found and returned.

    Returns ProfilerEvent

  • Returns object that starts measuring the event. This provides slightly worse performance because the event object first needs to be found in a string map.

    Type Parameters

    • T

    Parameters

    Returns T