mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
tracer: trim qualified paths
Import the std modules used in the crate instead of spelling the full paths at every use site. Signed-off-by: Henry Hrvoje Tonkovac <htonkovac@gmail.com> Assisted-by: Claude:Opus-4.8
This commit is contained in:
committed by
Rob Bradford
parent
2c22159802
commit
d9f3400aba
@@ -11,6 +11,7 @@ use std::fs::File;
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::sync::atomic::{AtomicU64, Ordering};
|
use std::sync::atomic::{AtomicU64, Ordering};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
use std::thread;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use log::warn;
|
use log::warn;
|
||||||
@@ -57,7 +58,7 @@ impl Tracer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn add_event(&mut self, event: TraceEvent) {
|
fn add_event(&mut self, event: TraceEvent) {
|
||||||
let current = std::thread::current();
|
let current = thread::current();
|
||||||
let thread_name = current.name().unwrap_or("");
|
let thread_name = current.name().unwrap_or("");
|
||||||
let mut events = self.events.lock().unwrap();
|
let mut events = self.events.lock().unwrap();
|
||||||
if let Some(thread_events) = events.get_mut(thread_name) {
|
if let Some(thread_events) = events.get_mut(thread_name) {
|
||||||
@@ -68,7 +69,7 @@ impl Tracer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn increase_thread_depth(&mut self) {
|
fn increase_thread_depth(&mut self) {
|
||||||
let current = std::thread::current();
|
let current = thread::current();
|
||||||
let thread_name = current.name().unwrap_or("");
|
let thread_name = current.name().unwrap_or("");
|
||||||
if let Some(depth) = self.thread_depths.get_mut(thread_name) {
|
if let Some(depth) = self.thread_depths.get_mut(thread_name) {
|
||||||
depth.fetch_add(1, Ordering::SeqCst);
|
depth.fetch_add(1, Ordering::SeqCst);
|
||||||
@@ -79,7 +80,7 @@ impl Tracer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn decrease_thread_depth(&mut self) {
|
fn decrease_thread_depth(&mut self) {
|
||||||
let current = std::thread::current();
|
let current = thread::current();
|
||||||
let thread_name = current.name().unwrap_or("");
|
let thread_name = current.name().unwrap_or("");
|
||||||
if let Some(depth) = self.thread_depths.get_mut(thread_name) {
|
if let Some(depth) = self.thread_depths.get_mut(thread_name) {
|
||||||
depth.fetch_sub(1, Ordering::SeqCst);
|
depth.fetch_sub(1, Ordering::SeqCst);
|
||||||
@@ -89,7 +90,7 @@ impl Tracer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn thread_depth(&self) -> u64 {
|
fn thread_depth(&self) -> u64 {
|
||||||
let current = std::thread::current();
|
let current = thread::current();
|
||||||
let thread_name = current.name().unwrap_or("");
|
let thread_name = current.name().unwrap_or("");
|
||||||
self.thread_depths
|
self.thread_depths
|
||||||
.get(thread_name)
|
.get(thread_name)
|
||||||
|
|||||||
Reference in New Issue
Block a user