开发者

Rolling Timer Array for Calculating Averages

开发者 https://www.devze.com 2023-03-13 04:26 出处:网络
Language: C++ Development Environment: Microsoft Visual C++ Libraries Used: MFC Problem: This should be fairly simple, but I can\'t quite wrap my head around it. I\'m attempting to calculate a roll

Language: C++

Development Environment: Microsoft Visual C++

Libraries Used: MFC

Problem: This should be fairly simple, but I can't quite wrap my head around it. I'm attempting to calculate a rolling average over a given amount of time - let's say five seconds. Every second, my program receives a data message containing some numerical information, including the CPU idle time during the process.

I want to be able to show the user an average CPU idle time over a five second period. I was thinking about using just an array and storing a value every five seconds, but I'm not sure how to do the rolling portion. Unless there is some other built-in method for doing rolling calcu开发者_如何学编程lations?


As it turns out, it would actually be better to implement immediate feedback regarding idle percentage, which is much easier to code.

0

精彩评论

暂无评论...
验证码 换一张
取 消