2007-11-10から1日間の記事一覧

空きメモリ量の取得

空きメモリ量を取得する際にはvm_statistics構造体を用いる。 #include <mach/vm_statistics.h> struct vm_statistics { integer_t free_count; integer_t active_count; integer_t inactive_count; integer_t wire_count; integer_t zero_fill_count; integer_t reactivations; in</mach/vm_statistics.h>…

総メモリ量を取得

次のhost_basic_info構造体を用いる。 #include <mach/host_info.h> struct host_basic_info { integer_t max_cpus; integer_t avail_cpus; vm_size_t memory_size; cpu_type_t cpu_type; cpu_subtype_t cpu_subtype; }; 前エントリのhost_info関数をflavorをHOST_BASIC_INFOに</mach/host_info.h>…

Load Average を取得

Load averageはhost_load_info構造体のaverun[]というメンバーに格納される。avenrunには5,15,60秒間でのload averageが格納されている。 #include <mach/host_info.h> #define CPU_STATE_USER 0 #define CPU_STATE_SYSTEM 1 #define CPU_STATE_IDLE 2 struct host_load_info {</mach/host_info.h>…

Macのシステムコール

Mac OS XでPOSIX以外のシステムコールについての情報が中々無かったので、ここに文書化しておく。http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/ このページといくつかのオープソースのソースコードを参考にした。