Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
AcctIdx: metric for active bg threads (#20026)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington authored Sep 20, 2021
1 parent 2a42f8a commit bc7983b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions runtime/src/accounts_index_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,13 @@ impl<T: IndexValue> AccountsIndexStorage<T> {
break;
}

storage.stats.active_threads.fetch_add(1, Ordering::Relaxed);
for bucket in &in_mem {
bucket.flush();
}

storage.stats.report_stats();
storage.stats.active_threads.fetch_sub(1, Ordering::Relaxed);
}
}
}
6 changes: 6 additions & 0 deletions runtime/src/bucket_map_holder_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct BucketMapHolderStats {
pub inserts: AtomicU64,
pub count_in_mem: AtomicU64,
pub per_bucket_count: Vec<AtomicU64>,
pub active_threads: AtomicU64,
pub get_range_us: AtomicU64,
last_time: AtomicInterval,
}
Expand Down Expand Up @@ -125,6 +126,11 @@ impl BucketMapHolderStats {
),
("inserts", self.inserts.swap(0, Ordering::Relaxed), i64),
("deletes", self.deletes.swap(0, Ordering::Relaxed), i64),
(
"active_threads",
self.active_threads.load(Ordering::Relaxed),
i64
),
("items", self.items.swap(0, Ordering::Relaxed), i64),
("keys", self.keys.swap(0, Ordering::Relaxed), i64),
);
Expand Down

0 comments on commit bc7983b

Please sign in to comment.