{"id":1134,"date":"2006-04-26T21:08:42","date_gmt":"2006-04-26T12:08:42","guid":{"rendered":"http:\/\/yasu2.prosou.nu\/blog\/index.php\/2006\/04\/26\/macos_x\/"},"modified":"2006-04-26T21:08:42","modified_gmt":"2006-04-26T12:08:42","slug":"macos_x","status":"publish","type":"post","link":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/2006\/04\/26\/1134\/","title":{"rendered":"MacOS X \u3067\u7a7a\u304d\u30e1\u30e2\u30ea\u5bb9\u91cf\u3092\u53d6\u5f97"},"content":{"rendered":"<p>MacOS X \u306e top \u3068\u304b\u3067\u8868\u793a\u3055\u308c\u308b\u7a7a\u304d\u30e1\u30e2\u30ea\u5bb9\u91cf\u3092\u3001\u81ea\u5206\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u304b\u3089\u30b7\u30b9\u30c6\u30e0\u30b3\u30fc\u30eb\u3068\u304b\u4f7f\u3063\u3066\u53d6\u5f97\u3057\u305f\u3044\u306a\u30fc\u3001\u3068\u601d\u3063\u3066\u305f\u306e\u3060\u3051\u308c\u3069\u3001\u3069\u3046\u3082 sysctl \u3067\u306f\u30c0\u30e1\u3089\u3057\u3044\u3002\u3067\u3001\u3044\u308d\u3093\u306a\u30d5\u30ea\u30fc\u306e\u30c4\u30fc\u30eb\u306e\u30bd\u30fc\u30b9\u3092\u8aad\u3093\u3060\u308a\u3057\u3066\u3073\u3073\u3063\u3068\u304d\u305f\u306e\u304c host_statistics() \u3068\u3044\u3046\u3084\u3064\u3060\u3002Mach \u306e\u30b7\u30b9\u30c6\u30e0\u30b3\u30fc\u30eb\u3089\u3057\u3044\u3002<\/p>\n<p>\n\u76f4\u63a5\u53c2\u8003\u306b\u306a\u3063\u305f\u306e\u306f<a href=\"http:\/\/lists.apple.com\/archives\/darwin-development\/2004\/Jul\/msg00051.html\">\u3053\u308c<\/a>\u3002\u30e6\u30fc\u30b6\u30e9\u30f3\u30c9\u306f BSD \u3060\u3051\u3069\u3001\u30ab\u30fc\u30cd\u30eb\u306f Mach \u306a\u3093\u3060\u3088\u306a\u30fc\u3001\u306a\u308b\u307b\u3069\u306a\u30fc\u3001\u3068\u3044\u3046\u611f\u3058\u3060\u3002<\/p>\n<p>\nC \u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u3059\u308b\u3068\u3053\u3093\u306a\u611f\u3058\u3002<\/p>\n<pre>\n#include &lt;stdio.h&gt;\n#include &lt;mach\/mach_init.h&gt;\n#include &lt;mach\/host_info.h&gt;\n#include &lt;mach\/mach_host.h&gt;\nint main(){\nvm_statistics_data_t page_info;\nvm_size_t pagesize;\nmach_msg_type_number_t count;\nkern_return_t kret;\npagesize = 0;\nkret = host_page_size (mach_host_self(), &pagesize);\ncount = HOST_VM_INFO_COUNT;\nkret = host_statistics (mach_host_self(), HOST_VM_INFO,\n(host_info_t)&page_info, &count);\nif (kret == KERN_SUCCESS){\nunsigned int pw, pa, pi, pf;\npw = page_info.wire_count*pagesize;\npa = page_info.active_count*pagesize;\npi = page_info.inactive_count*pagesize;\npf = page_info.free_count*pagesize;\nprintf(\"wired %d\\n\", pw);\nprintf(\"active %d\\n\", pa);\nprintf(\"inactive %d\\n\", pi);\nprintf(\"free %d\\n\", pf);\n}\nreturn 0;\n}\n<\/pre>\n<p>\u5b9f\u884c\u3059\u308c\u3070\u3053\u3046\u3060\u3002<\/p>\n<pre>\n% .\/a.out\nwired 136630272\nactive 330928128\ninactive 348598272\nfree 526020608\n<\/pre>\n<p>\u3081\u3067\u305f\u3044\u3002FreeBSD \u3067\u306f sysctl \u3067\u3044\u3051\u308b\u3093\u3060\u3051\u3069\u3001Linux \u306f procfs \u307f\u308b\u3057\u304b\u306a\u3044\u306e\u304b\u306a?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MacOS X \u306e top \u3068\u304b\u3067\u8868\u793a\u3055\u308c\u308b\u7a7a\u304d\u30e1\u30e2\u30ea\u5bb9\u91cf\u3092\u3001\u81ea\u5206\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u304b\u3089\u30b7\u30b9\u30c6\u30e0\u30b3\u30fc\u30eb\u3068\u304b\u4f7f\u3063\u3066\u53d6\u5f97\u3057\u305f\u3044\u306a\u30fc\u3001\u3068\u601d\u3063\u3066\u305f\u306e\u3060\u3051\u308c\u3069\u3001\u3069\u3046\u3082 sysctl \u3067\u306f\u30c0\u30e1\u3089\u3057\u3044\u3002\u3067\u3001\u3044\u308d\u3093\u306a\u30d5\u30ea\u30fc\u306e\u30c4\u30fc\u30eb\u306e\u30bd\u30fc\u30b9\u3092\u8aad &hellip; <a href=\"https:\/\/yasu2.prosou.nu\/blog\/index.php\/2006\/04\/26\/1134\/\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;MacOS X \u3067\u7a7a\u304d\u30e1\u30e2\u30ea\u5bb9\u91cf\u3092\u53d6\u5f97&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[9,6],"tags":[],"class_list":["post-1134","post","type-post","status-publish","format-standard","hentry","category-mac","category-unix-"],"_links":{"self":[{"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=1134"}],"version-history":[{"count":0,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1134\/revisions"}],"wp:attachment":[{"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=1134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=1134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=1134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}