mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
remove warnings when benchmarks are on; add log telemetry
this allows us to automate testing using the benchmark code as a stress test
This commit is contained in:
parent
f3c28b4e20
commit
62c9f0d0ce
4 changed files with 27 additions and 11 deletions
|
|
@ -192,7 +192,9 @@ impl CmdEnv {
|
|||
)
|
||||
.expect("couldn't map event1 CSR range");
|
||||
|
||||
let common = CommonEnv {
|
||||
// _ prefix allows us to leave the `mut` here without creating a warning.
|
||||
// the `mut` option is needed for some features.
|
||||
let mut _common = CommonEnv {
|
||||
llio: llio::Llio::new(&xns),
|
||||
com: com::Com::new(&xns).expect("could't connect to COM"),
|
||||
ticktimer,
|
||||
|
|
@ -209,28 +211,28 @@ impl CmdEnv {
|
|||
};
|
||||
//let fcc = Fcc::new(&mut common);
|
||||
#[cfg(feature="benchmarks")]
|
||||
let sha = Sha::new(&xns, &mut common);
|
||||
let sha = Sha::new(&xns, &mut _common);
|
||||
#[cfg(feature="aestests")]
|
||||
let aes = Aes::new(&xns, &mut common);
|
||||
let aes = Aes::new(&xns, &mut _common);
|
||||
#[cfg(feature="benchmarks")]
|
||||
let engine = Engine::new(&xns, &mut common);
|
||||
let engine = Engine::new(&xns, &mut _common);
|
||||
//let memtest = Memtest::new(&xns, &mut common);
|
||||
|
||||
// print our version info
|
||||
let soc_ver = common.llio.soc_gitrev().unwrap();
|
||||
let soc_ver = _common.llio.soc_gitrev().unwrap();
|
||||
log::info!("SoC git rev {}", soc_ver.to_string());
|
||||
log::info!("{}PDDB.DNA,{:x},{}", xous::BOOKEND_START, common.llio.soc_dna().unwrap(), xous::BOOKEND_END);
|
||||
let (rev, dirty) = common.com.get_ec_git_rev().unwrap();
|
||||
log::info!("{}PDDB.DNA,{:x},{}", xous::BOOKEND_START, _common.llio.soc_dna().unwrap(), xous::BOOKEND_END);
|
||||
let (rev, dirty) = _common.com.get_ec_git_rev().unwrap();
|
||||
let dirtystr = if dirty { "dirty" } else { "clean" };
|
||||
log::info!("EC gateware git commit: {:x}, {}", rev, dirtystr);
|
||||
let ec_ver = common.com.get_ec_sw_tag().unwrap();
|
||||
let ec_ver = _common.com.get_ec_sw_tag().unwrap();
|
||||
log::info!("EC sw tag: {}", ec_ver.to_string());
|
||||
let wf_ver = common.com.get_wf200_fw_rev().unwrap();
|
||||
let wf_ver = _common.com.get_wf200_fw_rev().unwrap();
|
||||
log::info!("WF200 fw rev {}.{}.{}", wf_ver.maj, wf_ver.min, wf_ver.rev);
|
||||
|
||||
|
||||
CmdEnv {
|
||||
common_env: common,
|
||||
common_env: _common,
|
||||
lastverb: String::<256>::new(),
|
||||
///// 3. initialize your storage, by calling new()
|
||||
sleep_cmd: Sleep::new(&xns),
|
||||
|
|
|
|||
|
|
@ -347,9 +347,11 @@ impl<'a> ShellCmdApi<'a> for Aes {
|
|||
let modestr = if hw_mode != 0 { &"hw" } else { &"sw" };
|
||||
if pass != 0 {
|
||||
write!(ret, "[{}] passed: {:.02}µs/block enc+dec AES{}", modestr, elapsed * 1000.0, keybits).unwrap();
|
||||
log::info!("{}BENCH,AES,PASS,{}us/block,{}", xous::BOOKEND_START, elapsed * 1000.0, xous::BOOKEND_END);
|
||||
} else {
|
||||
// pass was 0, we failed
|
||||
write!(ret, "[{}] FAILED: {:.02}µs/block enc+dec AES{}", modestr, elapsed * 1000.0, keybits).unwrap();
|
||||
log::info!("{}BENCH,AES,FAIL,{}us/block,{}", xous::BOOKEND_START, elapsed * 1000.0, xous::BOOKEND_END);
|
||||
}
|
||||
});
|
||||
Ok(Some(ret))
|
||||
|
|
|
|||
|
|
@ -469,7 +469,7 @@ impl<'a> ShellCmdApi<'a> for Engine {
|
|||
}
|
||||
"ed" => {
|
||||
use ed25519_dalek::*;
|
||||
use ed25519::signature::Signature as _;
|
||||
// use ed25519::signature::Signature as _;
|
||||
use hex::FromHex;
|
||||
let secret_key: &[u8] = b"833fe62409237b9d62ec77587520911e9a759cec1d19755b7da901b96dca3d42";
|
||||
let public_key: &[u8] = b"ec172b93ad5e563bf4932c70e1245034c35467ef2efd4d64ebf819683467e2bf";
|
||||
|
|
@ -521,6 +521,7 @@ impl<'a> ShellCmdApi<'a> for Engine {
|
|||
.filter_map(|test_index| WycheproofTestCase::read(test_index).run())
|
||||
.collect();
|
||||
write!(ret, "Ran {} tests. {} failures.", WYCHEPROOF_NO_TEST_CASES, failures.len()).unwrap();
|
||||
let num_failures = failures.len();
|
||||
if failures.len() > 0 {
|
||||
write!(ret, "\nFailed tests: {:?}", failures.iter().map(|tc| tc.test_id).collect::<Vec<usize>>()).unwrap();
|
||||
for failure in failures {
|
||||
|
|
@ -528,6 +529,9 @@ impl<'a> ShellCmdApi<'a> for Engine {
|
|||
log::error!("expected: {}", failure.expected.encode_hex::<std::string::String>());
|
||||
log::error!("actual: {}", failure.actual.encode_hex::<std::string::String>());
|
||||
}
|
||||
log::info!("{}BENCH,WYCHEPROOF,FAIL,{},{}", xous::BOOKEND_START, num_failures, xous::BOOKEND_END);
|
||||
} else {
|
||||
log::info!("{}BENCH,WYCHEPROOF,PASS,{}", xous::BOOKEND_START, xous::BOOKEND_END);
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
|
|
@ -556,6 +560,11 @@ impl<'a> ShellCmdApi<'a> for Engine {
|
|||
},
|
||||
Some(BenchResult::DhDone) => {
|
||||
write!(ret, "{}ms/DH_iter; Passed {} ops, failed {} ops", elapsed, passes, fails).unwrap();
|
||||
if fails == 0 {
|
||||
log::info!("{}BENCH,DH,PASS,{}", xous::BOOKEND_START, xous::BOOKEND_END);
|
||||
} else {
|
||||
log::info!("{}BENCH,DH,FAIL,{}", xous::BOOKEND_START, xous::BOOKEND_END);
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
write!(ret, "Engine bench callback with unknown bench type").unwrap();
|
||||
|
|
|
|||
|
|
@ -258,12 +258,15 @@ impl<'a> ShellCmdApi<'a> for Sha {
|
|||
let modestr = if hw_mode != 0 { &"hw" } else { &"sw" };
|
||||
if first_time != 0 {
|
||||
write!(ret, "[{}] first pass: {}ms/hash", modestr, elapsed).unwrap();
|
||||
log::info!("{}BENCH,SHA,FIRST,{}ms/hash,{}", xous::BOOKEND_START, elapsed, xous::BOOKEND_END);
|
||||
} else {
|
||||
if pass != 0 {
|
||||
write!(ret, "[{}] match to previous pass: {}ms/hash", modestr, elapsed).unwrap();
|
||||
log::info!("{}BENCH,SHA,PASS,{}ms/hash,{}", xous::BOOKEND_START, elapsed, xous::BOOKEND_END);
|
||||
} else {
|
||||
// pass was 0, we failed
|
||||
write!(ret, "[{}] FAILED match to previous pass: {}ms/hash", modestr, elapsed).unwrap();
|
||||
log::info!("{}BENCH,SHA,FAIL,{}ms/hash,{}", xous::BOOKEND_START, elapsed, xous::BOOKEND_END);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue