Skip to content

Commit

Permalink
add time tracing logs
Browse files Browse the repository at this point in the history
Signed-off-by: xixi <[email protected]>
  • Loading branch information
Hexilee committed Oct 28, 2021
1 parent 8f6b2cb commit 197ed5d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/fs/tikv_fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,12 @@ impl TiFs {
{
match f(self, txn).await {
Ok(v) => {
let commit_start = SystemTime::now();
txn.commit().await?;
trace!("transaction committed");
debug!(
"transaction committed in {} ms",
commit_start.elapsed().unwrap().as_millis()
);
Ok(v)
}
Err(e) => {
Expand Down
6 changes: 6 additions & 0 deletions src/fs/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ impl Txn {
}

pub async fn write_data(&mut self, ino: u64, start: u64, data: Bytes) -> Result<usize> {
let write_start = SystemTime::now();
debug!("write data at ({})[{}]", ino, start);
let meta = self.read_meta().await?.unwrap();
self.check_space_left(&meta)?;
Expand Down Expand Up @@ -440,6 +441,11 @@ impl Txn {
inode.set_size(inode.size.max(target), self.block_size);
self.save_inode(&inode).await?;
trace!("write data: {}", String::from_utf8_lossy(&data));
debug!(
"write {} bytes in {}ms",
data.len(),
write_start.elapsed().unwrap().as_millis()
);
Ok(size)
}

Expand Down

0 comments on commit 197ed5d

Please sign in to comment.