Skip to content

Commit ce0c3f9

Browse files
committed
Add perfmon to Stats
1 parent e4d5b4f commit ce0c3f9

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ atomic-traits = "0.2.0"
3333
atomic = "0.4.6"
3434
spin = "0.5.2"
3535
env_logger = "0.8.2"
36+
pfm = "0.0.3"
3637

3738
[dev-dependencies]
3839
crossbeam = "0.7.3"

src/util/statistics/stats.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::collections::HashMap;
66
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
77
use std::sync::Arc;
88
use std::sync::Mutex;
9+
use pfm::Perfmon;
910

1011
pub const MAX_PHASES: usize = 1 << 12;
1112
pub const MAX_COUNTERS: usize = 100;
@@ -37,6 +38,7 @@ impl SharedStats {
3738
pub struct Stats {
3839
gc_count: AtomicUsize,
3940
total_time: Arc<Mutex<Timer>>,
41+
perfmon: Perfmon,
4042

4143
pub shared: Arc<SharedStats>,
4244
counters: Mutex<Vec<Arc<Mutex<dyn Counter + Send>>>>,
@@ -55,9 +57,12 @@ impl Stats {
5557
true,
5658
false,
5759
)));
60+
let mut perfmon: Perfmon = Default::default();
61+
perfmon.initialize().expect("Perfmon failed to initialize");
5862
Stats {
5963
gc_count: AtomicUsize::new(0),
6064
total_time: t.clone(),
65+
perfmon,
6166

6267
shared,
6368
counters: Mutex::new(vec![t]),

0 commit comments

Comments
 (0)