pub trait OSProcess {
type ProcessIDType: Display + Eq + Copy;
type ThreadIDType: Display + Eq + Copy;
// Required methods
fn get_process_memory_maps() -> Result<String>;
fn get_process_id() -> Result<Self::ProcessIDType>;
fn get_thread_id() -> Result<Self::ThreadIDType>;
fn get_total_num_cpus() -> CoreNum;
fn bind_current_thread_to_core(core_id: CoreId);
fn bind_current_thread_to_cpuset(core_ids: &[CoreId]);
}Expand description
Abstraction for OS process operations.
Required Associated Types§
Sourcetype ProcessIDType: Display + Eq + Copy
type ProcessIDType: Display + Eq + Copy
The process ID type for the OS.
Sourcetype ThreadIDType: Display + Eq + Copy
type ThreadIDType: Display + Eq + Copy
The thread ID type for the OS.
Required Methods§
Sourcefn get_process_memory_maps() -> Result<String>
fn get_process_memory_maps() -> Result<String>
Get the memory maps for the process. The returned string is a multi-line string. Fallback: This is only used for debugging. For unimplemented cases, this function can return a placeholder Ok value.
Sourcefn get_process_id() -> Result<Self::ProcessIDType>
fn get_process_id() -> Result<Self::ProcessIDType>
Get the process ID as a string. Fallback: This is only used for debugging. For unimplemented cases, this function can return a placeholder Ok value.
Sourcefn get_thread_id() -> Result<Self::ThreadIDType>
fn get_thread_id() -> Result<Self::ThreadIDType>
Fallback: This is only used for debugging. For unimplemented cases, this function can return a placeholder Ok value.
Sourcefn get_total_num_cpus() -> CoreNum
fn get_total_num_cpus() -> CoreNum
Return the total number of cores allocated to the program.
Sourcefn bind_current_thread_to_core(core_id: CoreId)
fn bind_current_thread_to_core(core_id: CoreId)
Bind the current thread to the specified core.
Sourcefn bind_current_thread_to_cpuset(core_ids: &[CoreId])
fn bind_current_thread_to_cpuset(core_ids: &[CoreId])
Bind the current thread to the specified core set.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.