2 little rtems asks, please...

sashti srinivasan svasn_rtems at yahoo.com
Fri Mar 5 12:09:47 UTC 2004


> 1. Looking to the hello world sample, what is the
> aim of the final
> configuration comments? Is this a remember? Is that
> importante?
   Are They comments? I suppose they are not.  The
confdefs.h in the end makes extensive use of the
#defines just above it.
> 2. Which is the best way to measure the time of an
> operation?
>  Suppose you want to measure the execution time of
> the clock_gettime() function.
    I am also anxiously waiting for time measurement. 
The functions(docs about which I never saw)
Read_timer, Timer_initialize have been used
extensively in the examples.  I posted my problems on
these and gettimeofday() to the list.  If you get some
solution, share with me.
 
> I have the following two ways. Does one is better
> than the other?
> 
> REM: I didn't execute my RTEMS programs yet, because
> I have to
> prepare the floppy disk first. But could you give
> some tips about
> the way to measure functions execution time? Is
> these good ways to do that?
> 
> WAY 1:
> ...
> void diff_timespec(
>   struct timespec *start,
>   struct timespec *stop,
>   struct timespec *result
> )
> {
>    int nsecs_per_sec = 1000000000;
> 
>    result->tv_sec = stop->tv_sec - start->tv_sec;
>    if ( stop->tv_nsec < start->tv_nsec ) {
>       result->tv_nsec = nsecs_per_sec -
> start->tv_nsec + stop->tv_nsec;
>       result->tv_sec--;
>    } else
>       result->tv_nsec = stop->tv_nsec -
> start->tv_nsec;
> 
> }
> ...
>   int status;
>   struct timespec start;
>   struct timespec current;
>   struct timespec difference;
>   struct timespec resolution;
> 
>   status = clock_gettime( CLOCK_REALTIME, &start );
>   assert( !status );
> 
>   int nResp = clock_getres(CLOCK_REALTIME,
> &resolution);
> 
>   status = clock_gettime( CLOCK_REALTIME, &current
> );
>   assert( !status );
> 
>   diff_timespec( &start, &current, &difference );
> 
> 
> WAY 2:
> 
>  timer_create(...)
>  status = clock_gettime( CLOCK_REALTIME, &start );
>  timer_gettime(...)
> 
> 
> 
> REM: It is very important for me that the technique
> be POSIX compliant.
> 
> 
> Any advices?
> 
> Thanks a lot.
> 
> 
> Alex
>
___________________________________________________________________________________________
> IOL Flash. A net normal em versao acelerada.
> Precisa de uma caixa de correio maior? Com o IOL
> Flash pode ter uma caixa com 21MB de espaco.
> Saiba mais sobre o IOL Flash:
> http://www.iol.pt/central_utilizador/iol_flash/
> 


__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com



More information about the users mailing list