From: Ricardo Menotti on
Dear all,

How can I count de exact number of cycles spent by processor during a
very small code execution?

I'm using an EDB9315A with ARM920T processor running Linux 2.6

Thanks in advance,
From: FreeRTOS info on
"Ricardo Menotti" <menotti(a)gmail.com> wrote in message
news:097f5689-58b0-454d-be69-b257f605ca10(a)k39g2000yqe.googlegroups.com...
> Dear all,
>
> How can I count de exact number of cycles spent by processor during a
> very small code execution?
>
> I'm using an EDB9315A with ARM920T processor running Linux 2.6
>
> Thanks in advance,

It would depend on how small the code is. If it is small enough then you
can count it by hand, using the ARM reference manual to get the number of
cycles per instruction. If the code is longer then you could run it in a
simulator and have the simulator count the instructions for you.

--
Regards,
Richard.

+ http://www.FreeRTOS.org
Designed for Microcontrollers. More than 7000 downloads per month.

+ http://www.SafeRTOS.com
Certified by T�V as meeting the requirements for safety related systems



From: Chris Stratton on
On Sep 9, 10:21 am, "FreeRTOS info" <noem...(a)mentioned.com> wrote:

> > How can I count de exact number of cycles spent by processor during a
> > very small code execution?
>
> > I'm using an EDB9315A with ARM920T processor running Linux 2.6
>
> > Thanks in advance,
>
> It would depend on how small the code is.  If it is small enough then you
> can count it by hand, using the ARM reference manual to get the number of
> cycles per instruction.  If the code is longer then you could run it in a
> simulator and have the simulator count the instructions for you.

Additionally some processors have cycles counters that can be used for
things like this, if they aren't already being used. Keep in mind
that any context switches will through off both the measurement, and
perhaps the point of even taking a measurement. And once you get into
the possibility of cache hits/misses, etc... you are talking more
average numbers than specific ones.
From: FreeRTOS info on
"Chris Stratton" <cs07024(a)gmail.com> wrote in message
news:dbce54cf-ffce-46a2-bc52-4c459fe41359(a)a7g2000yqo.googlegroups.com...
On Sep 9, 10:21 am, "FreeRTOS info" <noem...(a)mentioned.com> wrote:

>> > How can I count de exact number of cycles spent by processor during a
>> > very small code execution?
>>
>> > I'm using an EDB9315A with ARM920T processor running Linux 2.6
>>
>> > Thanks in advance,
>>
>> It would depend on how small the code is. If it is small enough then you
>> can count it by hand, using the ARM reference manual to get the number of
>> cycles per instruction. If the code is longer then you could run it in a
>> simulator and have the simulator count the instructions for you.

>Additionally some processors have cycles counters that can be used for
>things like this, if they aren't already being used. Keep in mind
>that any context switches will through off both the measurement, and
>perhaps the point of even taking a measurement. And once you get into
>the possibility of cache hits/misses, etc... you are talking more
>average numbers than specific ones.

....assuming interrupts are disabled, otherwise you are not actually
measuring the subject code itself.

--
Regards,
Richard.

+ http://www.FreeRTOS.org
Designed for Microcontrollers. More than 7000 downloads per month.

+ http://www.SafeRTOS.com
Certified by T�V as meeting the requirements for safety related systems



From: Chris Stratton on
On Sep 9, 11:06 am, "FreeRTOS info" <noem...(a)mentioned.com> wrote:
> "Chris Stratton" <cs07...(a)gmail.com> wrote in message
>
> news:dbce54cf-ffce-46a2-bc52-4c459fe41359(a)a7g2000yqo.googlegroups.com...
> On Sep 9, 10:21 am, "FreeRTOS info" <noem...(a)mentioned.com> wrote:
>
>
>
> >> > How can I count de exact number of cycles spent by processor during a
> >> > very small code execution?
>
> >> > I'm using an EDB9315A with ARM920T processor running Linux 2.6
>
> >> > Thanks in advance,
>
> >> It would depend on how small the code is. If it is small enough then you
> >> can count it by hand, using the ARM reference manual to get the number of
> >> cycles per instruction. If the code is longer then you could run it in a
> >> simulator and have the simulator count the instructions for you.
> >Additionally some processors have cycles counters that can be used for
> >things like this, if they aren't already being used.   Keep in mind
> >that any context switches will through off both the measurement, and
> >perhaps the point of even taking a measurement.  And once you get into
> >the possibility of cache hits/misses, etc... you are talking more
> >average numbers than specific ones.
>
> ...assuming interrupts are disabled, otherwise you are not actually
> measuring the subject code itself.

I do believe I said something about the effect of context switches on
both the measurement and the utility of taking a measurement...