This commit is contained in:
jmb05
2026-11-02 17:26:51 +01:00
parent cdfc5b8d36
commit 11fb03427c
7 changed files with 94 additions and 94 deletions

View File

@@ -97,11 +97,13 @@ impl I915Engine {
let pmu_type = read_number(&format!("{base}/type"))? as u32;
let config = read_config(&format!("{base}/events/{name}"))?;
let mut attr = PerfEventAttr::default();
attr.type_ = pmu_type;
attr.size = size_of::<PerfEventAttr>() as u32;
attr.config = config;
attr.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_TOTAL_TIME_RUNNING;
let attr = PerfEventAttr {
type_: pmu_type,
size: size_of::<PerfEventAttr>() as u32,
config,
read_format: PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_TOTAL_TIME_RUNNING,
..Default::default()
};
// pid = -1 and cpu = -1: system-wide event, if permitted.
let fd = unsafe {
@@ -181,7 +183,7 @@ impl I915UtilizationMonitor {
for (engine, sample) in &mut self.engines {
let new_sample = engine.read().unwrap();
if let Some(last) = sample {
values.push(new_sample.calculate_utilization(&last) as u8);
values.push(new_sample.calculate_utilization(last) as u8);
}
let _ = sample.insert(new_sample);
}