Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Small for loop time is not deterministic: (5 Items)
   
Small for loop time is not deterministic  
Hi

I found something strange on my application on my Power PC.

The example is really simple read clockcycles, do a forloop and read clock cycles again.
And after this save min and max. (See attached code).

The question is why this time not is really deterministic?
It does the same thing every time...

Program running at priority 100 and nothing else execute with high priority running on target.

Output from program:
----------------------------------
Min 61
Max 2585
----
Min 61
Max 9533
----
Min 61
Max 3377
----
Min 61
Max 3303
----

My target is a Freescale PowerPC 600Mhz.
Running QNX 6.5.0
And BSP MPC8379RDB

Regards
/Lasse
Attachment: Text TEST_FOR.c 1.06 KB
RE: Small for loop time is not deterministic  
It can be preempted at any point even you are running at prio 100, such
as interrupt.

Lichun

-----Original Message-----
From: Lasse Skov [mailto:community-noreply@qnx.com] 
Sent: Wednesday, October 06, 2010 10:19 AM
To: ostech-core_os
Subject: Small for loop time is not deterministic

Hi

I found something strange on my application on my Power PC.

The example is really simple read clockcycles, do a forloop and read
clock cycles again.
And after this save min and max. (See attached code).

The question is why this time not is really deterministic?
It does the same thing every time...

Program running at priority 100 and nothing else execute with high
priority running on target.

Output from program:
----------------------------------
Min 61
Max 2585
----
Min 61
Max 9533
----
Min 61
Max 3377
----
Min 61
Max 3303
----

My target is a Freescale PowerPC 600Mhz.
Running QNX 6.5.0
And BSP MPC8379RDB

Regards
/Lasse




_______________________________________________

OSTech
http://community.qnx.com/sf/go/post69745
RE: Small for loop time is not deterministic  

> -----Message d'origine-----
> De : Lasse Skov [mailto:community-noreply@qnx.com]
> Envoyé : 6 octobre 2010 10:19
> À : ostech-core_os
> Objet : Small for loop time is not deterministic
> 
> Hi
> 
> I found something strange on my application on my Power PC.
> 
> The example is really simple read clockcycles, do a forloop and read clock
> cycles again.
> And after this save min and max. (See attached code).
> 
> The question is why this time not is really deterministic?
> It does the same thing every time...
> 
> Program running at priority 100 and nothing else execute with high priority
> running on target.
> 
> Output from program:
> ----------------------------------
> Min 61
> Max 2585
> ----
> Min 61
> Max 9533
> ----
> Min 61
> Max 3377
> ----
> Min 61
> Max 3303

Are these value in ClockCyles ( not scaled to ns, us  or ms ?). I would suspect it's caused by interrupts plus effect of
 flush caching etc.  On PowerPC I suspect the value is NOT in clock cycles ( as on x86 ) hence you are measuring with 
less precision, and you loops execute asynchronously to that.
 
> ----
> 
> My target is a Freescale PowerPC 600Mhz.
> Running QNX 6.5.0
> And BSP MPC8379RDB
> 
> Regards
> /Lasse
> 
> 
> 
> 
> _______________________________________________
> 
> OSTech
> http://community.qnx.com/sf/go/post69745
Re: RE: Small for loop time is not deterministic  
> 
> Are these value in ClockCyles ( not scaled to ns, us  or ms ?). I would 
> suspect it's caused by interrupts plus effect of flush caching etc.  On 
> PowerPC I suspect the value is NOT in clock cycles ( as on x86 ) hence you are
>  measuring with less precision, and you loops execute asynchronously to that.

Yes these value is in raw ClockCycles.
Re: RE: Small for loop time is not deterministic  
> > 
> > Are these value in ClockCyles ( not scaled to ns, us  or ms ?). I would 
> > suspect it's caused by interrupts plus effect of flush caching etc.  On 
> > PowerPC I suspect the value is NOT in clock cycles ( as on x86 ) hence you 
> are
> >  measuring with less precision, and you loops execute asynchronously to that
> .
> 
> Yes these value is in raw ClockCycles.

Also not scaled to ns, us... 
But the function not return exact number of clock cycles.
 
SYSPAGE_ENTRY(qtime)->cycles_per_sec return 100000500 on my PPC