25
Oct
Displaying execution time of a program
Related Blog Items
- Using the auto_ptr concept in C++
- What if I forget the [] when deleteing array allocated via new T[n]?
- Why sizeof is an operator, not a function?
- Interrupt latency and its causes
- What is the main difference between C under DOS and C under UNIX?
refer another post for gettimeofday
usage part looks like below
log_time(1);
*block of code*
log_time(2);
#include < sys/time.h > #include < time.h > /* To start timer,event=1; To stop timer,event=2*/ void log_time(int event) { static struct timeval tv_start; struct timeval tv_end; struct timeval *tv; tv = ((event==2)?&tv_end:&tv_start); gettimeofday(tv, NULL); if(event==2) { printf("Time: %ld Seconds %ld Microseconds\n", tv_end.tv_sec - tv_start.tv_sec, tv_end.tv_usec - tv_start.tv_usec); } }
Popularity: 7%
You need to log on to convert this article into PDF
Related Blog Items - Using the auto_ptr concept in C++
- What if I forget the [] when deleteing array allocated via new T[n]?
- Why sizeof is an operator, not a function?
- Interrupt latency and its causes
- What is the main difference between C under DOS and C under UNIX?
Related Blog Items
- Using the auto_ptr concept in C++
- What if I forget the [] when deleteing array allocated via new T[n]?
- Why sizeof is an operator, not a function?
- Interrupt latency and its causes
- What is the main difference between C under DOS and C under UNIX?
good
October 25th, 2006 at 5:19 pm
777423 Blog Verification…
777423…
October 25th, 2006 at 5:22 pm