use gettimeofday
{
timeval t;
gettimeofday(&t,0);
return (double)(t.tv_sec)+(double)(t.tv_usec)/1000000.0;
}
use asm(CPU가 2.8GHz라면..)
double gettime()
{
unsigned long long time;
__asm__ volatile("rdtsc" : "=A" (time));
return time / 2.8e9;
}
'thoughts > Programming' 카테고리의 다른 글
스도쿠 (0) | 2009.01.09 |
---|