# The frame rate

Game performance is often measured in terms of the number of times the display is updated every second; that is, the frames-per-second or FPS. You can determine your application's FPS with a single function call:

    pyglet.clock.get_fps()

The value returned is more useful than simply taking the reciprocal of dt from a period function, as it is averaged over a sliding window of several frames.

# Displaying the frame rate

A simple way to profile your application performance is to display the frame rate while it is running. Printing it to the console is not ideal as this will have a severe impact on performance. pyglet provides the ClockDisplay class for displaying the frame rate with very little effort:

    fps_display = pyglet.clock.ClockDisplay()

    @window.event
    def on_draw():
        window.clear()
        fps_display.draw()

By default the frame rate will be drawn in the bottom-right corner of the window in a semi-translucent large font. See the ClockDisplay documentation for details on how to customise this, or even display another clock value (such as the current time) altogether.