.net - How to calculate memory usage as Task Manager does? -


ok using wmi (.net/c#) collect data specific process running on machine. data through win32_perfformatteddata_perfproc_process class. class has lot of properties interested in follows:

  uint64 pagefilebytes; 

value, in bytes, process has used in paging file(s). paging files store pages of memory used process not contained in other files. paging files shared processes , lack of space in paging files can prevent other processes allocating memory.

  uint32 poolnonpagedbytes; 

value, in bytes, in nonpaged pool, area of system memory (physical memory used operating system) objects cannot written disk, must remain in physical memory long allocated. poolnonpagedbytes in win32_perfformatteddata_perfos_memory calculated differently poolpagedbytes property in win32_perfformatteddata_perfproc_process, might not equal total of poolpagedbytes instances of win32_perfformatteddata_perfproc_process. property displays last observed value only; not average.

  uint32 poolpagedbytes; 

value, in bytes, in paged pool, area of system memory (physical memory used operating system) objects can written disk when not being used. poolnonpagedbytes property in win32_perfformatteddata_perfos_memory calculated differently poolpagedbytes property in win32_perfformatteddata_perfproc_process, might not equal total of poolpagedbytes instances of win32_perfformatteddata_perfproc_process. property displays last observed value only; not average.

  uint64 privatebytes; 

current value, in bytes, process has allocated cannot shared other processes.

  uint64 virtualbytes; 

current size, in bytes, of virtual address space process using. use of virtual address space not imply corresponding use of either disk or main memory pages. virtual space finite and, using much, process can limit ability load libraries.

  uint64 workingset; 

maximum number, in bytes, in working set of process @ point in time. working set set of memory pages touched threads in process. if free memory in computer above threshold, pages left in working set of process if not in use. when free memory falls below threshold, pages trimmed working sets. if required, soft-faulted working set before leave main memory.

i using workingset field report process' memory usage. not align task manger showing. tried privatebytes that's not "correct" too. process app monitors .net process (if matters @ all) , gets reported app use @ least 100mbs more memory task manager showing @ same time.

so question "formula" calculate best approximation of process' memory usage shown task manager?

enter image description here

win32_perfformatteddata_perfproc_process correct class. property pulls workingsetprivate. no formula/calculation needed.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -