#include <sys/time.h>
=====================
struct timeval tv1, tv2;
gettimeofday(&tv1, NULL);
//put c statements here
gettimeofday(&tv2, NULL);
printf ("Total time = %lld microseconds\n", ((long long)tv2.tv_sec*(long long)1000000+(long long)tv2.tv_usec) - ((long long)tv1.tv_sec*(long long)1000000+(long long)tv1.tv_usec));
No comments:
Post a Comment