Jimgreen On Apr 28, 2012, at 19:55, "Gerriet M. Denkmann" <gerriet@mdenkmann.de> wrote:
Reading <http://www.opensource.apple.com/source/top/top-73/libtop.c> I got two questions:
1. static void libtop_p_fw_scan (task_t task, mach_vm_address_t region_base, mach_vm_size_t region_size) { [...] kr = mach_vm_region_recurse(task, &addr, &size, &depth,(vm_region_recurse_info_t)&sinfo, &count); [...] switch (sinfo.share_mode) { case SM_SHARED: case SM_COW: case SM_TRUESHARED: if (sinfo.max_protection & VM_PROT_EXECUTE) { // CODE code += sinfo.pages_resident; tsamp.fw_count++; } else if (sinfo.max_protection & VM_PROT_WRITE) { // DATA data += sinfo.pages_resident; } else { // LINKEDIT linkedit += sinfo.pages_resident; } break; } [...]
But when I look at the results of mach_vm_region_recurse I find that protection/max_protection of: __TEXT is r-x/r-x __DATA, __OBJC have rw-/rwx __LINKEDIT has r--/rwx
So the above code (which checks max_protection) either does make no sense, or I am misunderstanding something.
2. In libtop_update_vm_regions (task_t task, libtop_pinfo_t* pinfo) I see: mach_vm_region(...) case SM_PRIVATE: rprvt += info.private_pages_resident * pagesize; rprvt += info.shared_pages_resident * pagesize;
But looking at the results of mach_vm_region(VM_REGION_TOP_INFO) I see that while private_pages_resident, shared_pages_resident ≤ size, quite often private_pages_resident + shared_pages_resident > size.
Does this code really count rprvt correctly?
Kind regards,
Gerriet.
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/darwin-kernel/jimgreen8%40me.com
This email sent to jimgreen8@me.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com
participants (1)
-
Jimgreen8@me.com