All of
 help / color / mirror / Atom feed
From: Per Oberg <>
To: xenomai <>
Subject: Re: Execution time
Date: Tue, 16 Feb 2021 08:03:22 -0600 (CST)	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

----- Den 16 feb 2021, på kl 12:34, xenomai skrev:

> hi, I'm doing some tests. I'm measuring the execution time of a task. the
> task takes about 10us to complete. But I am noticing that it takes even
> just over 5us at times. I therefore don't have a constant running time.
> It's normal? maybe because the precision is of the order of micro seconds?

It depends on 
 * The task, and it's priority
 * How you are measuring time
 * What hardware you are using
 * What else is happening in the system

If it's a fairly simple task it shouldn't vary to much, but if the task may or may not trigger some extra action. Modern complex CPU's have a lot of features that speeds things up for repetitive code. For example, the time of reading a memory buffer may depend on what was read before. 

If there are other high-priority tasks going on, or perhaps a hardware interrupt coming in your tasks execution may be delayed. 

Time measurement may differ depending on what functions you use. Some call the Linux clock, some use Xenomai based clocks.

Depending on the hardware you may or may not be able to control exactly what is happening in your system. This is strictly from memory, but SMI interrupts on the PC platform is one such thing that is out of your hands. Raspberry Pi is another can of worms if I recall correctly. Firstly, ARM has regular interrupts and fast interrupts and I am not sure where Xenomai makes the cut. Then there is the broadcom chip of the RPi that I think has some handling of the USB that you don't have control over. 

Per Öberg 

  reply	other threads:[~2021-02-16 14:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 11:34 Execution time Leandro Bucci
2021-02-16 14:03 ` Per Oberg [this message]
2021-02-16 14:24   ` Leandro Bucci
2021-03-03 14:45 Leandro Bucci
2021-03-08 10:23 ` Jan Kiszka
2021-03-08 10:35   ` Leandro Bucci

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.