[PERF] Runtime Telemetry Hot Path
This commit is contained in:
@@ -5,11 +5,17 @@ pub struct LogService {
|
||||
events: VecDeque<LogEvent>,
|
||||
capacity: usize,
|
||||
next_seq: u64,
|
||||
pub logs_count: u32,
|
||||
}
|
||||
|
||||
impl LogService {
|
||||
pub fn new(capacity: usize) -> Self {
|
||||
Self { events: VecDeque::with_capacity(capacity), capacity, next_seq: 0 }
|
||||
Self {
|
||||
events: VecDeque::with_capacity(capacity),
|
||||
capacity,
|
||||
next_seq: 0,
|
||||
logs_count: 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn log(
|
||||
@@ -34,6 +40,11 @@ impl LogService {
|
||||
msg,
|
||||
});
|
||||
self.next_seq += 1;
|
||||
self.logs_count += 1;
|
||||
}
|
||||
|
||||
pub fn reset_count(&mut self) {
|
||||
self.logs_count = 0;
|
||||
}
|
||||
|
||||
pub fn get_recent(&self, n: usize) -> Vec<LogEvent> {
|
||||
|
||||
Reference in New Issue
Block a user