Class BasicProfiler

All Implemented Interfaces:

public class BasicProfiler extends Object implements AppProfiler
An AppProfiler implementation that collects two per-frame application-wide timings for update versus render and uses it to create a bar chart style Mesh. The number of frames displayed and the update interval can be specified. The chart Mesh is in 'milliseconds' and can be scaled up or down as required.

Each column of the chart represents a single frames timing. Yellow represents the time it takes to perform all non-rendering activities (running enqueued tasks, stateManager.update, control.update(), etc) while the cyan portion represents the rendering time.

When the end of the chart is reached, the current frame cycles back around to the beginning.

  • Constructor Details

    • BasicProfiler

      public BasicProfiler()
    • BasicProfiler

      public BasicProfiler(int size)
  • Method Details

    • setFrameCount

      public final void setFrameCount(int size)
      Sets the number of frames to display and track. By default, this is 1280.
      size - the desired number of frames (≥0, default=1280)
    • getFrameCount

      public int getFrameCount()
    • setUpdateInterval

      public void setUpdateInterval(long nanos)
      Sets the number of nanoseconds to wait before updating the mesh. By default, this is once a millisecond, i.e. 1000000 nanoseconds.
      nanos - the desired update interval (in nanoseconds, default=1e6)
    • getUpdateInterval

      public long getUpdateInterval()
    • getMesh

      public Mesh getMesh()
      Returns the mesh that contains the bar chart of tracked frame timings.
      the pre-existing Mesh
    • createMesh

      protected final void createMesh()
    • updateMesh

      protected void updateMesh()
    • appStep

      public void appStep(AppStep step)
      Description copied from interface: AppProfiler
      Called at the beginning of the specified AppStep.
      Specified by:
      appStep in interface AppProfiler
      step - the application-level step that's about to begin
    • appSubStep

      public void appSubStep(String... additionalInfo)
      Description copied from interface: AppProfiler
      Called as a substep of the previous AppStep
      Specified by:
      appSubStep in interface AppProfiler
      additionalInfo - information about the substep
    • vpStep

      public void vpStep(VpStep step, ViewPort vp, RenderQueue.Bucket bucket)
      Description copied from interface: AppProfiler
      Called at the beginning of the specified VpStep during the rendering of the specified ViewPort. For bucket-specific steps the Bucket parameter will be non-null.
      Specified by:
      vpStep in interface AppProfiler
      step - the ViewPort-level step that's about to begin
      vp - which ViewPort is being processed
      bucket - which Bucket is being processed
    • spStep

      public void spStep(SpStep step, String... additionalInfo)
      Description copied from interface: AppProfiler
      Called at the beginning of the specified SpStep (SceneProcessor step). For more detailed steps it is possible to provide additional information as strings, like the name of the processor.
      Specified by:
      spStep in interface AppProfiler
      step - the SceneProcessor step that's about to begin
      additionalInfo - information about the SceneProcessor step