• Public
  • Public/Protected
  • All

Class PerformanceViewerCollector

The collector class handles the collection and storage of data into the appropriate array. The collector also handles notifying any observers of any updates.


  • PerformanceViewerCollector




  • Handles the creation of a performance viewer collector.


    • _scene: Scene

      the scene to collect on.

    • Optional _enabledStrategyCallbacks: PerfStrategyInitialization[]

      the list of data to collect with callbacks for initialization purposes.

    Returns PerformanceViewerCollector


Readonly datasetObservableSearch playground for datasetObservable

datasetObservable: Observable<number[]>

An observable you can attach to get deltas in the dataset. Subscribing to this will increase memory consumption slightly, and may hurt performance due to increased garbage collection needed. Updates of slices will be of the form [timestamp, numberOfPoints, value1, value2...].

Readonly datasetsSearch playground for datasets

datasets: IPerfDatasets

Datastructure containing the collected datasets. Warning: you should not modify the values in here, data will be of the form [timestamp, numberOfPoints, value1, value2..., timestamp, etc...]

Readonly metadataObservableSearch playground for metadataObservable

metadataObservable: Observable<Map<string, IPerfMetadata>>

An observable you can attach to get the most updated map of metadatas.



  • get hasLoadedData(): boolean
  • Accessor which lets the caller know if the performance collector has data loaded from a file or not! Call clear() to reset this value.

    Returns boolean

    true if the data is loaded from a file, false otherwise.

Static NumberOfPointsOffset

  • get NumberOfPointsOffset(): number
  • The offset for the value of the number of points inside a slice.

    Returns number

Static SliceDataOffset

  • get SliceDataOffset(): number
  • The offset for when actual data values start appearing inside a slice.

    Returns number


addCollectionStrategiesSearch playground for addCollectionStrategies

  • This method adds additional collection strategies for data collection purposes.


    Returns void

clearSearch playground for clear

  • clear(preserveStringEventsRestore?: boolean): void
  • Completely clear, data, ids, and strategies saved to this performance collector.


    • Optional preserveStringEventsRestore: boolean

      if it should preserve the string events, by default will clear string events registered when called.

    Returns void

disposeSearch playground for dispose

  • dispose(): void
  • Disposes of the object

    Returns void

exportDataToCsvSearch playground for exportDataToCsv

  • exportDataToCsv(): void
  • Exports the datasets inside of the collector to a csv.

    Returns void

getCurrentSliceSearch playground for getCurrentSlice

  • getCurrentSlice(): void
  • Collects and then sends the latest slice to any observers by using the appropriate strategy when the user wants. The slice will be of the form [timestamp, numberOfPoints, value1, value2...] This method does not add onto the collected data accessible via the datasets variable.

    Returns void

loadFromFileDataSearch playground for loadFromFileData

  • loadFromFileData(data: string): boolean
  • Given a string containing file data, this function parses the file data into the datasets object. It returns a boolean to indicate if this object was successfully loaded with the data.


    • data: string

      string content representing the file data.

    Returns boolean

    true if the data was successfully loaded, false otherwise.

registerEventSearch playground for registerEvent

  • registerEvent(name: string, forceUpdate?: boolean): IPerfCustomEvent | undefined
  • Registers a custom string event which will be callable via sendEvent. This method returns an event object which will contain the id of the event. The user can set a value optionally, which will be used in the sendEvent method. If the value is set, we will record this value at the end of each frame, if not we will increment our counter and record the value of the counter at the end of each frame. The value recorded is 0 if no sendEvent method is called, within a frame.


    • name: string

      The name of the event to register

    • Optional forceUpdate: boolean

      if the code should force add an event, and replace the last one.

    Returns IPerfCustomEvent | undefined

    The event registered, used in sendEvent

sendEventSearch playground for sendEvent

  • Lets the perf collector handle an event, occurences or event value depending on if the event.value params is set.


    Returns void

startSearch playground for start

  • start(shouldPreserve?: boolean): void
  • Starts the realtime collection of data.


    • Optional shouldPreserve: boolean

      optional boolean param, if set will preserve the dataset between calls of start.

    Returns void

stopSearch playground for stop

  • stop(): void
  • Stops the collection of data.

    Returns void

updateMetadataSearch playground for updateMetadata

  • updateMetadata<T>(id: string, prop: T, value: IPerfMetadata[T]): void
  • Updates a property for a dataset's metadata with the value provided.

    Type parameters


    • id: string

      the id of the dataset which needs its metadata updated.

    • prop: T

      the property to update.

    • value: IPerfMetadata[T]

      the value to update the property with.

    Returns void


  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method