All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Tom Z <tomz30@domain.hid>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai-help] 0 CPU time problem
Date: Sat, 05 Nov 2011 14:33:00 +0100	[thread overview]
Message-ID: <4EB53B0C.7060303@domain.hid> (raw)
In-Reply-To: <1320460319.56312.YahooMailNeo@domain.hid>

On 11/05/2011 03:31 AM, Tom Z wrote:
> Hi Gilles,
> 
> > No, CLOCK_PROCESS_CPUTIME is a clock implemented by the Linux
> > kernel, so, it does not see the time spent in primary mode. If the
> > foo function does not suspend, you can use rt_timer_tsc(), but the
> > answer is no, there is currently no way to get the cpu time used
> > when in primary mode.
> 
> Thanks a lot for the explanation. It seems my understanding on how
> Xenomai works was incorrect. I thought that if a task, say,
> myRTTask() is spawned by rt_task_create() and rt_task_start(), then
> myRTTask() will always run in the primary mode, so if myRTTask()
> calls foo(), then foo() will be running in the primary mode all the
> time. The correct fact is, myRTTask() could be running in either the
> primary mode or the secondary mode, right? This arises my another
> question, if foo() uses some third party libraries (with source code
> available), how can I tell what parts of foo() will be running in the
> primary mode, and what parts will be in the secondary mode? Are there
> principles for deciding whether the code is in the primary mode or
> the secondary mode?

Hi, it would be nice if you could quote and wrap mails as is usual on
public mailing lists.

Every Linux system call causes a switch to secondary mode, as well as
every call to a xenomai system call documented as such. For instance, if
you look at rt_queue_create documentation, you see:

Environments:

This service can be called from:

    * Kernel module initialization/cleanup code
    * User-space task (switches to secondary mode)

If you want to detect unwanted mode switches to secondary mode, you can
use rt_task_set_mode with the T_WARNSW bit, as is demonstrated in the
example:
examples/native/sigdebug.c

in xenomai sources tree.

-- 
                                                                Gilles.


  reply	other threads:[~2011-11-05 13:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-04 19:08 [Xenomai-help] 0 CPU time problem Tom Z
2011-11-04 19:21 ` Gilles Chanteperdrix
2011-11-04 21:03   ` Tom Z
2011-11-04 21:36     ` Gilles Chanteperdrix
2011-11-05  2:31       ` Tom Z
2011-11-05 13:33         ` Gilles Chanteperdrix [this message]
2011-11-05 11:27       ` Philippe Gerum

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=4EB53B0C.7060303@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=tomz30@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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.