mirror of
				https://github.com/edera-dev/krata.git
				synced 2025-11-03 23:29:39 +00:00 
			
		
		
		
	feature(xen): implement power management operations (#215)
This commit is contained in:
		
							
								
								
									
										19
									
								
								crates/xen/xencall/examples/power_management.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								crates/xen/xencall/examples/power_management.rs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
			
		||||
use xencall::error::Result;
 | 
			
		||||
use xencall::sys::CpuId;
 | 
			
		||||
use xencall::XenCall;
 | 
			
		||||
 | 
			
		||||
#[tokio::main]
 | 
			
		||||
async fn main() -> Result<()> {
 | 
			
		||||
    env_logger::init();
 | 
			
		||||
 | 
			
		||||
    let call = XenCall::open(0)?;
 | 
			
		||||
    let physinfo = call.phys_info().await?;
 | 
			
		||||
    println!("{:?}", physinfo);
 | 
			
		||||
    let topology = call.cpu_topology().await?;
 | 
			
		||||
    println!("{:?}", topology);
 | 
			
		||||
    call.set_cpufreq_gov(CpuId::All, "performance").await?;
 | 
			
		||||
    call.set_cpufreq_gov(CpuId::Single(0), "performance")
 | 
			
		||||
        .await?;
 | 
			
		||||
    call.set_turbo_mode(CpuId::All, true).await?;
 | 
			
		||||
    Ok(())
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user