I used this for measure the time execution in c++:
struct timeval t1, t2;
gettimeofday(&t1, NULL);
gettimeofday(&t2, NULL);
int milliSeconds = (t2.tv_sec - t1.tv_sec) * 1000 + (t2.tv_usec - t1.tv_usec)/1000;
But I want to measure also the cpu / memory consumption. How can I do this?
getrusage()
, it's much better to know how much your specific process took instead of total real time.