pub struct ResourceUsage {
pub thread_id: ThreadId,
pub cpu_time_ns: u64,
pub memory_usage: u64,
pub peak_memory_usage: u64,
pub open_files: u32,
pub child_threads: u32,
pub network_connections: u32,
pub disk_io_ops: u64,
pub network_bytes_tx: u64,
pub network_bytes_rx: u64,
pub last_updated: Instant,
}
Expand description
Resource usage tracking for a single thread.
Fields§
§thread_id: ThreadId
Thread ID
cpu_time_ns: u64
CPU time consumed (nanoseconds)
memory_usage: u64
Memory currently allocated (bytes)
peak_memory_usage: u64
Peak memory usage (bytes)
open_files: u32
Number of file descriptors open
child_threads: u32
Number of child threads created
network_connections: u32
Network connections opened
disk_io_ops: u64
Disk I/O operations performed
network_bytes_tx: u64
Network bytes transmitted
network_bytes_rx: u64
Network bytes received
last_updated: Instant
Last update timestamp
Implementations§
Source§impl ResourceUsage
impl ResourceUsage
Sourcepub fn add_cpu_time(&mut self, duration: Duration)
pub fn add_cpu_time(&mut self, duration: Duration)
Update CPU time usage.
Sourcepub fn update_memory_usage(&mut self, new_usage: u64)
pub fn update_memory_usage(&mut self, new_usage: u64)
Update memory usage.
Sourcepub fn allocate_file_descriptor(&mut self)
pub fn allocate_file_descriptor(&mut self)
Record file descriptor allocation.
Sourcepub fn deallocate_file_descriptor(&mut self)
pub fn deallocate_file_descriptor(&mut self)
Record file descriptor deallocation.
Sourcepub fn add_child_thread(&mut self)
pub fn add_child_thread(&mut self)
Record child thread creation.
Sourcepub fn remove_child_thread(&mut self)
pub fn remove_child_thread(&mut self)
Record child thread termination.
Trait Implementations§
Source§impl Clone for ResourceUsage
impl Clone for ResourceUsage
Source§fn clone(&self) -> ResourceUsage
fn clone(&self) -> ResourceUsage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ResourceUsage
impl RefUnwindSafe for ResourceUsage
impl Send for ResourceUsage
impl Sync for ResourceUsage
impl Unpin for ResourceUsage
impl UnwindSafe for ResourceUsage
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
Mutably borrows from an owned value. Read more