Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - execution time QNX on TX9DL: (8 Items)
   
execution time QNX on TX9DL  
Hi,

I'm running QNX on Karo TX9DL, i want to get the execution time of my program.

I tried clock() but it don't give a correct number of ticks, and when I use it twice in the program it display un error 
when I execute the program "Illegal instruction" !!

Can you give me other solutions to measure the time execution ?

Thanks,
Re: execution time QNX on TX9DL  
# time ./myProg
RE: execution time QNX on TX9DL  
sounds like there are deeper problems.  If you do a "sleep 10" in your program, and time it with your watch, does it 
actually sleep for 10s?  That will give an indication if the clocks/timers are working.

What result is clock() giving, versus what you expected, for the number of ticks?

If you make a simple program that just calls clock() twice, does it always fails with the Illegal instruction?

________________________________________
From: Djillali Redjradj [community-noreply@qnx.com]
Sent: Friday, June 10, 2016 8:30 AM
To: ostech-core_os
Subject: execution time QNX on TX9DL

Hi,

I'm running QNX on Karo TX9DL, i want to get the execution time of my program.

I tried clock() but it don't give a correct number of ticks, and when I use it twice in the program it display un error 
when I execute the program "Illegal instruction" !!

Can you give me other solutions to measure the time execution ?

Thanks,



_______________________________________________

OSTech
http://community.qnx.com/sf/go/post116395
To cancel your subscription to this discussion, please e-mail ostech-core_os-unsubscribe@community.qnx.com
Re: RE: execution time QNX on TX9DL  
Exactly, I tried sleep before clock() and the time given doesn't change, clock() normaly count the numbers of ticks from
 the start of the program, but here it doesn't change !

Yes if i do clock() another time it give me" Illegal instruction"
RE: RE: execution time QNX on TX9DL  
It wouldn't. clock() returns the amount of time the process spends executing. If the process is sleeping, it's not 
executing and not consuming any time according to clock().

________________________________________
From: Djillali Redjradj [community-noreply@qnx.com]
Sent: June-10-16 8:40 AM
To: ostech-core_os
Subject: Re: RE: execution time QNX on TX9DL

Exactly, I tried sleep before clock() and the time given doesn't change, clock() normaly count the numbers of ticks from
 the start of the program, but here it doesn't change !

Yes if i do clock() another time it give me" Illegal instruction"




_______________________________________________

OSTech
http://community.qnx.com/sf/go/post116398
To cancel your subscription to this discussion, please e-mail ostech-core_os-unsubscribe@community.qnx.com
Re: RE: RE: execution time QNX on TX9DL  
I tried another time to use clock() after calculations in the program but it give me "Illegal instruction" although i 
use it one time
Re: RE: RE: execution time QNX on TX9DL  
Hi, use the clock_getime to read time reference and then use this 
to compute the elapsed time at th end of Your running program loop.
Bye,
Mario


here an example (not tested):

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
double time_elapsed(struct timespec* start)
{
	struct timespec	 	stop;
	double 				f1=0;

	if(-1 != (clock_gettime(TIME_CLOCK_BASE, &stop) ))
	{
		f1 = (((double)start->tv_sec)+(((double)start->tv_nsec)*1e-9)); /* sec */
		f1 =( ((((double)stop.tv_sec)+ (((double)stop.tv_nsec)*1e-9))-f1)* 1000000000L);
	 }
	  return(f1);
}

void myProg(void)
{
 struct timespec 	tTimer;	//! Time stamps
double tEla;

  while(1)
  {
	clock_gettime( TIME_CLOCK_BASE,&tTimer);			/* freeze reference for timestamp */

       /////////////// Any operation .......

       tEla= time_elapsed(&tTimer);    	/* Thread running time  		  */

  };
}
Re: RE: RE: execution time QNX on TX9DL  
Thank you everyone, 

I was using Momentics 5 (SDP 6.6 from the evaluation version) but the QNX of my target is 6.5 (SDP 6.5) so it occur this
 problem, when i used the version of Momentics who comes with the QNX installed on target it works correctly