c++ - How to get a process' memory and time usage? -
i'm trying process's memory , time usage,and here [my code] memory reported such simple app consuming 8500kb. has i've done reported wrong memory usage or 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; }
i use valgrind --tool=massif check memory usage.
check the doc
Comments
Post a Comment