Complete switch to linux kernel SMT toggle #48

This commit is contained in:
NGnius (Graham) 2022-12-24 10:21:27 -05:00
parent 36ce024665
commit 5fe4e9d15d
8 changed files with 22 additions and 3 deletions

View file

@ -9,13 +9,13 @@ static VISIT_COUNT: AtomicU64 = AtomicU64::new(0);
fn get_limits(base: Base) -> impl warp::Reply {
VISIT_COUNT.fetch_add(1, Ordering::AcqRel);
//println!("Count: {} + 1", old_count);
println!("Limits got");
warp::reply::json(&base)
}
fn get_visits() -> impl warp::Reply {
let count = VISIT_COUNT.load(Ordering::Relaxed);
//println!("Count: {}", count);
println!("Count got");
warp::reply::json(&count)
}

View file

@ -67,6 +67,7 @@ impl CpuMessage {
}
},
Self::SetSmt(status, cb) => {
*settings.smt() = status;
let mut result = Vec::with_capacity(settings.len());
for i in 0..settings.len() {
*settings.cpus()[i].online() = *settings.cpus()[i].online() && (status || i % 2 == 0);

View file

@ -188,6 +188,10 @@ impl TCpus for Cpus {
self.cpus.len()
}
fn smt(&mut self) -> &'_ mut bool {
&mut self.smt
}
fn provider(&self) -> crate::persist::DriverJson {
crate::persist::DriverJson::Generic
}

View file

@ -152,6 +152,10 @@ impl TCpus for Cpus {
self.cpus.len()
}
fn smt(&mut self) -> &'_ mut bool {
&mut self.smt
}
fn provider(&self) -> crate::persist::DriverJson {
crate::persist::DriverJson::SteamDeck
}

View file

@ -152,6 +152,10 @@ impl TCpus for Cpus {
self.cpus.len()
}
fn smt(&mut self) -> &'_ mut bool {
&mut self.smt
}
fn provider(&self) -> crate::persist::DriverJson {
crate::persist::DriverJson::SteamDeckAdvance
}

View file

@ -44,6 +44,8 @@ pub trait TCpus: OnResume + OnSet + Debug + Send {
fn len(&self) -> usize;
fn smt(&mut self) -> &'_ mut bool;
fn provider(&self) -> crate::persist::DriverJson {
crate::persist::DriverJson::AutoDetect
}

View file

@ -151,6 +151,10 @@ impl TCpus for Cpus {
self.cpus.len()
}
fn smt(&mut self) -> &'_ mut bool {
&mut self.smt
}
fn provider(&self) -> crate::persist::DriverJson {
crate::persist::DriverJson::Unknown
}

View file

@ -11,6 +11,6 @@ class Plugin:
# Asyncio-compatible long-running code, executed in a task when the plugin is loaded
async def _main(self):
# startup
#self.backend_proc = subprocess.Popen([PARENT_DIR + "/bin/backend"])
self.backend_proc = subprocess.Popen([PARENT_DIR + "/bin/backend"])
while True:
await asyncio.sleep(1)