On Thu, Jun 25, 2009 at 9:40 AM, Mike Beltzner <beltz...@mozilla.com> wrote:

> On 22-Jun-09, at 12:57 PM, Mike Belshe wrote:
>
>  Yes, that accurately represents the private memory for a process, but it
>> doesn't reflect the user's experience.  Windows generally tracks working
>> set.  Why?  Because the working set is the amount of memory *not available
>> to other apps*.  If other apps can have the memory, then using the bytes is
>> inconsequential.
>>
>
> Figuring out how to track this is a bit of a terminology mess ;) Referring
> to the following document:
>
> http://msdn.microsoft.com/en-us/library/aa965225(VS.85).aspx


Yeah, the APIs all have constraints.  We end up walking the pages and adding
them up.  See process_util_win.cc in the chromium tree.  Be sure to check
about:memory and hover over the little "?" icons to see what we measure.


<http://msdn.microsoft.com/en-us/library/aa965225(VS.85).aspx>
>
> If someone measures the "Private Bytes" counter, which uses the
> PROCESS_MEMORY_COUNTERS_EX.PrivateUsage structure, that seems to map to the
> Task Manager "Commit Size" which isn't the thing I believe we want to
> measure.


Right.


>
>
> The "Working Set - Private" counter doesn't seem to have a structure
> according to the MSDN document; that's what maps to the "Memory (Private
> Working Set)" column in the TaskManager.


Right, I think you have to use QueryWorkingSet, walk the pages and
categorize them yourself.


>
>
> The closest thing I can find is the "Working Set" counter, which uses the
> PROCESS_MEMORY_COUNTERS_EX.WorkingSetSize structure and shows up in the
> Vista Task Manager as "Working Set (Memory)"


For multi-proc browsers like chrome, this will way overstate RAM; there is a
good 5-6MB of shared working set in each process.  So for 10 tabs, you'd
could an extra 50MB for Chrome if you do it this way.

I wish it were easier too.  In Vista's task manager, the primary metric is
"Memory (Private Working Set)", and I believe the only way to get this
number is to call QueryWorkingSet, walk the pages, and add up the ones which
are marked as private.

If you come up with a better way, please let me know!

Mike



>
>
> Would you agree that summating the data from the
> PROCESS_MEMORY_COUNTERS_EX.WorkingSetSize structure would give a fair
> indication of memory usage?
>
> cheers,
> mike
>

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to