[英]How to get a process' memory and time usage?
I'm trying to get a process's memory and time usage,and here is [my code] but the memory reported is so much for such a simple app consuming almost 8500Kb. 我正在尝试获取进程的内存和时间使用情况,这是[我的代码],但是对于这样一个消耗近8500Kb的简单应用程序,报告的内存是如此之大。 Has something I've done reported the wrong memory usage or are there other reasons? 我有做过的事情报告了错误的内存使用情况,还是还有其他原因?
#include "trace.h"
#include "include.h"
#include "trace.cpp"
using namespace std;
int main(int argc, const char * argv[])
{
trace t;
t.SetLimitInfo();
t.CreateProcess();
t.waitForChild();
cout<<"time usage: "<<t.getTime()<<"ms memory usage: "<<t.GetMemory()<<"kb"<<endl;
// insert code here...
// std::cout << "Hello, World!\n";
return 0;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.