Options
All
  • Public
  • Public/Protected
  • All
Menu

This class is used to track a performance counter which is number based. The user has access to many properties which give statistics of different nature.

The implementer can track two kinds of Performance Counter: time and count. For time you can optionally call fetchNewFrame() to notify the start of a new frame to monitor, then call beginMonitoring() to start and endMonitoring() to record the lapsed time. endMonitoring takes a newFrame parameter for you to specify if the monitored time should be set for a new frame or accumulated to the current frame being monitored. For count you first have to call fetchNewFrame() to notify the start of a new frame to monitor, then call addCount() how many time required to increment the count value you monitor.

Hierarchy

  • PerfCounter

Index

Constructors

  • Creates a new counter

    Returns PerfCounter

Properties

Enabled: boolean

Gets or sets a global boolean to turn on and off all the counters

Accessors

  • get average(): number
  • Returns the average value since the performance counter is running

    Returns number

  • get count(): number
  • Gets the total value count

    Returns number

  • get current(): number
  • Returns the current value

    Returns number

  • get lastSecAverage(): number
  • Returns the average value of the last second the counter was monitored

    Returns number

  • get max(): number
  • Returns the biggest value ever

    Returns number

  • get min(): number
  • Returns the smallest value ever

    Returns number

  • get total(): number
  • Gets the accumulated total

    Returns number

Methods

  • addCount(newCount: number, fetchResult: boolean): void
  • Call this method to monitor a count of something (e.g. mesh drawn in viewport count)

    Parameters

    • newCount: number

      the count value to add to the monitored count

    • fetchResult: boolean

      true when it's the last time in the frame you add to the counter and you wish to update the statistics properties (min/max/average), false if you only want to update statistics.

    Returns void

  • beginMonitoring(): void
  • Start monitoring this performance counter

    Returns void

  • endFrame(): void
  • Call this method to end the monitoring of a frame. This scenario is typically used when you accumulate monitoring time many times for a single frame, you call this method at the end of the frame, after beginMonitoring to start recording and endMonitoring(false) to accumulated the recorded time to the PerfCounter or addCount() to accumulate a monitored count.

    Returns void

  • endMonitoring(newFrame?: boolean): void
  • Compute the time lapsed since the previous beginMonitoring() call.

    Parameters

    • Optional newFrame: boolean

      true by default to fetch the result and monitor a new frame, if false the time monitored will be added to the current frame counter

    Returns void

  • fetchNewFrame(): void
  • Call this method to start monitoring a new frame. This scenario is typically used when you accumulate monitoring time many times for a single frame, you call this method at the start of the frame, then beginMonitoring to start recording and endMonitoring(false) to accumulated the recorded time to the PerfCounter or addCount() to accumulate a monitored count.

    Returns void

Legend

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

Settings

Theme