Options
All
  • Public
  • Public/Protected
  • All
Menu

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.

Hierarchy

  • PerformanceViewerCollector

Index

Constructors

constructor

  • Handles the creation of a performance viewer collector.

    Parameters

    Returns PerformanceViewerCollector

Properties

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.

Accessors

hasLoadedData

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

isStarted

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

    Returns boolean

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

Methods

addCollectionStrategiesSearch playground for addCollectionStrategies

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

    Parameters

    Returns void

clearSearch playground for clear

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

    Parameters

    • 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, 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.

    Parameters

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

registerEventSearch playground for registerEvent

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

    Parameters

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

    Parameters

    Returns void

startSearch playground for start

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

    Parameters

    • 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

    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

Legend

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