Skip to content

Commit

Permalink
Record: Allow to configure Perf Events based on Model
Browse files Browse the repository at this point in the history
Also, fix a bug in the default Intel PMU config for Backend Stalls.
  • Loading branch information
janaknat committed Dec 6, 2023
1 parent ce4ee5e commit ed4ea07
Show file tree
Hide file tree
Showing 8 changed files with 308 additions and 53 deletions.
78 changes: 46 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ strum_macros = "0.24"
sysctl = "*"
perf-event2 = "0.7.1"
num_cpus = "1.0"
raw-cpuid = "10.6.0"
libc = "0.2"
flate2 = "1.0.26"
tar = "0.4.38"
infer = "0.13.0"
bincode = "1.3.3"
inferno = "0.11.15"
indexmap = "2.1.0"
cfg-if = "0.1"
14 changes: 10 additions & 4 deletions src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ pub mod constants;
pub mod cpu_utilization;
pub mod diskstats;
pub mod flamegraphs;
#[cfg(target_arch = "aarch64")]
pub mod grv_perf_events;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub mod intel_perf_events;
cfg_if::cfg_if! {
if #[cfg(target_arch = "aarch64")] {
pub mod grv_perf_events;
} else if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
pub mod intel_perf_events;
pub mod intel_icelake_perf_events;
pub mod intel_sapphire_rapids_perf_events;
}
}
pub mod interrupts;
pub mod kernel_config;
pub mod meminfodata;
Expand All @@ -15,6 +20,7 @@ pub mod perf_stat;
pub mod processes;
pub mod sysctldata;
pub mod systeminfo;
pub mod utils;
pub mod vmstat;

use crate::visualizer::{GetData, ReportParams};
Expand Down
40 changes: 40 additions & 0 deletions src/data/intel_icelake_perf_events.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
use crate::data::perf_stat::{NamedCtr, NamedTypeCtr, PerfType};

static CYCLES: NamedTypeCtr = NamedTypeCtr {
perf_type: PerfType::RAW,
name: "Cycles",
config: 0x3c,
};
static SLOTS: NamedTypeCtr = NamedTypeCtr {
perf_type: PerfType::RAW,
name: "Slots",
config: 0x01a4,
};
static STALL_FRONTEND: NamedTypeCtr = NamedTypeCtr {
perf_type: PerfType::RAW,
name: "Frontend-Stalls",
config: 0x500019c,
};
static STALL_BACKEND: NamedTypeCtr = NamedTypeCtr {
perf_type: PerfType::RAW,
name: "Backend-Stalls",
config: 0x02a4,
};

lazy_static! {
pub static ref ICX_CTRS: Vec<NamedCtr<'static>> = [
NamedCtr {
name: "stall-frontend-pkc",
nrs: vec![STALL_FRONTEND],
drs: vec![CYCLES],
scale: 1000
},
NamedCtr {
name: "stall-backend-pkc",
nrs: vec![STALL_BACKEND],
drs: vec![SLOTS],
scale: 1000
},
]
.to_vec();
}
2 changes: 1 addition & 1 deletion src/data/intel_perf_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static L1_INSTRUCTIONS: NamedTypeCtr = NamedTypeCtr {
static BACKEND_STALLS: NamedTypeCtr = NamedTypeCtr {
perf_type: PerfType::RAW,
name: "Backend-Stalls",
config: 0x10a2,
config: 0x01a2,
};
static L3: NamedTypeCtr = NamedTypeCtr {
perf_type: PerfType::RAW,
Expand Down
Loading

0 comments on commit ed4ea07

Please sign in to comment.