• Public
  • Public/Protected
  • All

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.


    Returns PerformanceViewerCollector


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...].

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...]

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.

  • get isStarted(): boolean
  • Returns if the perf collector has been started or not.

    Returns boolean

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

    Returns number

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

    Returns number


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


    Returns void

  • 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

  • dispose(): void
  • Disposes of the object

    Returns void

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

    Returns void

  • 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

  • loadFromFileData(data: string, keepDatasetMeta?: boolean): 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.

    • Optional keepDatasetMeta: boolean

      if it should use reuse the existing dataset metadata

    Returns boolean

    true if the data was successfully loaded, false otherwise.

  • registerEvent(name: string, forceUpdate?: boolean, category?: string): undefined | IPerfCustomEvent
  • 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.

    • Optional category: string

      the category for that event

    Returns undefined | IPerfCustomEvent

    The event registered, used in sendEvent

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


    Returns void

  • 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

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

    Returns void

  • 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
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Method
  • Static method