次のメンバー関数を持つクラスがあります。
/// caller pid
virtual pid_t Pid() const = 0;
/// physical memory size in KB
virtual uint64_t Size() const = 0;
/// resident memory for this process
virtual uint64_t Rss() const = 0;
/// cpu used by this process
virtual double PercentCpu() const = 0;
/// memory used by this process
virtual double PercentMemory() const = 0;
/// number of threads in this process
virtual int32_t Lwps() const = 0;
このクラスの義務は、呼び出し元に関するプロセス情報を返すことです。物理メモリサイズは sysctl 呼び出しで簡単に決定でき、pid は些細なことですが、ps または top で popen を呼び出して出力を解析することを除いて、残りの呼び出しは私にはわかりませんでした。これは受け入れられません。どんな助けでも大歓迎です。
要件:
g++ 4.0 でコンパイル
obj-c
OSX 10.5なし