using time() to measure how long a function takes
Posted
by hap497
on Stack Overflow
See other posts from Stack Overflow
or by hap497
Published on 2010-05-11T06:04:29Z
Indexed on
2010/05/11
6:14 UTC
Read the original article
Hit count: 205
Hi,
I am trying to use time() to measure various points of my program. http://www.cplusplus.com/reference/clibrary/ctime/time/ What I don't understand is why the values in the before and after are Different? I understanding this is not the best way to profile my program, I just want to see how long does something take.
printf ("**MyProgram::before time= %ld\n", time(NULL));
doSomthing();
doSomthingLong();
printf ("**MyProgram::after time= %ld\n", time(NULL));
Thank you.
© Stack Overflow or respective owner