forked from M-Labs/artiq
1
0
Fork 0

firmware: move packet dumps to the DEBUG log level.

This commit is contained in:
whitequark 2017-03-03 06:11:35 +00:00
parent e8c093deb3
commit 4f94709e9f
4 changed files with 23 additions and 23 deletions

View File

@ -15,7 +15,7 @@ use board::{Console, clock};
pub struct BufferLogger {
buffer: RefCell<LogBuffer<&'static mut [u8]>>,
filter: RefCell<Option<MaxLogLevelFilter>>,
trace_to_uart: Cell<bool>
concise_uart: Cell<bool>
}
static mut LOGGER: *const BufferLogger = 0 as *const _;
@ -25,7 +25,7 @@ impl BufferLogger {
BufferLogger {
buffer: RefCell::new(LogBuffer::new(buffer)),
filter: RefCell::new(None),
trace_to_uart: Cell::new(true)
concise_uart: Cell::new(true)
}
}
@ -68,11 +68,11 @@ impl BufferLogger {
.set(max_level)
}
pub fn disable_trace_to_uart(&self) {
if self.trace_to_uart.get() {
pub fn enable_concise_uart(&self) {
if self.concise_uart.get() {
trace!("disabling tracing to UART; all further trace messages \
are sent to core log only");
self.trace_to_uart.set(false)
self.concise_uart.set(false)
}
}
}
@ -103,7 +103,7 @@ impl Log for BufferLogger {
// Printing to UART is really slow, so avoid doing that when we have an alternative
// route to retrieve the debug messages.
if self.trace_to_uart.get() || record.level() <= LogLevel::Info || force_uart {
if self.concise_uart.get() || record.level() <= LogLevel::Info || force_uart {
writeln!(Console, "[{:12}us] {:>5}({}): {}",
clock::get_us(), record.level(),
record.target(), record.args()).unwrap();

View File

@ -75,7 +75,7 @@ pub fn recv_return(reader: &mut Read, tag_bytes: &[u8], data: *mut (),
alloc: &Fn(usize) -> io::Result<*mut ()>) -> io::Result<()> {
let mut it = TagIterator::new(tag_bytes);
#[cfg(feature = "log")]
trace!("recv ...->{}", it);
debug!("recv ...->{}", it);
let tag = it.next().expect("truncated tag");
let mut data = data;
@ -163,7 +163,7 @@ pub fn send_args(writer: &mut Write, service: u32, tag_bytes: &[u8],
#[cfg(feature = "log")]
{
let return_it = TagIterator::new(return_tag_bytes);
trace!("send<{}>({})->{}", service, args_it, return_it);
debug!("send<{}>({})->{}", service, args_it, return_it);
}
writer.write_u32(service)?;

View File

@ -54,7 +54,7 @@ fn worker(stream: &mut TcpStream) -> io::Result<()> {
log_channel: csr::CONFIG_RTIO_LOG_CHANNEL as u8,
dds_onehot_sel: true // kept for backward compatibility of analyzer dumps
};
trace!("{:?}", header);
debug!("{:?}", header);
header.write_to(stream)?;
if wraparound {

View File

@ -115,21 +115,21 @@ fn check_magic(stream: &mut TcpStream) -> io::Result<()> {
fn host_read(stream: &mut TcpStream) -> io::Result<host::Request> {
let request = host::Request::read_from(stream)?;
match &request {
&host::Request::LoadKernel(_) => trace!("comm<-host LoadLibrary(...)"),
_ => trace!("comm<-host {:?}", request)
&host::Request::LoadKernel(_) => debug!("comm<-host LoadLibrary(...)"),
_ => debug!("comm<-host {:?}", request)
}
Ok(request)
}
fn host_write(stream: &mut Write, reply: host::Reply) -> io::Result<()> {
trace!("comm->host {:?}", reply);
debug!("comm->host {:?}", reply);
reply.write_to(stream)
}
fn kern_send(io: &Io, request: &kern::Message) -> io::Result<()> {
match request {
&kern::LoadRequest(_) => trace!("comm->kern LoadRequest(...)"),
_ => trace!("comm->kern {:?}", request)
&kern::LoadRequest(_) => debug!("comm->kern LoadRequest(...)"),
_ => debug!("comm->kern {:?}", request)
}
unsafe { mailbox::send(request as *const _ as usize) }
io.until(mailbox::acknowledged)
@ -148,9 +148,9 @@ fn kern_recv_notrace<R, F>(io: &Io, f: F) -> io::Result<R>
fn kern_recv_dotrace(reply: &kern::Message) {
match reply {
&kern::Log(_) => trace!("comm<-kern Log(...)"),
&kern::LogSlice(_) => trace!("comm<-kern LogSlice(...)"),
_ => trace!("comm<-kern {:?}", reply)
&kern::Log(_) => debug!("comm<-kern Log(...)"),
&kern::LogSlice(_) => debug!("comm<-kern LogSlice(...)"),
_ => debug!("comm<-kern {:?}", reply)
}
}
@ -219,7 +219,7 @@ fn process_host_message(io: &Io,
// artiq_corelog
host::Request::Log => {
// Logging the packet with the log is inadvisable
trace!("comm->host Log(...)");
debug!("comm->host Log(...)");
BufferLogger::with_instance(|logger| {
logger.extract(|log| {
host::Reply::Log(log).write_to(stream)
@ -569,10 +569,10 @@ fn process_kern_message(io: &Io, mut stream: Option<&mut TcpStream>,
fn process_kern_queued_rpc(stream: &mut TcpStream,
_session: &mut Session) -> io::Result<()> {
rpc_queue::dequeue(|slice| {
trace!("comm<-kern (async RPC)");
debug!("comm<-kern (async RPC)");
let length = NetworkEndian::read_u32(slice) as usize;
host_write(stream, host::Reply::RpcRequest { async: true })?;
trace!("{:?}" ,&slice[4..][..length]);
debug!("{:?}", &slice[4..][..length]);
stream.write(&slice[4..][..length])?;
Ok(())
})
@ -670,7 +670,7 @@ pub fn thread(io: Io) {
listener.listen(1381).expect("session: cannot listen");
info!("accepting network sessions");
BufferLogger::with_instance(|logger| logger.disable_trace_to_uart());
BufferLogger::with_instance(|logger| logger.enable_concise_uart());
let congress = Urc::new(RefCell::new(Congress::new()));