Reputation: 185
I am trying to write a MAC OSX program to monitor the system (something similar to the activity monitor).I am using vm_statistics64_data_t to get "free_count , active_count, inactive_count" etc.
But I am unable to calculate App memory correctly. I have used
"vm_page_size * vmStats.internal_page_count"
to calculate the app memory but it is not synchronized with activity monitor.
Upvotes: 4
Views: 1213
Reputation: 122
For those who found this question and ask themselves how to calculate the "Cached Files" like in Activity Monitor:
vm_page_size * (vm_stat.external_page_count + vm_stats.purgable_count)
Upvotes: 0
Reputation: 303
It looks like you already have found the answer. Will leave it here for someone who may find this helpful.
To calculate App Memory value consistent with the Activity Monitor you need to:
vm_page_size * (vm_stat.internal_page_count - vm_stat.purgeable_count)
Upvotes: 3