我有一个具有以下成员函数的类:
/// 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 …