On Tuesday, October 1, 2013 2:11:39 PM UTC+2, Dieter Wirz wrote:On Thu, Sep 26, 2013 at 9:36 PM, <ignacio...@gmail.com> 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?
--
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 beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
I am new in ubuntu and eclipse and this is the main problem, i guess :-S
I have a model that i would like to run into BB but i have problems to measure the elapsed time, i tried before with clock(), but looks like it doesn't measure properly the time. For this i am trying with gettimeofday, but i have the problems that i commented previously.
Looks like if eclipse could not link time.h and for this appear these errors. But maybe i am wrong
Really thanks to everybody for your help
--