Rohit Nair
09/28/2011 3:24 PM
post89124
|
Hello,
I am seeing some weird behavior when I run ClockCycles tightly in a loop. ClockCycles should always return increasing
values, but sometimes it returns a value that's less than the previously returned value.
For example -
ThreadCtl(_NTO_TCTL_RUNMASK,(int*) 0x1);
perror(NULL);
start = ClockCycles();
while(1)
{
stop = ClockCycles();
if(start > stop)
{
diff = start - stop;
printf("??? start-%llu, stop-%llu,diff-%llu, iteration - %d\n",start,stop,diff,iter);
break;
}
start = stop;
iter++;
}
The iteration at which it happens is widely random. Ranging from 50 to 30000.
Could this be because of a wrong setup in init_qtime.c inside startup code ?
|
|
|
Andrew Sherk
|
Re: ClockCycles Misbehaving
|
Andrew Sherk
09/28/2011 3:27 PM
post89125
|
Re: ClockCycles Misbehaving
Are you running a SMP system (>1 CPU or core)? Pidin info output will
confirm.
Andy
On 11-09-28 3:24 PM, "Rohit Nair" <community-noreply@qnx.com> wrote:
>Hello,
>
>I am seeing some weird behavior when I run ClockCycles tightly in a loop.
>ClockCycles should always return increasing values, but sometimes it
>returns a value that's less than the previously returned value.
>
>For example -
>
> ThreadCtl(_NTO_TCTL_RUNMASK,(int*) 0x1);
> perror(NULL);
>
> start = ClockCycles();
> while(1)
> {
> stop = ClockCycles();
>
> if(start > stop)
> {
> diff = start - stop;
> printf("??? start-%llu, stop-%llu,diff-%llu, iteration -
>%d\n",start,stop,diff,iter);
> break;
> }
> start = stop;
> iter++;
> }
>
>
>The iteration at which it happens is widely random. Ranging from 50 to
>30000.
>
>Could this be because of a wrong setup in init_qtime.c inside startup
>code ?
>
>
>
>
>_______________________________________________
>
>OSTech
>http://community.qnx.com/sf/go/post89124
>
|
|
|
Sunil Kittur(deleted)
|
Re: ClockCycles Misbehaving
|
Sunil Kittur(deleted)
09/28/2011 3:36 PM
post89126
|
Re: ClockCycles Misbehaving
What cpu/board is this running on?
Rohit Nair wrote:
> Hello,
>
> I am seeing some weird behavior when I run ClockCycles tightly in a loop. ClockCycles should always return increasing
values, but sometimes it returns a value that's less than the previously returned value.
>
> For example -
>
> ThreadCtl(_NTO_TCTL_RUNMASK,(int*) 0x1);
> perror(NULL);
>
> start = ClockCycles();
> while(1)
> {
> stop = ClockCycles();
>
> if(start > stop)
> {
> diff = start - stop;
> printf("??? start-%llu, stop-%llu,diff-%llu, iteration - %d\n",start,stop,diff,iter);
> break;
> }
> start = stop;
> iter++;
> }
>
>
> The iteration at which it happens is widely random. Ranging from 50 to 30000.
>
> Could this be because of a wrong setup in init_qtime.c inside startup code ?
>
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post89124
>
|
|
|
Elena Laskavaia
|
Re: ClockCycles Misbehaving
|
Elena Laskavaia
09/28/2011 3:45 PM
post89127
|
Re: ClockCycles Misbehaving
Either you have 2 or more processors or it just simply wrapping (3 minutes wrapping time on mips)
On 09/28/2011 03:24 PM, Rohit Nair wrote:
> Hello,
>
> I am seeing some weird behavior when I run ClockCycles tightly in a loop. ClockCycles should always return increasing
values, but sometimes it returns a value that's less than the previously returned value.
>
> For example -
>
> ThreadCtl(_NTO_TCTL_RUNMASK,(int*) 0x1);
> perror(NULL);
>
> start = ClockCycles();
> while(1)
> {
> stop = ClockCycles();
>
> if(start > stop)
> {
> diff = start - stop;
> printf("??? start-%llu, stop-%llu,diff-%llu, iteration - %d\n",start,stop,diff,iter);
> break;
> }
> start = stop;
> iter++;
> }
>
>
> The iteration at which it happens is widely random. Ranging from 50 to 30000.
>
> Could this be because of a wrong setup in init_qtime.c inside startup code ?
>
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post89124
>
|
|
|
Rohit Nair
|
Re: ClockCycles Misbehaving
|
Rohit Nair
09/28/2011 3:50 PM
post89128
|
Re: ClockCycles Misbehaving
But shouldn't the ThreadCtl call fix affinity to CPU0 ?
|
|
|
Andrew Sherk
|
Re: ClockCycles Misbehaving
|
Andrew Sherk
09/28/2011 4:12 PM
post89131
|
Re: ClockCycles Misbehaving
What is the return value of ThreadCtl() call? I wonder if it failed?
Does the strange behaviour persist when starting the process with on -C0
to fix to CPU0?
e.g.
# on -C0 ./testapp
Andy
On 11-09-28 3:50 PM, "Rohit Nair" <community-noreply@qnx.com> wrote:
>But shouldn't the ThreadCtl call fix affinity to CPU0 ?
>
>
>
>
>_______________________________________________
>
>OSTech
>http://community.qnx.com/sf/go/post89128
>
|
|
|
Rohit Nair
|
Re: ClockCycles Misbehaving
|
Rohit Nair
09/28/2011 4:19 PM
post89132
|
Re: ClockCycles Misbehaving
ThreadCtl returns 0. The behavior persists even if I start with 'on -C0'.
> What is the return value of ThreadCtl() call? I wonder if it failed?
>
> Does the strange behaviour persist when starting the process with on -C0
> to fix to CPU0?
> e.g.
>
> # on -C0 ./testapp
>
> Andy
>
> On 11-09-28 3:50 PM, "Rohit Nair" <community-noreply@qnx.com> wrote:
>
> >But shouldn't the ThreadCtl call fix affinity to CPU0 ?
> >
> >
> >
> >
> >_______________________________________________
> >
> >OSTech
> >http://community.qnx.com/sf/go/post89128
> >
|
|
|
Lichun Zhu
|
RE: ClockCycles Misbehaving
|
Lichun Zhu
09/28/2011 3:52 PM
post89129
|
RE: ClockCycles Misbehaving
It's already bind to the first CPU.
-----Original Message-----
From: Elena Laskavaia [mailto:community-noreply@qnx.com]
Sent: Wednesday, September 28, 2011 3:45 PM
To: ostech-core_os
Subject: Re: ClockCycles Misbehaving
Either you have 2 or more processors or it just simply wrapping (3 minutes wrapping time on mips)
On 09/28/2011 03:24 PM, Rohit Nair wrote:
> Hello,
>
> I am seeing some weird behavior when I run ClockCycles tightly in a loop. ClockCycles should always return increasing
values, but sometimes it returns a value that's less than the previously returned value.
>
> For example -
>
> ThreadCtl(_NTO_TCTL_RUNMASK,(int*) 0x1);
> perror(NULL);
>
> start = ClockCycles();
> while(1)
> {
> stop = ClockCycles();
>
> if(start > stop)
> {
> diff = start - stop;
> printf("??? start-%llu, stop-%llu,diff-%llu, iteration - %d\n",start,stop,diff,iter);
> break;
> }
> start = stop;
> iter++;
> }
>
>
> The iteration at which it happens is widely random. Ranging from 50 to 30000.
>
> Could this be because of a wrong setup in init_qtime.c inside startup code ?
>
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post89124
>
_______________________________________________
OSTech
http://community.qnx.com/sf/go/post89127
|
|
|
Mario Charest
|
RE: ClockCycles Misbehaving
|
Mario Charest
09/28/2011 6:41 PM
post89136
|
RE: ClockCycles Misbehaving
Of What type are the variables start and stop?
> -----Message d'origine-----
> De : Rohit Nair [mailto:community-noreply@qnx.com]
> Envoyé : 28 septembre 2011 15:24
> À : ostech-core_os
> Objet : ClockCycles Misbehaving
>
> Hello,
>
> I am seeing some weird behavior when I run ClockCycles tightly in a loop.
> ClockCycles should always return increasing values, but sometimes it returns
> a value that's less than the previously returned value.
>
> For example -
>
> ThreadCtl(_NTO_TCTL_RUNMASK,(int*) 0x1);
> perror(NULL);
>
> start = ClockCycles();
> while(1)
> {
> stop = ClockCycles();
>
> if(start > stop)
> {
> diff = start - stop;
> printf("??? start-%llu, stop-%llu,diff-%llu, iteration -
> %d\n",start,stop,diff,iter);
> break;
> }
> start = stop;
> iter++;
> }
>
>
> The iteration at which it happens is widely random. Ranging from 50 to
> 30000.
>
> Could this be because of a wrong setup in init_qtime.c inside startup code ?
>
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post89124
>
|
|
|
Rohit Nair
|
Re: RE: ClockCycles Misbehaving
|
Rohit Nair
09/28/2011 7:23 PM
post89137
|
Re: RE: ClockCycles Misbehaving
It's uint64_t.
>
> Of What type are the variables start and stop?
>
> > -----Message d'origine-----
> > De : Rohit Nair [mailto:community-noreply@qnx.com]
> > Envoyé : 28 septembre 2011 15:24
> > À : ostech-core_os
> > Objet : ClockCycles Misbehaving
> >
> > Hello,
> >
> > I am seeing some weird behavior when I run ClockCycles tightly in a loop.
> > ClockCycles should always return increasing values, but sometimes it returns
>
> > a value that's less than the previously returned value.
> >
> > For example -
> >
> > ThreadCtl(_NTO_TCTL_RUNMASK,(int*) 0x1);
> > perror(NULL);
> >
> > start = ClockCycles();
> > while(1)
> > {
> > stop = ClockCycles();
> >
> > if(start > stop)
> > {
> > diff = start - stop;
> > printf("??? start-%llu, stop-%llu,diff-%llu, iteration -
> > %d\n",start,stop,diff,iter);
> > break;
> > }
> > start = stop;
> > iter++;
> > }
> >
> >
> > The iteration at which it happens is widely random. Ranging from 50 to
> > 30000.
> >
> > Could this be because of a wrong setup in init_qtime.c inside startup code ?
>
> >
> >
> >
> >
> > _______________________________________________
> >
> > OSTech
> > http://community.qnx.com/sf/go/post89124
> >
|
|
|
Elena Laskavaia
|
Re: ClockCycles Misbehaving
|
Elena Laskavaia
09/28/2011 11:19 PM
post89140
|
Re: ClockCycles Misbehaving
So why do you think it is not wrapping around? (what cpu type is that?)
On 28/09/2011 7:23 PM, Rohit Nair wrote:
> It's uint64_t.
>> Of What type are the variables start and stop?
>>
>>> -----Message d'origine-----
>>> De : Rohit Nair [mailto:community-noreply@qnx.com]
>>> Envoyé : 28 septembre 2011 15:24
>>> À : ostech-core_os
>>> Objet : ClockCycles Misbehaving
>>>
>>> Hello,
>>>
>>> I am seeing some weird behavior when I run ClockCycles tightly in a loop.
>>> ClockCycles should always return increasing values, but sometimes it returns
>>> a value that's less than the previously returned value.
>>>
>>> For example -
>>>
>>> ThreadCtl(_NTO_TCTL_RUNMASK,(int*) 0x1);
>>> perror(NULL);
>>>
>>> start = ClockCycles();
>>> while(1)
>>> {
>>> stop = ClockCycles();
>>>
>>> if(start> stop)
>>> {
>>> diff = start - stop;
>>> printf("??? start-%llu, stop-%llu,diff-%llu, iteration -
>>> %d\n",start,stop,diff,iter);
>>> break;
>>> }
>>> start = stop;
>>> iter++;
>>> }
>>>
>>>
>>> The iteration at which it happens is widely random. Ranging from 50 to
>>> 30000.
>>>
>>> Could this be because of a wrong setup in init_qtime.c inside startup code ?
>>>
>>>
>>>
>>> _______________________________________________
>>>
>>> OSTech
>>> http://community.qnx.com/sf/go/post89124
>>>
>
>
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post89137
|
|
|
Michael Tasche
|
Re: ClockCycles Misbehaving
|
Michael Tasche
09/29/2011 5:35 AM
post89145
|
Re: ClockCycles Misbehaving
Hi,
if this is an ARM CPU, you perhaps have bug in the timer_value callout.
On ARM ClockCycles is emulated by the kernel.
We had the same issue on an at91sam6263 board in march 2010.
We fixed the callout and sent the patch to the support portal.
It was tracked under PR#75223.
-Michael
|
|
|
|