- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Guys,
I am new to Programmable counters and i need some advice with handling overflows , i wrote a small kernel module to collect stats for each thread running on the cores and it is working well, i need some advice on how i can handle when the counters overflow.
I see that i can Performance Monitoring Interrupts when the overflow happens , it would be helpful if someone can explain how i use these interrupts to reset the counters the counters to zero once they reach a certain value so i can avoid overflows and get accurate readings
Thanks and Regards,
Ravi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The required approach depends on what you are trying to measure.
If you want measurements by core for any running process, and you can guarantee that the counters cannot increment more than pow(2,48) times between measurements, then you simply disable overflows (by clearing bit 20 in each of the IA32_PERFEVTSEL MSRs) and leave the counters running free. If a measurement looks smaller than a previous measurement, then add pow(2,48) to the difference to correct for the wrap-around.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The required approach depends on what you are trying to measure.
If you want measurements by core for any running process, and you can guarantee that the counters cannot increment more than pow(2,48) times between measurements, then you simply disable overflows (by clearing bit 20 in each of the IA32_PERFEVTSEL MSRs) and leave the counters running free. If a measurement looks smaller than a previous measurement, then add pow(2,48) to the difference to correct for the wrap-around.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you , That helps a lot

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page