Tracing improvements

This commit is contained in:
Pekka Enberg
2024-01-14 15:47:54 +02:00
parent 725eed964b
commit 2bb56ade4b
4 changed files with 8 additions and 4 deletions

View File

@@ -15,7 +15,7 @@ impl DarwinIO {
impl IO for DarwinIO {
fn open_file(&self, path: &str) -> Result<Box<dyn File>> {
trace!("open_file: {}", path);
trace!("open_file(path = {})", path);
let file = std::fs::File::open(path)?;
Ok(Box::new(DarwinFile {
file: RefCell::new(file),

View File

@@ -4,6 +4,7 @@ use std::cell::RefCell;
use std::os::unix::io::AsRawFd;
use std::rc::Rc;
use std::sync::Arc;
use log::trace;
pub struct LinuxIO {
ring: Rc<RefCell<io_uring::IoUring>>,
@@ -20,6 +21,7 @@ impl LinuxIO {
impl IO for LinuxIO {
fn open_file(&self, path: &str) -> Result<Box<dyn File>> {
trace!("open_file(path = {})", path);
let file = std::fs::File::open(path)?;
Ok(Box::new(LinuxFile {
ring: self.ring.clone(),
@@ -28,6 +30,7 @@ impl IO for LinuxIO {
}
fn run_once(&self) -> Result<()> {
trace!("run_once()");
let mut ring = self.ring.borrow_mut();
ring.submit_and_wait(1)?;
let cqe = ring.completion().next().expect("completion queue is empty");
@@ -42,6 +45,7 @@ pub struct LinuxFile {
impl File for LinuxFile {
fn pread(&self, pos: usize, c: Arc<Completion>) -> Result<()> {
trace!("pread(pos = {}, length = {})", pos, c.buf().len());
let fd = io_uring::types::Fd(self.file.as_raw_fd());
let read_e = {
let mut buf = c.buf_mut();

View File

@@ -87,7 +87,7 @@ impl Pager {
}
pub fn read_page(&self, page_idx: usize) -> anyhow::Result<Arc<Page>> {
trace!("read_page: {}", page_idx);
trace!("read_page(page_idx = {})", page_idx);
let handle = self.page_cache.get_or_try_init(page_idx, 1, |_idx| {
let page = Arc::new(Page::new());
page.set_locked();

View File

@@ -142,7 +142,7 @@ pub fn begin_read_btree_page(
page: Arc<Page>,
page_idx: usize,
) -> Result<()> {
trace!("begin_read_btree_page: {}", page_idx);
trace!("begin_read_btree_page(page_idx = {})", page_idx);
let buf = buffer_pool.get();
let drop_fn = Arc::new(move |buf| {
let buffer_pool = buffer_pool.clone();
@@ -161,7 +161,7 @@ pub fn begin_read_btree_page(
}
fn finish_read_btree_page(page_idx: usize, buf: &Buffer, page: Arc<Page>) -> Result<()> {
trace!("finish_read_btree_page: {}", page_idx);
trace!("finish_read_btree_page(page_idx = {})", page_idx);
let mut pos = if page_idx == 1 {
DATABASE_HEADER_SIZE
} else {