pub struct SystemProfile {
pub cpu_count: usize,
pub physical_cpu_count: usize,
pub total_memory: u64,
pub available_memory: u64,
pub os_name: String,
pub os_version: String,
pub hostname: String,
pub is_macos: bool,
pub is_windows: bool,
pub is_linux: bool,
pub recommended_io_workers: usize,
pub recommended_cpu_workers: usize,
}Expand description
System profile containing hardware and resource information
Fields§
§cpu_count: usizeTotal CPU cores (including hyperthreading)
physical_cpu_count: usizePhysical CPU cores (excluding hyperthreading)
total_memory: u64Total system memory in bytes
available_memory: u64Available system memory in bytes at startup
os_name: StringOperating system name
os_version: StringOperating system version
hostname: StringSystem hostname
is_macos: boolIs this a Mac?
is_windows: boolIs this Windows?
is_linux: boolIs this Linux?
recommended_io_workers: usizeRecommended worker count for I/O-bound tasks
recommended_cpu_workers: usizeRecommended worker count for CPU-bound tasks
Implementations§
Source§impl SystemProfile
impl SystemProfile
Sourcepub fn get() -> Arc<SystemProfile>
pub fn get() -> Arc<SystemProfile>
Get the global system profile instance
Sourcepub fn calculate_workers(&self, percentage: usize) -> usize
pub fn calculate_workers(&self, percentage: usize) -> usize
Get optimal worker count based on percentage of available CPUs
Sourcepub fn calculate_workers_with_limit(
&self,
percentage: usize,
max_threads: usize,
) -> usize
pub fn calculate_workers_with_limit( &self, percentage: usize, max_threads: usize, ) -> usize
Get worker count with a maximum limit
Sourcepub fn adapt_workers_for_workload(
&self,
item_count: usize,
max_workers: usize,
) -> usize
pub fn adapt_workers_for_workload( &self, item_count: usize, max_workers: usize, ) -> usize
Adapt worker count based on workload size (for file processing tasks)
Sourcepub fn should_use_parallel(&self, min_memory_mb: u64) -> bool
pub fn should_use_parallel(&self, min_memory_mb: u64) -> bool
Check if system has sufficient resources for parallel processing
Sourcepub fn total_memory_gb(&self) -> f64
pub fn total_memory_gb(&self) -> f64
Get memory in GB
Sourcepub fn available_memory_gb(&self) -> f64
pub fn available_memory_gb(&self) -> f64
Get available memory in GB
Source§impl SystemProfile
Quick access functions
impl SystemProfile
Quick access functions
Sourcepub fn physical_cpu_count() -> usize
pub fn physical_cpu_count() -> usize
Get physical CPU count directly
Sourcepub fn is_multicore() -> bool
pub fn is_multicore() -> bool
Check if running on a multi-core system
pub fn is_windows() -> bool
pub fn is_linux() -> bool
Trait Implementations§
Source§impl Clone for SystemProfile
impl Clone for SystemProfile
Source§fn clone(&self) -> SystemProfile
fn clone(&self) -> SystemProfile
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SystemProfile
impl RefUnwindSafe for SystemProfile
impl Send for SystemProfile
impl Sync for SystemProfile
impl Unpin for SystemProfile
impl UnwindSafe for SystemProfile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more