Add pt_oc tests and auto-update json (test) fn

This commit is contained in:
NGnius (Graham) 2023-02-20 12:04:44 -05:00
parent 9da7de788e
commit b5a7cf5914
3 changed files with 148 additions and 65 deletions

View file

@ -37,6 +37,7 @@ decky = ["usdpl-back/decky"]
crankshaft = ["usdpl-back/crankshaft"] crankshaft = ["usdpl-back/crankshaft"]
encrypt = ["usdpl-back/encrypt"] encrypt = ["usdpl-back/encrypt"]
online = ["ureq"] online = ["ureq"]
dev_stuff = []
[profile.release] [profile.release]
debug = false debug = false

View file

@ -127,3 +127,22 @@ impl Default for GpuLimits {
fn oc_limits_filepath() -> std::path::PathBuf { fn oc_limits_filepath() -> std::path::PathBuf {
crate::utility::settings_dir().join(OC_LIMITS_FILEPATH) crate::utility::settings_dir().join(OC_LIMITS_FILEPATH)
} }
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn load_pt_oc() {
let mut file = std::fs::File::open("../pt_oc.json").unwrap();
let settings: OverclockLimits = serde_json::from_reader(&mut file).unwrap();
assert!(settings.cpus.cpus.len() == 8);
}
#[cfg(feature = "dev_stuff")]
#[test]
fn emit_default_pt_oc() {
let mut file = std::fs::File::create("../pt_oc.json").unwrap();
serde_json::to_writer_pretty(&mut file, &OverclockLimits::default()).unwrap();
}
}

View file

@ -1,68 +1,131 @@
{ {
"battery": { "battery": {
"charge_rate": {"min": 250, "max": 2500} "charge_rate": {
}, "min": 250,
"cpus": { "max": 2500
"cpus": [ }
{ },
"clock_min": {"min": 1400, "max": 3500}, "cpus": {
"clock_max": {"min": 500, "max": 3500}, "cpus": [
"clock_step": 100, {
"skip_resume_reclock": false "clock_min": {
}, "min": 1400,
{ "max": 3500
"clock_min": {"min": 1400, "max": 3500}, },
"clock_max": {"min": 500, "max": 3500}, "clock_max": {
"clock_step": 100, "min": 400,
"skip_resume_reclock": false "max": 3500
}, },
{
"clock_min": {"min": 1400, "max": 3500},
"clock_max": {"min": 500, "max": 3500},
"clock_step": 100,
"skip_resume_reclock": false
},
{
"clock_min": {"min": 1400, "max": 3500},
"clock_max": {"min": 500, "max": 3500},
"clock_step": 100,
"skip_resume_reclock": false
},
{
"clock_min": {"min": 1400, "max": 3500},
"clock_max": {"min": 500, "max": 3500},
"clock_step": 100,
"skip_resume_reclock": false
},
{
"clock_min": {"min": 1400, "max": 3500},
"clock_max": {"min": 500, "max": 3500},
"clock_step": 100,
"skip_resume_reclock": false
},
{
"clock_min": {"min": 1400, "max": 3500},
"clock_max": {"min": 500, "max": 3500},
"clock_step": 100,
"skip_resume_reclock": false
},
{
"clock_min": {"min": 1400, "max": 3500},
"clock_max": {"min": 500, "max": 3500},
"clock_step": 100,
"skip_resume_reclock": false
}
],
"global_governors": false
},
"gpu": {
"fast_ppt": {"min": 1000000, "max": 30000000},
"slow_ppt": {"min": 1000000, "max": 29000000},
"ppt_divisor": 1000000,
"ppt_step": 1,
"clock_min": {"min": 200, "max": 1600},
"clock_max": {"min": 200, "max": 1600},
"clock_step": 100, "clock_step": 100,
"skip_resume_reclock": false "skip_resume_reclock": false
} },
} {
"clock_min": {
"min": 1400,
"max": 3500
},
"clock_max": {
"min": 400,
"max": 3500
},
"clock_step": 100,
"skip_resume_reclock": false
},
{
"clock_min": {
"min": 1400,
"max": 3500
},
"clock_max": {
"min": 400,
"max": 3500
},
"clock_step": 100,
"skip_resume_reclock": false
},
{
"clock_min": {
"min": 1400,
"max": 3500
},
"clock_max": {
"min": 400,
"max": 3500
},
"clock_step": 100,
"skip_resume_reclock": false
},
{
"clock_min": {
"min": 1400,
"max": 3500
},
"clock_max": {
"min": 400,
"max": 3500
},
"clock_step": 100,
"skip_resume_reclock": false
},
{
"clock_min": {
"min": 1400,
"max": 3500
},
"clock_max": {
"min": 400,
"max": 3500
},
"clock_step": 100,
"skip_resume_reclock": false
},
{
"clock_min": {
"min": 1400,
"max": 3500
},
"clock_max": {
"min": 400,
"max": 3500
},
"clock_step": 100,
"skip_resume_reclock": false
},
{
"clock_min": {
"min": 1400,
"max": 3500
},
"clock_max": {
"min": 400,
"max": 3500
},
"clock_step": 100,
"skip_resume_reclock": false
}
],
"global_governors": false
},
"gpu": {
"fast_ppt": {
"min": 1000000,
"max": 30000000
},
"slow_ppt": {
"min": 1000000,
"max": 29000000
},
"ppt_divisor": 1000000,
"ppt_step": 1,
"clock_min": {
"min": 200,
"max": 1600
},
"clock_max": {
"min": 200,
"max": 1600
},
"clock_step": 100,
"skip_resume_reclock": false
}
}