MiniStats is a small graphical overlay that displays realtime performance metrics. By default, it shows CPU and GPU utilization, frame timings and draw call count. It can also be configured to display additional graphs based on data collected into AppBase#stats.

Constructors

  • Create a new MiniStats instance.

    Parameters

    • app: AppBase

      The application.

    • Optional options: {
          cpu: {
              enabled: boolean;
              watermark: number;
          };
          gpu: {
              enabled: boolean;
              watermark: number;
          };
          sizes: {
              graphs: boolean;
              height: number;
              spacing: number;
              width: number;
          }[];
          startSizeIndex: number;
          stats: {
              decimalPlaces: number;
              name: string;
              stats: string[];
              unitsName: string;
              watermark: number;
          }[];
          textRefreshRate: number;
      }

      Options for the MiniStats instance.

      • cpu: {
            enabled: boolean;
            watermark: number;
        }

        CPU graph options.

        • enabled: boolean
        • watermark: number
      • gpu: {
            enabled: boolean;
            watermark: number;
        }

        GPU graph options.

        • enabled: boolean
        • watermark: number
      • sizes: {
            graphs: boolean;
            height: number;
            spacing: number;
            width: number;
        }[]

        Sizes of area to render individual graphs in and spacing between individual graphs.

      • startSizeIndex: number

        Index into sizes array for initial setting.

      • stats: {
            decimalPlaces: number;
            name: string;
            stats: string[];
            unitsName: string;
            watermark: number;
        }[]

        Array of options to render additional graphs based on stats collected into AppBase#stats.

      • textRefreshRate: number

        Refresh rate of text stats in ms.

    Returns MiniStats

    Example

    // create a new MiniStats instance using default options
    const miniStats = new pc.MiniStats(app);

Accessors

Methods

  • Private

    Resize the MiniStats overlay.

    Parameters

    • width: number

      The new width.

    • height: number

      The new height.

    • showGraphs: boolean

      Whether to show the graphs.

    Returns void

  • Private

    Update the size and position of the MiniStats overlay. This is called automatically when the resizecanvas event is fired by the graphics device.

    Returns void

  • Returns the default options for MiniStats. The default options configure the overlay to show the following graphs:

    • CPU utilization
    • GPU utilization
    • Overall frame time
    • Draw call count

    Returns object

    The default options for MiniStats.

    Example

    const options = pc.MiniStats.getDefaultOptions();