Click or drag to resize
AB4D logo

FpsMeter Class

FpsMeter is a simple control that is derived from TextBlock and displays the current frames per second (FPS) value and an average FPS value.
Inheritance Hierarchy
SystemObject
  System.Windows.ThreadingDispatcherObject
    System.WindowsDependencyObject
      System.Windows.MediaVisual
        System.WindowsUIElement
          System.WindowsFrameworkElement
            System.Windows.ControlsTextBlock
              Ab3d.ControlsFpsMeter

Namespace: Ab3d.Controls
Assembly: Ab3d.PowerToys (in Ab3d.PowerToys.dll) Version: 11.1.8864.1045
Syntax
C#
public class FpsMeter : TextBlock, ICompositionRenderingSubscriber

The FpsMeter type exposes the following members.

Constructors
 NameDescription
Public methodFpsMeter Constructor
Top
Properties
 NameDescription
Public propertyDisplayFormatString Gets or sets the format string that is used to format the FpsMeter results. Default value is "{0} fps; average: {1:0.00} fps"
Public propertyTotalFrames number of Frames (rendering passes) from the start of measuring or from last Reset.
Public propertyTotalSeconds number of seconds from the start of measuring or from last Reset.
Top
Methods
 NameDescription
Public methodReset Resets the TotalFrames and TotalSeconds properties - and also the average FPS displayed
Top
Remarks

The FpsMeter is using CompositionTarget.Rendering event to measure the numbers of rendering passes that occur in each second and displays the count as FPS value.

When the FpsMeter is not visible any more, the control is unsubscribed from CompositionTarget.Rendering event.

See Also