forked from NG-SD-Plugins/PowerTools
Complete switch to linux kernel SMT toggle #48
This commit is contained in:
parent
36ce024665
commit
5fe4e9d15d
8 changed files with 22 additions and 3 deletions
|
@ -9,13 +9,13 @@ static VISIT_COUNT: AtomicU64 = AtomicU64::new(0);
|
||||||
|
|
||||||
fn get_limits(base: Base) -> impl warp::Reply {
|
fn get_limits(base: Base) -> impl warp::Reply {
|
||||||
VISIT_COUNT.fetch_add(1, Ordering::AcqRel);
|
VISIT_COUNT.fetch_add(1, Ordering::AcqRel);
|
||||||
//println!("Count: {} + 1", old_count);
|
println!("Limits got");
|
||||||
warp::reply::json(&base)
|
warp::reply::json(&base)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_visits() -> impl warp::Reply {
|
fn get_visits() -> impl warp::Reply {
|
||||||
let count = VISIT_COUNT.load(Ordering::Relaxed);
|
let count = VISIT_COUNT.load(Ordering::Relaxed);
|
||||||
//println!("Count: {}", count);
|
println!("Count got");
|
||||||
warp::reply::json(&count)
|
warp::reply::json(&count)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,7 @@ impl CpuMessage {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Self::SetSmt(status, cb) => {
|
Self::SetSmt(status, cb) => {
|
||||||
|
*settings.smt() = status;
|
||||||
let mut result = Vec::with_capacity(settings.len());
|
let mut result = Vec::with_capacity(settings.len());
|
||||||
for i in 0..settings.len() {
|
for i in 0..settings.len() {
|
||||||
*settings.cpus()[i].online() = *settings.cpus()[i].online() && (status || i % 2 == 0);
|
*settings.cpus()[i].online() = *settings.cpus()[i].online() && (status || i % 2 == 0);
|
||||||
|
|
|
@ -188,6 +188,10 @@ impl TCpus for Cpus {
|
||||||
self.cpus.len()
|
self.cpus.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn smt(&mut self) -> &'_ mut bool {
|
||||||
|
&mut self.smt
|
||||||
|
}
|
||||||
|
|
||||||
fn provider(&self) -> crate::persist::DriverJson {
|
fn provider(&self) -> crate::persist::DriverJson {
|
||||||
crate::persist::DriverJson::Generic
|
crate::persist::DriverJson::Generic
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,6 +152,10 @@ impl TCpus for Cpus {
|
||||||
self.cpus.len()
|
self.cpus.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn smt(&mut self) -> &'_ mut bool {
|
||||||
|
&mut self.smt
|
||||||
|
}
|
||||||
|
|
||||||
fn provider(&self) -> crate::persist::DriverJson {
|
fn provider(&self) -> crate::persist::DriverJson {
|
||||||
crate::persist::DriverJson::SteamDeck
|
crate::persist::DriverJson::SteamDeck
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,6 +152,10 @@ impl TCpus for Cpus {
|
||||||
self.cpus.len()
|
self.cpus.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn smt(&mut self) -> &'_ mut bool {
|
||||||
|
&mut self.smt
|
||||||
|
}
|
||||||
|
|
||||||
fn provider(&self) -> crate::persist::DriverJson {
|
fn provider(&self) -> crate::persist::DriverJson {
|
||||||
crate::persist::DriverJson::SteamDeckAdvance
|
crate::persist::DriverJson::SteamDeckAdvance
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,8 @@ pub trait TCpus: OnResume + OnSet + Debug + Send {
|
||||||
|
|
||||||
fn len(&self) -> usize;
|
fn len(&self) -> usize;
|
||||||
|
|
||||||
|
fn smt(&mut self) -> &'_ mut bool;
|
||||||
|
|
||||||
fn provider(&self) -> crate::persist::DriverJson {
|
fn provider(&self) -> crate::persist::DriverJson {
|
||||||
crate::persist::DriverJson::AutoDetect
|
crate::persist::DriverJson::AutoDetect
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,6 +151,10 @@ impl TCpus for Cpus {
|
||||||
self.cpus.len()
|
self.cpus.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn smt(&mut self) -> &'_ mut bool {
|
||||||
|
&mut self.smt
|
||||||
|
}
|
||||||
|
|
||||||
fn provider(&self) -> crate::persist::DriverJson {
|
fn provider(&self) -> crate::persist::DriverJson {
|
||||||
crate::persist::DriverJson::Unknown
|
crate::persist::DriverJson::Unknown
|
||||||
}
|
}
|
||||||
|
|
2
main.py
2
main.py
|
@ -11,6 +11,6 @@ class Plugin:
|
||||||
# Asyncio-compatible long-running code, executed in a task when the plugin is loaded
|
# Asyncio-compatible long-running code, executed in a task when the plugin is loaded
|
||||||
async def _main(self):
|
async def _main(self):
|
||||||
# startup
|
# startup
|
||||||
#self.backend_proc = subprocess.Popen([PARENT_DIR + "/bin/backend"])
|
self.backend_proc = subprocess.Popen([PARENT_DIR + "/bin/backend"])
|
||||||
while True:
|
while True:
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
|
|
Loading…
Reference in a new issue