All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Leandro Bucci <guestleandro11@gmail.com>
Cc: steve freyder <steve@freyder.net>, xenomai@xenomai.org
Subject: Re: domain switch
Date: Sun, 03 Jan 2021 12:06:37 +0100	[thread overview]
Message-ID: <87v9ceqnya.fsf@xenomai.org> (raw)
In-Reply-To: <CAFZ-hKiOMOk9JZU6cyjV7yaen05VKke=Har-3Xyy_Qh4iEPerw@mail.gmail.com>


Leandro Bucci <guestleandro11@gmail.com> writes:

> is it possible to have the same thing for tasks instead of threads?
>

task == thread

> Il dom 3 gen 2021, 11:31 Philippe Gerum <rpm@xenomai.org> ha scritto:
>
>>
>> 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.
>>


-- 
Philippe.


  reply	other threads:[~2021-01-03 11:06 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
2021-01-03 10:54     ` Leandro Bucci
2021-01-03 11:06       ` Philippe Gerum [this message]
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=87v9ceqnya.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.