forked from M-Labs/artiq
firmware: move packet dumps to the DEBUG log level.
This commit is contained in:
parent
e8c093deb3
commit
4f94709e9f
|
@ -13,9 +13,9 @@ use log_buffer::LogBuffer;
|
||||||
use board::{Console, clock};
|
use board::{Console, clock};
|
||||||
|
|
||||||
pub struct BufferLogger {
|
pub struct BufferLogger {
|
||||||
buffer: RefCell<LogBuffer<&'static mut [u8]>>,
|
buffer: RefCell<LogBuffer<&'static mut [u8]>>,
|
||||||
filter: RefCell<Option<MaxLogLevelFilter>>,
|
filter: RefCell<Option<MaxLogLevelFilter>>,
|
||||||
trace_to_uart: Cell<bool>
|
concise_uart: Cell<bool>
|
||||||
}
|
}
|
||||||
|
|
||||||
static mut LOGGER: *const BufferLogger = 0 as *const _;
|
static mut LOGGER: *const BufferLogger = 0 as *const _;
|
||||||
|
@ -25,7 +25,7 @@ impl BufferLogger {
|
||||||
BufferLogger {
|
BufferLogger {
|
||||||
buffer: RefCell::new(LogBuffer::new(buffer)),
|
buffer: RefCell::new(LogBuffer::new(buffer)),
|
||||||
filter: RefCell::new(None),
|
filter: RefCell::new(None),
|
||||||
trace_to_uart: Cell::new(true)
|
concise_uart: Cell::new(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,11 +68,11 @@ impl BufferLogger {
|
||||||
.set(max_level)
|
.set(max_level)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn disable_trace_to_uart(&self) {
|
pub fn enable_concise_uart(&self) {
|
||||||
if self.trace_to_uart.get() {
|
if self.concise_uart.get() {
|
||||||
trace!("disabling tracing to UART; all further trace messages \
|
trace!("disabling tracing to UART; all further trace messages \
|
||||||
are sent to core log only");
|
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
|
// Printing to UART is really slow, so avoid doing that when we have an alternative
|
||||||
// route to retrieve the debug messages.
|
// 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}({}): {}",
|
writeln!(Console, "[{:12}us] {:>5}({}): {}",
|
||||||
clock::get_us(), record.level(),
|
clock::get_us(), record.level(),
|
||||||
record.target(), record.args()).unwrap();
|
record.target(), record.args()).unwrap();
|
||||||
|
|
|
@ -75,7 +75,7 @@ pub fn recv_return(reader: &mut Read, tag_bytes: &[u8], data: *mut (),
|
||||||
alloc: &Fn(usize) -> io::Result<*mut ()>) -> io::Result<()> {
|
alloc: &Fn(usize) -> io::Result<*mut ()>) -> io::Result<()> {
|
||||||
let mut it = TagIterator::new(tag_bytes);
|
let mut it = TagIterator::new(tag_bytes);
|
||||||
#[cfg(feature = "log")]
|
#[cfg(feature = "log")]
|
||||||
trace!("recv ...->{}", it);
|
debug!("recv ...->{}", it);
|
||||||
|
|
||||||
let tag = it.next().expect("truncated tag");
|
let tag = it.next().expect("truncated tag");
|
||||||
let mut data = data;
|
let mut data = data;
|
||||||
|
@ -163,7 +163,7 @@ pub fn send_args(writer: &mut Write, service: u32, tag_bytes: &[u8],
|
||||||
#[cfg(feature = "log")]
|
#[cfg(feature = "log")]
|
||||||
{
|
{
|
||||||
let return_it = TagIterator::new(return_tag_bytes);
|
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)?;
|
writer.write_u32(service)?;
|
||||||
|
|
|
@ -54,7 +54,7 @@ fn worker(stream: &mut TcpStream) -> io::Result<()> {
|
||||||
log_channel: csr::CONFIG_RTIO_LOG_CHANNEL as u8,
|
log_channel: csr::CONFIG_RTIO_LOG_CHANNEL as u8,
|
||||||
dds_onehot_sel: true // kept for backward compatibility of analyzer dumps
|
dds_onehot_sel: true // kept for backward compatibility of analyzer dumps
|
||||||
};
|
};
|
||||||
trace!("{:?}", header);
|
debug!("{:?}", header);
|
||||||
|
|
||||||
header.write_to(stream)?;
|
header.write_to(stream)?;
|
||||||
if wraparound {
|
if wraparound {
|
||||||
|
|
|
@ -115,21 +115,21 @@ fn check_magic(stream: &mut TcpStream) -> io::Result<()> {
|
||||||
fn host_read(stream: &mut TcpStream) -> io::Result<host::Request> {
|
fn host_read(stream: &mut TcpStream) -> io::Result<host::Request> {
|
||||||
let request = host::Request::read_from(stream)?;
|
let request = host::Request::read_from(stream)?;
|
||||||
match &request {
|
match &request {
|
||||||
&host::Request::LoadKernel(_) => trace!("comm<-host LoadLibrary(...)"),
|
&host::Request::LoadKernel(_) => debug!("comm<-host LoadLibrary(...)"),
|
||||||
_ => trace!("comm<-host {:?}", request)
|
_ => debug!("comm<-host {:?}", request)
|
||||||
}
|
}
|
||||||
Ok(request)
|
Ok(request)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn host_write(stream: &mut Write, reply: host::Reply) -> io::Result<()> {
|
fn host_write(stream: &mut Write, reply: host::Reply) -> io::Result<()> {
|
||||||
trace!("comm->host {:?}", reply);
|
debug!("comm->host {:?}", reply);
|
||||||
reply.write_to(stream)
|
reply.write_to(stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn kern_send(io: &Io, request: &kern::Message) -> io::Result<()> {
|
fn kern_send(io: &Io, request: &kern::Message) -> io::Result<()> {
|
||||||
match request {
|
match request {
|
||||||
&kern::LoadRequest(_) => trace!("comm->kern LoadRequest(...)"),
|
&kern::LoadRequest(_) => debug!("comm->kern LoadRequest(...)"),
|
||||||
_ => trace!("comm->kern {:?}", request)
|
_ => debug!("comm->kern {:?}", request)
|
||||||
}
|
}
|
||||||
unsafe { mailbox::send(request as *const _ as usize) }
|
unsafe { mailbox::send(request as *const _ as usize) }
|
||||||
io.until(mailbox::acknowledged)
|
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) {
|
fn kern_recv_dotrace(reply: &kern::Message) {
|
||||||
match reply {
|
match reply {
|
||||||
&kern::Log(_) => trace!("comm<-kern Log(...)"),
|
&kern::Log(_) => debug!("comm<-kern Log(...)"),
|
||||||
&kern::LogSlice(_) => trace!("comm<-kern LogSlice(...)"),
|
&kern::LogSlice(_) => debug!("comm<-kern LogSlice(...)"),
|
||||||
_ => trace!("comm<-kern {:?}", reply)
|
_ => debug!("comm<-kern {:?}", reply)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ fn process_host_message(io: &Io,
|
||||||
// artiq_corelog
|
// artiq_corelog
|
||||||
host::Request::Log => {
|
host::Request::Log => {
|
||||||
// Logging the packet with the log is inadvisable
|
// Logging the packet with the log is inadvisable
|
||||||
trace!("comm->host Log(...)");
|
debug!("comm->host Log(...)");
|
||||||
BufferLogger::with_instance(|logger| {
|
BufferLogger::with_instance(|logger| {
|
||||||
logger.extract(|log| {
|
logger.extract(|log| {
|
||||||
host::Reply::Log(log).write_to(stream)
|
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,
|
fn process_kern_queued_rpc(stream: &mut TcpStream,
|
||||||
_session: &mut Session) -> io::Result<()> {
|
_session: &mut Session) -> io::Result<()> {
|
||||||
rpc_queue::dequeue(|slice| {
|
rpc_queue::dequeue(|slice| {
|
||||||
trace!("comm<-kern (async RPC)");
|
debug!("comm<-kern (async RPC)");
|
||||||
let length = NetworkEndian::read_u32(slice) as usize;
|
let length = NetworkEndian::read_u32(slice) as usize;
|
||||||
host_write(stream, host::Reply::RpcRequest { async: true })?;
|
host_write(stream, host::Reply::RpcRequest { async: true })?;
|
||||||
trace!("{:?}" ,&slice[4..][..length]);
|
debug!("{:?}", &slice[4..][..length]);
|
||||||
stream.write(&slice[4..][..length])?;
|
stream.write(&slice[4..][..length])?;
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
|
@ -670,7 +670,7 @@ pub fn thread(io: Io) {
|
||||||
listener.listen(1381).expect("session: cannot listen");
|
listener.listen(1381).expect("session: cannot listen");
|
||||||
info!("accepting network sessions");
|
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()));
|
let congress = Urc::new(RefCell::new(Congress::new()));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue