next up previous
Next: The hacking of printf Up: C++/C Previous: System Macro

timing

    timeval start, end;
    gettimeofday(&start,NULL);
    ...
    gettimeofday(&end,NULL);
    double elapsedSec = ((end.tv_sec * 1000000 + end.tv_usec) -
                         (start.tv_sec * 1000000 + start.tv_usec));
    printf("%f\n",elapsedSec);


Wei Lu 2007-11-06