* [Xenomai-help] accessing context switch counter from rttask
@ 2007-06-26 15:01 ` Gsellmann Peter
2007-06-26 15:39 ` Jan Kiszka
0 siblings, 1 reply; 3+ messages in thread
From: Gsellmann Peter @ 2007-06-26 15:01 UTC (permalink / raw)
To: xenomai
Hi!
I searched for a while and found this snippet
RT_TASK *rt = rt_task_self();
int x = rt->thread_base.stat.csw;
should give the number of context switches, but:
RT_TASK in non-kernel mode is only RT_TASK_PLACEHOLDER so i have no
access to thread_base!
Is there an official way to get this info (w/o opening
"/proc/xenomai/...")?
TIA,
Peter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xenomai-help] accessing context switch counter from rttask
2007-06-26 15:01 ` Gsellmann Peter
@ 2007-06-26 15:39 ` Jan Kiszka
2007-07-08 12:00 ` Jan Kiszka
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2007-06-26 15:39 UTC (permalink / raw)
To: Gsellmann Peter; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 666 bytes --]
Gsellmann Peter wrote:
> Hi!
>
> I searched for a while and found this snippet
>
> RT_TASK *rt = rt_task_self();
> int x = rt->thread_base.stat.csw;
>
> should give the number of context switches, but:
> RT_TASK in non-kernel mode is only RT_TASK_PLACEHOLDER so i have no
> access to thread_base!
>
> Is there an official way to get this info (w/o opening
> "/proc/xenomai/...")?
>
Not yet. You could extend RT_TASK_INFO with this statistic (obtained via
rt_task_inquire). There is currently work in progress to add accumulated
execution times to the same interface, so this extension would fit quite
well. Patches always welcome.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xenomai-help] accessing context switch counter from rttask
2007-06-26 15:39 ` Jan Kiszka
@ 2007-07-08 12:00 ` Jan Kiszka
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2007-07-08 12:00 UTC (permalink / raw)
To: Gsellmann Peter; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 1156 bytes --]
Jan Kiszka wrote:
> Gsellmann Peter wrote:
>> Hi!
>>
>> I searched for a while and found this snippet
>>
>> RT_TASK *rt = rt_task_self();
>> int x = rt->thread_base.stat.csw;
>>
>> should give the number of context switches, but:
>> RT_TASK in non-kernel mode is only RT_TASK_PLACEHOLDER so i have no
>> access to thread_base!
>>
>> Is there an official way to get this info (w/o opening
>> "/proc/xenomai/...")?
>>
>
> Not yet. You could extend RT_TASK_INFO with this statistic (obtained via
> rt_task_inquire). There is currently work in progress to add accumulated
> execution times to the same interface, so this extension would fit quite
> well. Patches always welcome.
Meanwhile, I added this feature to my experimental patch stack while
integrating some other new stats. See
http://www.rts.uni-hannover.de/rtaddon/patches/xenomai/
against Xenomai SVN trunk, namely
http://www.rts.uni-hannover.de/rtaddon/patches/xenomai/enhance-thread-stats.patch
Just call rt_task_inquire() and check RT_TASK_INFO::ctxswitches (there
are modeswitches and pagefaults too as we are already at it).
Feedback welcome!
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-08 12:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-26 15:01 [Xenomai-help] accessing context switch counter from rttask Gsellmann Peter
2007-06-26 15:01 ` Gsellmann Peter
2007-06-26 15:39 ` Jan Kiszka
2007-07-08 12:00 ` Jan Kiszka
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.