mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
add implemenation of the prune debug call
this allows us to trigger the cache prune manually, instead of in response to memory backpressure only
This commit is contained in:
parent
549e67fead
commit
e25da3a720
3 changed files with 20 additions and 0 deletions
|
|
@ -535,6 +535,7 @@ pub struct PddbDangerousDebug {
|
|||
pub enum DebugRequest {
|
||||
Dump = 0,
|
||||
Remount = 1,
|
||||
Prune = 2,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
|||
|
|
@ -1018,6 +1018,18 @@ impl Pddb {
|
|||
buf.lend(self.conn, Opcode::DangerousDebug.to_u32().unwrap())
|
||||
.or(Err(Error::new(ErrorKind::Other, "Xous internal error"))).map(|_| ())
|
||||
}
|
||||
/// Forces a basis pruning, for testing the pruning and prune recovery code.
|
||||
#[cfg(not(target_os = "xous"))]
|
||||
pub fn dbg_prune(&self) -> Result<()> {
|
||||
let ipc = PddbDangerousDebug {
|
||||
request: DebugRequest::Prune,
|
||||
dump_name: xous_ipc::String::new(),
|
||||
};
|
||||
let buf = Buffer::into_buf(ipc)
|
||||
.or(Err(Error::new(ErrorKind::Other, "Xous internal error")))?;
|
||||
buf.lend(self.conn, Opcode::DangerousDebug.to_u32().unwrap())
|
||||
.or(Err(Error::new(ErrorKind::Other, "Xous internal error"))).map(|_| ())
|
||||
}
|
||||
|
||||
#[cfg(all(feature="pddbtest", feature="autobasis"))]
|
||||
pub fn basis_testing(&self, config: &[Option<bool>; 32]) {
|
||||
|
|
|
|||
|
|
@ -1817,6 +1817,13 @@ fn wrapped_main() -> ! {
|
|||
} else {
|
||||
log::info!("remount failed");
|
||||
}
|
||||
},
|
||||
DebugRequest::Prune => {
|
||||
log::info!("initiating prune");
|
||||
log::set_max_level(log::LevelFilter::Debug);
|
||||
basis_cache.cache_prune(&mut pddb_os, 262144);
|
||||
log::set_max_level(log::LevelFilter::Info);
|
||||
log::info!("prune finished");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue