bevy_diagnostic/
lib.rs

1// FIXME(3492): remove once docs are ready
2#![allow(missing_docs)]
3#![cfg_attr(docsrs, feature(doc_auto_cfg))]
4#![forbid(unsafe_code)]
5#![doc(
6    html_logo_url = "https://bevyengine.org/assets/icon.png",
7    html_favicon_url = "https://bevyengine.org/assets/icon.png"
8)]
9
10//! This crate provides a straightforward solution for integrating diagnostics in the [Bevy game engine](https://bevyengine.org/).
11//! It allows users to easily add diagnostic functionality to their Bevy applications, enhancing
12//! their ability to monitor and optimize their game's.
13
14mod diagnostic;
15mod entity_count_diagnostics_plugin;
16mod frame_time_diagnostics_plugin;
17mod log_diagnostics_plugin;
18#[cfg(feature = "sysinfo_plugin")]
19mod system_information_diagnostics_plugin;
20
21pub use diagnostic::*;
22
23pub use entity_count_diagnostics_plugin::EntityCountDiagnosticsPlugin;
24pub use frame_time_diagnostics_plugin::FrameTimeDiagnosticsPlugin;
25pub use log_diagnostics_plugin::LogDiagnosticsPlugin;
26#[cfg(feature = "sysinfo_plugin")]
27pub use system_information_diagnostics_plugin::{SystemInfo, SystemInformationDiagnosticsPlugin};
28
29use bevy_app::prelude::*;
30
31/// Adds core diagnostics resources to an App.
32#[derive(Default)]
33pub struct DiagnosticsPlugin;
34
35impl Plugin for DiagnosticsPlugin {
36    fn build(&self, app: &mut App) {
37        app.init_resource::<DiagnosticsStore>();
38
39        #[cfg(feature = "sysinfo_plugin")]
40        app.init_resource::<system_information_diagnostics_plugin::SystemInfo>();
41    }
42}
43
44/// Default max history length for new diagnostics.
45pub const DEFAULT_MAX_HISTORY_LENGTH: usize = 120;