Class PerformanceViewerCollector
Hierarchy
- PerformanceViewerCollector
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
Handles the creation of a performance viewer collector.
Parameters
-
_scene: Scene
the scene to collect on.
-
Optional _enabledStrategyCallbacks: IPerformanceViewerStrategyParameter[]
the list of data to collect with callbacks for initialization purposes.
Returns PerformanceViewerCollector
-
Properties
Readonly dataset ObservableSearch playground for datasetObservable
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
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 metadata ObservableSearch playground for metadataObservable
An observable you can attach to get the most updated map of metadatas.
Accessors
has Loaded Data
-
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.
is Started
-
Returns if the perf collector has been started or not.
Returns boolean
Static Number OfPoints Offset
-
The offset for the value of the number of points inside a slice.
Returns number
Static Slice Data Offset
-
The offset for when actual data values start appearing inside a slice.
Returns number
Methods
add Collection StrategiesSearch playground for addCollectionStrategies
-
This method adds additional collection strategies for data collection purposes.
Parameters
-
Rest ...strategyCallbacks: IPerformanceViewerStrategyParameter[]
the list of data to collect with callbacks.
Returns void
-
clearSearch playground for clear
-
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
-
Disposes of the object
Returns void
export Data ToCsvSearch playground for exportDataToCsv
-
Exports the datasets inside of the collector to a csv.
Returns void
get Current SliceSearch playground for getCurrentSlice
-
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
load From File DataSearch playground for loadFromFileData
-
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.
-
register EventSearch playground for registerEvent
-
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
-
send EventSearch playground for sendEvent
-
Lets the perf collector handle an event, occurences or event value depending on if the event.value params is set.
Parameters
-
event: IPerfCustomEvent
the event to handle an occurence for
Returns void
-
startSearch playground for start
-
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
-
Stops the collection of data.
Returns void
update MetadataSearch playground for updateMetadata
-
Updates a property for a dataset's metadata with the value provided.
Type parameters
-
T: keyof IPerfMetadata
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
-
The collector class handles the collection and storage of data into the appropriate array. The collector also handles notifying any observers of any updates.