If I enumerate all the processes and add up all the Get­Gui­Resources, why doesn’t it match the GR_GLOBAL value?

Raymond Chen

A customer was calling Get­Gui­Resources for each process and adding up the results and comparing that with just calling Get­Gui­Resources once with GR_GLOBAL. They found that the values didn’t match. What’s going on?

If you are doing this with the *_PEAK values, then it’s to be expected that adding the individual peaks will not match the global peak. After all, it’s almost certainly not the case that all of the processes reached their peak at the same time. Adding up the individual peaks will overshoot the global peak.

Time Objects
Process 1 Process 2 Global
t = 1 100 10 110
t = 2 50 50 100
Peak 100 50 110

On the other hand, if you add up the instantaneous counts, you will probably come up with a total less than the global value. That’s because there are some objects which are considered owned by the system itself and not any specific process. Examples include objects on the clipboard, stock objects, and certain types of bitmaps. Those system-owned objects count toward the global value but are not charged to any process.

0 comments

Discussion is closed.

Feedback usabilla icon