From: Jan Kiszka <jan.kiszka@domain.hid>
To: "J. Niehaus" <Niehaus@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Detecting switch to secondary mode
Date: Thu, 06 Jul 2006 13:54:02 +0200 [thread overview]
Message-ID: <44ACF9DA.4090203@domain.hid> (raw)
In-Reply-To: <20060706134351.2e582664@domain.hid>
[-- Attachment #1: Type: text/plain, Size: 1824 bytes --]
J. Niehaus wrote:
> Hello,
>
> I have written a xenomai application (posix-skin) with several tasks. All of them should normally use primary mode (SCHED_FIFO). While some are allowed to switch to secondary mode for stuff like I/O and memory allocation others must not switch due to hard realtime constraints.
>
> Is there a way to check if and how often a thread has switched to secondary mode and maybe even what system call caused the switch? While a test from within the program itself would be great some information from /proc/xenomai would also do.
>
Yes, see this example:
http://www.rts.uni-hannover.de/xenomai/lxr/source/ksrc/skins/native/snippets/sigxcpu.c
We have the following code snippet in the signal handler of our RACK
framework:
void signal_handler(int sig)
{
[...]
switch(sig)
{
case SIGXCPU:
if (signal_flags & HANDLING_TERM) // ignore while
cleaning // up
return;
printf("\n");
printf("---=== SIGNAL HANDLER of %s ===---\n", classname);
printf(" -> SIGXCPU (%02d)\n", sig);
printf(" !!! WARNING unexpected switch to secondary mode "
"!!!\n");
nentries = backtrace (array, 10);
strings = backtrace_symbols (array, nentries);
for (i = 0; i < nentries; i++)
{
printf (" %s\n", strings[i]);
}
free (strings);
printf("---=== END OF %s SIGNAL HANDLER ===---\n",
classname);
return;
[...]
I.e. it does a back-trace to show what happened in user-space (debug
symbols are required). It's VERY useful when letting beginners hack
their first RT applications.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
next prev parent reply other threads:[~2006-07-06 11:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-06 11:43 [Xenomai-help] Detecting switch to secondary mode J. Niehaus
2006-07-06 11:54 ` Jan Kiszka [this message]
2006-07-06 11:55 ` Philippe Gerum
2006-07-06 12:04 ` Gilles Chanteperdrix
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=44ACF9DA.4090203@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=Niehaus@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.