All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: steve freyder <steve@freyder.net>
Cc: Leandro Bucci <guestleandro11@gmail.com>, xenomai@xenomai.org
Subject: Re: domain switch
Date: Sun, 03 Jan 2021 11:31:34 +0100	[thread overview]
Message-ID: <87zh1qqpkp.fsf@xenomai.org> (raw)
In-Reply-To: <fa5f0b2a-4f92-343c-b00d-0d75ee79a97e@freyder.net>


steve freyder via Xenomai <xenomai@xenomai.org> writes:

> Right.
>
>
> AKA, "mode switch", a switch from "primary mode" to "secondary mode",
> or vice versa.
>
> One place you can find that information is in:
>
> /proc/xenomai/sched/acct
>
> there are two fields MSW, and CSW which count mode/context switches
> per-process. This requires an open, a read loop to locate the desired 
> pid and extract the desired information, then either rewind or
> close/reopen to do it again - all of which will almost surely generate 
> more mode/context switching.
>

If that helps, there is also the option of getting the thread stats by
program, using int cobalt_thread_stat(pid_t pid, struct
cobalt_threadstat *stat), declared in sys/cobalt.h. pid refers to a
thread identifier (as obtained from gettid(2) in the context of the
target thread). It must refer to a Cobalt thread, otherwise the call
would fail with -ESRCH.

The mode switch count is present in the returned information block
(->msw). cobalt_thread_stat() would not cause any mode switch. It can be
called by any thread regardless of its type (i.e. regular or Cobalt).

-- 
Philippe.


  parent reply	other threads:[~2021-01-03 10:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-02 20:54 domain switch Leandro Bucci
2021-01-02 23:06 ` steve freyder
2021-01-03  1:29   ` Leandro Bucci
2021-01-03 10:31   ` Philippe Gerum [this message]
2021-01-03 10:54     ` Leandro Bucci
2021-01-03 11:06       ` Philippe Gerum
2021-01-03 11:20         ` Leandro Bucci
2021-01-03 18:24           ` 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:
  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=87zh1qqpkp.fsf@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=guestleandro11@gmail.com \
    --cc=steve@freyder.net \
    --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.