On Tuesday, October 1, 2013 10:08:54 PM UTC+2, [email protected] wrote: > > > > On Tuesday, October 1, 2013 9:38:07 PM UTC+2, [email protected] wrote: >> >> >> >> On Tuesday, October 1, 2013 2:11:39 PM UTC+2, Dieter Wirz wrote: >>> >>> On Thu, Sep 26, 2013 at 9:36 PM, <[email protected]> wrote: >>> > hello, >>> > >>> > I tried several ways ( clock(), gettimeofday()..) but I can get the >>> proper >>> > way to measure the elapsed time in microseconds. >>> > >>> > I am using eclipse to program in ansi c. Could anybody help me about >>> how to >>> > measure the elapsed time in microsecond? Could it be possible to >>> enclosed >>> > the code that I should use? >>> Ansi C or C++ (as in the title)? >>> In Ansi C it might look like this: >>> >>> #include <sys/time.h> >>> #include <stdio.h> >>> // compile with: gcc -Wall gettimeofday.c -o gettimeofday >>> void main() >>> { >>> float elapsed_time; >>> struct timeval start_time, end_time; >>> gettimeofday( &start_time, NULL ); >>> for (;;){ >>> gettimeofday( &end_time, NULL ); >>> elapsed_time = end_time.tv_sec - start_time.tv_sec + ( >>> end_time.tv_usec - start_time.tv_usec ) / 1e6; >>> printf( "sec: %g \r", elapsed_time ); >>> } >>> } >>> >> >> >> >> >> >> hi, Sorry for disturbing you. How can I compile "gcc -Wall >> gettimeofday.c -o gettimeofday " in eclipse under ubuntu? >> >> I got some errors: >> Field "tv_sec" could not be resolved >> Field "tv_usec" could not be resolved >> >> >> Sorry for the inconveniences >> >> Regards >> >
-- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
