Click to See Complete Forum and Search --> : calc time to execute func
lightyear
May 18th, 2006, 08:32 AM
hi,
can some pls tell me how i can calculate time taken to execute particular function..and then whole application.....
If u can also give example i will appriciate that
lightyear
May 18th, 2006, 08:34 AM
I want to achive this in win 32 application
ovidiucucu
May 18th, 2006, 08:46 AM
I want to achive this in win 32 application
so we....
[ Moved thread ]
ovidiucucu
May 18th, 2006, 08:53 AM
You can call GetTickCount at the begin and the end and make the difference (in milliseconds).
Or, for better than 1 ms resolution, you can use high-resolution performance counter functions (QueryPerformanceFrequency and QueryPerformanceCounter).
See THIS ARTICLE (http://www.codeguru.com/cpp/cpp/date_time/general/article.php/c10333/).
golanshahar
May 18th, 2006, 08:58 AM
You can also look at this FAQ: How do I determine the speed of a particular function or operation? (http://www.codeguru.com/forum/showthread.php?t=291294)
Cheers
dave2k
May 18th, 2006, 09:17 AM
i found the CPrecisionTimer class very helpful in the link above, it gives you the time in seconds
lightyear
May 19th, 2006, 12:53 AM
hi,
thanks for help but i want to run this code on Linux also(sorry).......so if i include <windows.h> as it is using windows api.....will it run on linux/unix.
Can u provide me example of get tick count.
Thanks.
golanshahar
May 19th, 2006, 01:32 AM
hi,
thanks for help but i want to run this code on Linux also(sorry).......so if i include <windows.h> as it is using windows api.....will it run on linux/unix.
Can u provide me example of get tick count.
Thanks.
If you want it to run on Linux why you are asking the question in Win32 api forum? :D anyway you are in the wrong forum my friend.
Cheers
sreehari
May 19th, 2006, 02:27 AM
You could probably use the CTime function (http://www.cplusplus.com/ref/ctime/ctime.html) and implement it the way Ovidiucucu has mentioned in his above post.
lightyear
May 19th, 2006, 10:53 AM
I dont think iam in wrong forum as this also relate common c++ function which can
calulate time taken to execute function
in both windows and linux envoirment.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.