Skip to content

Conversation

@janaknat
Copy link
Contributor

The data from procfs for interrupts is cumulative.

Data for time (t) = data for time (t) - data for time (t-1)

Comment on lines 253 to 260
fn get_prev_cpu_count(prev_data: InterruptLineData, cpu: u64) -> Result<u64> {
for cpu_data in prev_data.per_cpu {
if cpu_data.cpu == cpu {
return Ok(cpu_data.count);
}
}
return Err(PDError::VisualizerInterruptLineCPUCountError(format!("{}", cpu)).into());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not noticeable, but you're making this data collection ~32 times more expensive by having this linear search for CPU on every data point

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you suggest?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not necessarily saying this has to change, but we do have these magical data structures that have O(1) lookups ....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using that mythical data structure now.

src/lib.rs Outdated
#[error("Error getting Vmstat value for {}", .0)]
VisualizerVmstatValueGetError(String),

#[error("Error getting interrupt line coutn for CPU {}", .0)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eagle eye.

The data from procfs for interrupts is cumulative.

Data for time (t) = data for time (t) - data for time (t-1)
@janaknat janaknat merged commit 096baea into main Feb 14, 2023
@janaknat janaknat deleted the interrupt_fix branch February 14, 2023 21:48
aperf-bot pushed a commit that referenced this pull request Oct 13, 2025
* add aperf standard report data format

* modify graph data format, add already processed data handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants