Skip to main content

ProcessPowerThrottlingState

Struct ProcessPowerThrottlingState 

Source
pub struct ProcessPowerThrottlingState { /* private fields */ }
Expand description

Represents the power throttling state of a process.

Implementations§

Source§

impl ProcessPowerThrottlingState

Source

pub fn new( control_mask: PowerThrottlingControlMask, state_mask: PowerThrottlingStateMask, ) -> Self

Creates a new ProcessPowerThrottlingState with specified control and state masks

Source

pub fn from_windows() -> Result<Self, Error>

Create ProcessPowerThrottlingState from current process

Examples found in repository?
examples/ecoprocess.rs (line 6)
5fn main() -> Result<(), windows_eco::Error> {
6    let mut state = ProcessPowerThrottlingState::from_windows()?;
7    println!("{state}");
8    state.enable_all_throttling();
9    state.apply()?;
10    println!("{state}");
11
12    thread::sleep(Duration::from_secs(30));
13
14    Ok(())
15}
Source

pub fn apply(&self) -> Result<(), Error>

Applies this power throttling state to the current process

Examples found in repository?
examples/ecoprocess.rs (line 9)
5fn main() -> Result<(), windows_eco::Error> {
6    let mut state = ProcessPowerThrottlingState::from_windows()?;
7    println!("{state}");
8    state.enable_all_throttling();
9    state.apply()?;
10    println!("{state}");
11
12    thread::sleep(Duration::from_secs(30));
13
14    Ok(())
15}
Source

pub fn enable_execution_speed_throttling(&mut self)

Creates a ProcessPowerThrottlingState that enables execution speed throttling

Source

pub fn disable_execution_speed_throttling(&mut self)

Creates a ProcessPowerThrottlingState that disables execution speed throttling

Source

pub fn enable_timer_resolution_throttling(&mut self)

Creates a ProcessPowerThrottlingState that enables timer resolution throttling

Source

pub fn disable_timer_resolution_throttling(&mut self)

Creates a ProcessPowerThrottlingState that disables timer resolution throttling

Source

pub fn enable_all_throttling(&mut self)

Creates a ProcessPowerThrottlingState that enables all available throttling

Examples found in repository?
examples/ecoprocess.rs (line 8)
5fn main() -> Result<(), windows_eco::Error> {
6    let mut state = ProcessPowerThrottlingState::from_windows()?;
7    println!("{state}");
8    state.enable_all_throttling();
9    state.apply()?;
10    println!("{state}");
11
12    thread::sleep(Duration::from_secs(30));
13
14    Ok(())
15}
Source

pub fn disable_all_throttling(&mut self)

Creates a ProcessPowerThrottlingState that disables all throttling

Source

pub fn control_flags(&self) -> PowerThrottlingControlMask

Get control mask as bitflags

Source

pub fn state_flags(&self) -> PowerThrottlingStateMask

Get state mask as bitflags

Source

pub fn is_execution_speed_throttled(&self) -> bool

Check if execution speed throttling is enabled

Source

pub fn is_ignore_timer_resolution_throttled(&self) -> bool

Check if timer resolution throttling is enabled

Source

pub fn is_execution_speed_controlled(&self) -> bool

Check if execution speed control is enabled

Source

pub fn is_timer_resolution_controlled(&self) -> bool

Check if timer resolution control is enabled

Source

pub fn version(&self) -> u32

Retrieve the underlying version of power throttling API

Source

pub fn set_version(&mut self, version: u32)

Sets the underlying version of power throttling API

Trait Implementations§

Source§

impl Clone for ProcessPowerThrottlingState

Source§

fn clone(&self) -> ProcessPowerThrottlingState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ProcessPowerThrottlingState

Source§

impl Debug for ProcessPowerThrottlingState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ProcessPowerThrottlingState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for ProcessPowerThrottlingState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.