Performance Information
- arcade.print_timings() None [source]
Print event handler statistics to stdout as a table.
Performance tracking must be enabled with
arcade.enable_timings()
before calling this function.See Performance Statistics for an example of how to use function.
The statistics consist of:
how many times each registered event was called
the average time for handling each type of event in seconds
The table looks something like:
Event Count Average Time -------------- ----- ------------ on_update 60 0.0000 on_mouse_enter 1 0.0000 on_mouse_motion 39 0.0000 on_expose 1 0.0000 on_draw 60 0.0020
- arcade.clear_timings() None [source]
Reset the count & average time for each event type to zero.
Performance tracking must be enabled with
arcade.enable_timings()
before calling this function.See Performance Statistics for an example of how to use function.
- arcade.get_timings() dict[str, deque[float]] [source]
Get a dict of the current dispatch event timings.
Performance tracking must be enabled with
arcade.enable_timings()
before calling this function.- Returns:
A dict of event timing data, consisting of counts and average handler duration.
- arcade.enable_timings(max_history: int = 100) None [source]
Enable recording of performance information.
This function must be called before using any other performance features, except for
arcade.timings_enabled()
, which can be called at any time.See Performance Statistics for an example of how to use function.
- Parameters:
max_history – How many frames to keep performance info for.
- arcade.disable_timings() None [source]
Disable collection of timing information.
Performance tracking must be enabled with
arcade.enable_timings()
before calling this function.
- arcade.get_fps(frame_count: int = 60) float [source]
Get the FPS over the last
frame_count
frames.Performance tracking must be enabled with
arcade.enable_timings()
before calling this function.To get the FPS over the last 30 frames, you would pass 30 instead of the default 60.
See Performance Statistics for an example of how to use function.
- Parameters:
frame_count – How many frames to calculate the FPS over.
- arcade.timings_enabled() bool [source]
Return true if timings are enabled, false otherwise.
This function can be used at any time to check if timings are enabled. See
arcade.enable_timings()
for more information.- Returns:
Whether timings are currently enabled.
- class arcade.PerfGraph(width: int, height: int, graph_data: str = 'FPS', update_rate: float = 0.1, background_color: tuple[int, int, int, int] = (0, 0, 0, 255), data_line_color: tuple[int, int, int, int] = (255, 255, 255, 255), axis_color: tuple[int, int, int, int] = (155, 135, 12, 255), grid_color: tuple[int, int, int, int] = (155, 135, 12, 255), font_color: tuple[int, int, int, int] = (255, 255, 255, 255), font_size: int = 10, y_axis_num_lines: int = 4, view_y_scale_step: float = 20.0)[source]
Bases:
Sprite
An auto-updating line chart of FPS or event handler execution times.
You must use
arcade.enable_timings()
to turn on performance tracking for the chart to display data.Aside from instantiation and updating the chart, this class behaves like other
arcade.Sprite
instances. You can use it withSpriteList
normally. See Performance Statistics for an example of how to use this class.Unlike other
Sprite
instances, this class neither loads anarcade.Texture
nor accepts one as a constructor argument. Instead, it creates a new internalTexture
instance. The chart is automatically redrawn to this internalTexture
everyupdate_rate
seconds.- Parameters:
width (int) – The width of the chart texture in pixels
height (int) – The height of the chart texture in pixels
graph_data (str) – The pyglet event handler or statistic to track
update_rate (float) – How often the graph updates, in seconds
background_color (RGBA255) – The background color of the chart
data_line_color (RGBA255) – Color of the line tracking drawn
axis_color (RGBA255) – The color to draw the x & y axes in
font_color (RGBA255) – The color of the label font
font_size (int) – The size of the label font in points
y_axis_num_lines (int) – How many grid lines should be used to divide the y scale of the graph.
view_y_scale_step (float) – The graph’s view area will be scaled to a multiple of this value to fit to the data currently displayed.
- boundary_bottom: float | None
PhysicsEnginePlatformer
uses this as the top boundary for movingplatforms
.
- boundary_left: float | None
PhysicsEnginePlatformer
uses this as the left boundary for movingplatforms
.
- boundary_right: float | None
PhysicsEnginePlatformer
uses this as the right boundary for movingplatforms
.
- boundary_top: float | None
PhysicsEnginePlatformer
uses this as the top boundary for movingplatforms
.
- force
force vector used by pymunk
- graph_data
The graphed data type, either “FPS” or a pyglet event handler name.
- line_color
The color of the line tracking the data.