Stats on steals
This commit is contained in:
parent
6a23f311e1
commit
cdbd91b13b
6 changed files with 29 additions and 5 deletions
|
|
@ -15,6 +15,7 @@ pub(crate) struct AggregatePeerStatsAtomic {
|
|||
pub seen: AtomicU32,
|
||||
pub dead: AtomicU32,
|
||||
pub not_needed: AtomicU32,
|
||||
pub steals: AtomicU32,
|
||||
}
|
||||
|
||||
impl AggregatePeerStatsAtomic {
|
||||
|
|
@ -40,4 +41,8 @@ impl AggregatePeerStatsAtomic {
|
|||
self.dec(old);
|
||||
self.inc(new);
|
||||
}
|
||||
|
||||
pub fn inc_steals(&self) {
|
||||
atomic_inc(&self.steals);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ pub struct AggregatePeerStats {
|
|||
pub seen: usize,
|
||||
pub dead: usize,
|
||||
pub not_needed: usize,
|
||||
pub steals: usize,
|
||||
}
|
||||
|
||||
impl<'a> From<&'a AggregatePeerStatsAtomic> for AggregatePeerStats {
|
||||
|
|
@ -24,6 +25,7 @@ impl<'a> From<&'a AggregatePeerStatsAtomic> for AggregatePeerStats {
|
|||
seen: s.seen.load(ordering) as usize,
|
||||
dead: s.dead.load(ordering) as usize,
|
||||
not_needed: s.not_needed.load(ordering) as usize,
|
||||
steals: s.steals.load(ordering) as usize,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue