| 150 | /// - Health status |
| 151 | #[pyfunction] |
| 152 | fn get_system_info(py: Python<'_>) -> PyResult<Bound<'_, PyDict>> { |
| 153 | let dict = PyDict::new(py); |
| 154 | |
| 155 | // Version information |
| 156 | dict.set_item("version", version())?; |
| 157 | dict.set_item("python_binding_version", env!("CARGO_PKG_VERSION"))?; |
| 158 | |
| 159 | // Runtime information |
| 160 | if let Some(stats) = runtime::get_runtime_stats() { |
| 161 | dict.set_item("runtime_uptime_seconds", stats.uptime.as_secs())?; |
| 162 | dict.set_item("runtime_worker_threads", stats.worker_threads)?; |
| 163 | dict.set_item("runtime_max_blocking_threads", stats.max_blocking_threads)?; |
| 164 | } |
| 165 | |
| 166 | // System information |
| 167 | dict.set_item("cpu_count", num_cpus::get())?; |
| 168 | dict.set_item("runtime_initialized", runtime::is_runtime_initialized())?; |
| 169 | |
| 170 | // Memory allocator information with runtime verification |
| 171 | let (allocator_name, allocator_verified) = get_allocator_info(); |
| 172 | dict.set_item("memory_allocator", allocator_name)?; |
| 173 | dict.set_item("memory_allocator_verified", allocator_verified)?; |
| 174 | |
| 175 | // Build information |
| 176 | dict.set_item( |
| 177 | "build_target", |
| 178 | std::env::var("TARGET").unwrap_or_else(|_| "unknown".to_string()), |
| 179 | )?; |
| 180 | dict.set_item( |
| 181 | "build_profile", |
| 182 | if cfg!(debug_assertions) { |
| 183 | "debug" |
| 184 | } else { |
| 185 | "release" |
| 186 | }, |
| 187 | )?; |
| 188 | |
| 189 | Ok(dict) |
| 190 | } |
| 191 | |
| 192 | /// Validate the current environment and configuration |
| 193 | /// |