{"id":1132,"date":"2006-04-26T22:25:35","date_gmt":"2006-04-26T13:25:35","guid":{"rendered":"http:\/\/yasu2.prosou.nu\/blog\/index.php\/2006\/04\/26\/freebsd_2\/"},"modified":"2006-04-26T22:25:35","modified_gmt":"2006-04-26T13:25:35","slug":"freebsd_2","status":"publish","type":"post","link":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/2006\/04\/26\/1132\/","title":{"rendered":"FreeBSD \u3067\u7a7a\u304d\u30e1\u30e2\u30ea\u5bb9\u91cf\u3092\u53d6\u5f97"},"content":{"rendered":"<p>FreeBSD \u306f sysctl \u3067\u3044\u308d\u3044\u308d\u308f\u304b\u308b\u3002top \u306e\u30bd\u30fc\u30b9 (machine.c) \u3068\u304b\u8aad\u3081\u3070\u7c21\u5358\u3002<\/p>\n<pre>\n#include &lt;sys\/types.h&gt;\n#include &lt;sys\/resource.h&gt;\n#include &lt;sys\/sysctl.h&gt;\n#include &lt;sys\/vmmeter.h&gt;\n#include &lt;stdio.h&gt;\n#include &lt;unistd.h&gt;\n#define UNIT (1024*1024)\nint getsysctl(char* name){\nint mib[4];\nsize_t len = 4;\nint size;\nsysctlnametomib(name, mib, &len);\nif (sysctl(mib, 4, &size, &len, NULL, 0) != -1)\nreturn size;\nreturn 0;\n}\nint main(){\nint pagesize = getpagesize();\nint pa, pi, pw, pc, pf;\npa = getsysctl(\"vm.stats.vm.v_active_count\");\npi = getsysctl(\"vm.stats.vm.v_inactive_count\");\npw = getsysctl(\"vm.stats.vm.v_wire_count\");\npc = getsysctl(\"vm.stats.vm.v_cache_count\");\npf = getsysctl(\"vm.stats.vm.v_free_count\");\nprintf(\"active: %d\\n\",   pa * pagesize \/ UNIT);\nprintf(\"inactive: %d\\n\", pi * pagesize \/ UNIT);\nprintf(\"wired: %d\\n\",    pw * pagesize \/ UNIT);\nprintf(\"cache: %d\\n\",    pc * pagesize \/ UNIT);\nprintf(\"free: %d\\n\",     pf * pagesize \/ UNIT);\nreturn 0;\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>FreeBSD \u306f sysctl \u3067\u3044\u308d\u3044\u308d\u308f\u304b\u308b\u3002top \u306e\u30bd\u30fc\u30b9 (machine.c) \u3068\u304b\u8aad\u3081\u3070\u7c21\u5358\u3002 #include &lt;sys\/types.h&gt; #include &lt;sys\/resource &hellip; <a href=\"https:\/\/yasu2.prosou.nu\/blog\/index.php\/2006\/04\/26\/1132\/\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;FreeBSD \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":[6],"tags":[],"class_list":["post-1132","post","type-post","status-publish","format-standard","hentry","category-unix-"],"_links":{"self":[{"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1132","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=1132"}],"version-history":[{"count":0,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1132\/revisions"}],"wp:attachment":[{"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=1132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=1132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=1132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}