change cargo xtask run to something that fails

This commit is contained in:
bunnie 2021-06-16 17:51:02 +08:00
parent 03bcf18348
commit 4b1495a8ef
5 changed files with 33 additions and 11 deletions

View file

@ -17,4 +17,5 @@ pub const SERVER_NAME_BENCHMARK: &str= "_Benchmark target_";
pub enum Opcode {
TestScalar, //(u32),
TestMemory, //(TestStruct),
TestMemorySend,
}

View file

@ -27,3 +27,12 @@ pub fn test_memory(cid: CID, testvar: u32) -> Result<u32, xous::Error> {
let result = buf.as_flat::<TestStruct, _>().unwrap();
Ok(result.challenge[0])
}
pub fn test_memory_send(cid: CID, testvar: u32) -> Result<u32, xous::Error> {
let mut reg = TestStruct::new();
reg.challenge[0] = testvar;
let mut buf = Buffer::into_buf(reg).or(Err(xous::Error::InternalError))?;
buf.send(cid, Opcode::TestMemorySend.to_u32().unwrap()).or(Err(xous::Error::InternalError))?;
Ok(testvar+2)
}

View file

@ -16,9 +16,10 @@ fn xmain() -> ! {
info!("BENCHTARGET: my PID is {}", xous::process::id());
let xns = xous_names::XousNames::new().unwrap();
let bench_sid = xns.register_name(api::SERVER_NAME_BENCHMARK).expect("BENCHTARGET: can't register server");
let bench_sid = xns.register_name(api::SERVER_NAME_BENCHMARK, None).expect("BENCHTARGET: can't register server");
info!("BENCHTARGET: registered with NS -- {:?}", bench_sid);
let mut state: u32 = 0;
loop {
let mut envelope = xous::receive_message(bench_sid).unwrap();
match FromPrimitive::from_usize(envelope.body.id()) {
@ -34,6 +35,11 @@ fn xmain() -> ! {
ret.challenge[0] = reg.challenge[0] + 1;
buffer.replace(ret).unwrap();
},
Some(Opcode::TestMemorySend) => {
let mut buffer = unsafe { Buffer::from_memory_message_mut(envelope.body.memory_message_mut().unwrap()) };
let reg = buffer.to_original::<TestStruct, _>().unwrap();
state += reg.challenge[0];
}
None => {error!("BENCHTARGET: couldn't convert opcode");}
}
}

View file

@ -68,7 +68,7 @@ fn shell_main() -> ! {
let ticktimer = ticktimer_server::Ticktimer::new().expect("Couldn't connect to Ticktimer");
let xns = xous_names::XousNames::new().unwrap();
let shell_server = xns.register_name(SERVER_NAME_SHELL).expect("BENCHMARK: can't register server");
let shell_server = xns.register_name(SERVER_NAME_SHELL, None).expect("BENCHMARK: can't register server");
let gfx = graphics_server::Gfx::new(&xns).unwrap();
let target_conn = xns.request_connection_blocking(benchmark_target::api::SERVER_NAME_BENCHMARK).expect("BENCHMARK: can't connect to COM");
@ -130,7 +130,7 @@ fn shell_main() -> ! {
// actual benchmark
// get a scalar message
if true {
if false {
// measured at 1479.2 iterations per second in this loop (hardware); 55/s (hosted)
// xous v0.8
@ -139,14 +139,20 @@ fn shell_main() -> ! {
count = benchmark_target::test_scalar(target_conn, count).expect("BENCHMARK: couldn't send test message");
check_count = check_count + 1;
} else {
// works on hosted mode, 35/s (hosted)
// measured at 762.6 iterations per second (hardware)
if false {
// works on hosted mode, 35/s (hosted)
// measured at 762.6 iterations per second (hardware)
// xous v0.8
// 9,928 per 10s = 992.8/s (hardware)
// 243 per 10s = 24.3/s (hosted)
count = benchmark_target::test_memory(target_conn, count).expect("BENCHMARK: couldn't send test message");
check_count = check_count + 1;
// xous v0.8
// 9,928 per 10s = 992.8/s (hardware)
// 243 per 10s = 24.3/s (hosted)
count = benchmark_target::test_memory(target_conn, count).expect("BENCHMARK: couldn't send test message");
check_count = check_count + 1;
} else {
// simple send benchmark, instead of lend
count = benchmark_target::test_memory_send(target_conn, count).expect("BENCHMARK: couldn't send test message");
check_count = check_count + 1;
}
}
if update_result {

View file

@ -110,7 +110,7 @@ fn try_main() -> Result<(), DynError> {
Some("renode-test") => renode_image(false, &cbtest_pkgs)?,
Some("renode-aes-test") => renode_image(false, &aestest_pkgs)?,
Some("renode-image-debug") => renode_image(true, &hw_pkgs)?,
Some("run") => run(false, &hw_pkgs)?,
Some("run") => run(false, &benchmark_pkgs)?,
Some("hw-image") => build_hw_image(false, env::args().nth(2), &hw_pkgs, None)?,
Some("benchmark") => build_hw_image(false, env::args().nth(2), &benchmark_pkgs, None)?,
Some("minimal") => build_hw_image(false, env::args().nth(2), &minimal_pkgs, None)?,