카테고리 없음

안드로이드에서 msec 속도 측정 gettimeofday

cufe 2011. 3. 3. 18:00


#include <sys/time.h>
#include <time.h>

static void print_elapsedTime()
{
    struct timeval tv;
    static long prev;
    long curr;


    gettimeofday(&tv, NULL);
    curr = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
    LOGD("elapsed time (ms) : %d (%d fps)", curr-prev, 1000/(curr-prev));
    prev = curr;
}