Class ProfilerIndex

The ProfilerSubframeIndex class acts as a way to organize data for flamegraph visualization and other UI visualizations for profiler data. It stores data captured by profiler runtime in an organized matter that is useful for visualization and other user interactions and querying. This for example computes relationships between event samples and computes aggregate data for threads. When serializing data, we only need to serialize the primary data in ProfilerDatabase - all additional information in ProfilerIndex are deduced from that primary data.

Hierarchy

  • FrameworkObject
    • ProfilerIndex

Constructors

  • Parameters

    • OptionalisInternalConstructor: boolean

    Returns ProfilerIndex

Methods

  • Removes all data that are captured by profiler, excluding generic definitions for events and attributes and such.

    Returns void

  • Finds and returns event sample based on time it intersects with and depth in event tree.

    Parameters

    • threadIdentifier: number

      Identifier of thread within whose tree this method should search for event sample.

    • nanoseconds: number

      Time that intersects with event sample that is being searched for.

    • depth: number

      Depth of event sample in event sample tree consistent with depth given in

    Returns ProfilerIndexEventSample

    Event sample that was found, or nullptr if no such event sample was found.

  • Finds and returns all event samples that intersect with given time range.

    Parameters

    • threadIdentifier: number

      Identifier of thread within whose tree this method should search for event samples.

    • nanosecondsBegin: number

      Begining of the time range that is being searched for event samples.

    • nanosecondsEnd: number

      End of the time range that is being searched for event samples.

    Returns ProfilerIndexEventSample[]

    Collection of event sample that were matched by parameters.

  • Returns the earliest frame that was recorded - the frame with the lowest frame id.

    Returns ProfilerIndexFrame

    First frame contained in this ProfilerIndex.

  • Returns identifier of first frame or 0 if no frames were inserted into this ProfilerIndex yet.

    Returns number

    FrameIdentifier of first frame in this ProfilerIndex.

  • Helper function that aggregates event sample data for flamegraph rendering for given thread. Returns vector of flamegraph entries that should be visible in given time range.

    Parameters

    • threadIdentifier: number

      Thread that should be shown in given flamegraph.

    • nanosecondsBegin: number

      First time that should be visible in the flamegraph. All event samples that end before this time will be skipped.

    • nanosecondsEnd: number

      Last time that should be visible in the flamegraph. All event samples that begin after this time will be skipped.

    Returns ProfilerIndexFlamegraphEntry[]

    Vector of flamegraph entries on given thread that intersect given time range.

  • Finds frame by frame identifier.

    Parameters

    • frameIdentifier: number

      Identifier of frame to find.

    Returns ProfilerIndexFrame

    Profiler frame data for found frame or nullptr.

  • Returns the latest frame that was recorded - the frame with the highest frame id.

    Returns ProfilerIndexFrame

    Last frame contained in this ProfilerIndex.

  • Finds a stat group with given name.

    Parameters

    • name: string

      Name of the stat group to find.

    Returns ProfilerIndexStatGroup

    Returns pointer to the required group or nullptr if the group does not exist.

  • This returns all stat groups that are defined in profiler stat metadata. Stats that don't have a specified group will have one automatically created.

    Returns ProfilerIndexStatGroup[]

    All stat groups registered in profiler index.

  • Returns indexed thread based on its identifier.

    Parameters

    • threadIdentifier: number

      Identifier of the thread that should be returned.

    Returns ProfilerIndexThread

    Found thread or nullptr if such thread was not inserted into this index.

  • Returns indexed data of all threads that were inserted into this index. These can be used to access event sample trees.

    Returns ProfilerIndexThread[]

    Vector of indexed threads.

  • Returns true if profiler index contains some captured profiling data.

    Returns boolean

    True if profiler index contains some captured profiling data, false if it is empty.

Events

onChanged: Event<[], void>

Called when some data are added or removed. This is called after all other change callbacks to inform about a change, without specifying what exactly the change is.

onDataCleared: Event<[], void>

Called when all data are removed from the index.

onEventSamplesInserted: Event<[readonly ProfilerIndexEventSample[]], void>

Called when new profiler event samples are inserted into the profiler index.

onFramesInserted: Event<[readonly ProfilerIndexFrame[]], void>

Called when new profiler frames are inserted into the profiler index.

onStatPointsInserted: Event<[Immutable<ProfilerTimeRange>], void>

Called when new stat values are inserted into the profiler index. The event has one parameter and it is the time range of newly inserted stat points. This time range is guaranteed to be higher than time of any other time point that is already in the profiler index.