{"id":109630,"date":"2024-04-09T07:00:00","date_gmt":"2024-04-09T14:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=109630"},"modified":"2024-04-06T08:44:06","modified_gmt":"2024-04-06T15:44:06","slug":"20240409-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20240409-00\/?p=109630","title":{"rendered":"If I enumerate all the processes and add up all the <CODE>Get&shy;Gui&shy;Resources<\/CODE>, why doesn&#8217;t it match the <CODE>GR_<WBR>GLOBAL<\/CODE> value?"},"content":{"rendered":"<p>A customer was calling <code>Get\u00adGui\u00adResources<\/code> for each process and adding up the results and comparing that with just calling <code>Get\u00adGui\u00adResources<\/code> once with <code>GR_<wbr \/>GLOBAL<\/code>. They found that the values didn&#8217;t match. What&#8217;s going on?<\/p>\n<p>If you are doing this with the <code>*_PEAK<\/code> values, then it&#8217;s to be expected that adding the individual peaks will not match the global peak. After all, it&#8217;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.<\/p>\n<table class=\"cp3\" style=\"border-collapse: collapse;\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n<tbody>\n<tr>\n<th rowspan=\"2\">Time<\/th>\n<th colspan=\"3\">Objects<\/th>\n<\/tr>\n<tr>\n<th>Process 1<\/th>\n<th>Process 2<\/th>\n<th>Global<\/th>\n<\/tr>\n<tr>\n<td>t = 1<\/td>\n<td align=\"right\">100<\/td>\n<td align=\"right\">10<\/td>\n<td align=\"right\">110<\/td>\n<\/tr>\n<tr>\n<td>t = 2<\/td>\n<td align=\"right\">50<\/td>\n<td align=\"right\">50<\/td>\n<td align=\"right\">100<\/td>\n<\/tr>\n<tr>\n<th>Peak<\/th>\n<td align=\"right\">100<\/td>\n<td align=\"right\">50<\/td>\n<td align=\"right\">110<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>On the other hand, if you add up the instantaneous counts, you will probably come up with a total <i>less<\/i> than the global value. That&#8217;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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are some things that aren&#8217;t charged to processes.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-109630","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>There are some things that aren&#8217;t charged to processes.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/109630","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=109630"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/109630\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=109630"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=109630"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=109630"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}