* [Xenomai-core] CPU utilization question
@ 2011-10-24 22:19 makarand pradhan
2011-10-25 8:50 ` Gilles Chanteperdrix
0 siblings, 1 reply; 4+ messages in thread
From: makarand pradhan @ 2011-10-24 22:19 UTC (permalink / raw)
To: xenomai@xenomai.org
[-- Attachment #1: Type: text/plain, Size: 1822 bytes --]
Greetings all,
I am working on a real time power pc embedded system which uses xenomai. I am presently noticing a CPU utilization which I am not able to explain. Will highly appreciate your opinion on the problem described below.
I'm summarizing my understanding. Pl feel free to correct me.
I'm using /proc/xenomai/stat to get the CPU util. I'm assuming that the ROOT thread captures the %CPU spent in Linux/secnodary and each xenomai thread listed, captures the %CPU in primary domain. If a thread transitions to the secondary, then I'm assuming that the %util in secondary domain will get accounted against ROOT and the actual % usage in primary will get accounted against the thread.
Problem:
I'm starting a xenomai thread using rt_task_spawn.
rt_task_spawn(&task2, "Task 2 ", STACK_SIZE, 11, 0, task2_func, NULL);
The thread invoking rt_task_spawn, sleeps for a long long time without doing anything, or I can pause it.
sleep(5000000);
The xenomai task does rt_printfs periodically.
With this setup, I was hoping to see 0% CPU util for the linux task in top.
Contrary to this expectation, I notice CPU util as high as 3.1% when I top the linux process:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
7988 root 20 0 4940 4376 3688 S 3.1 0.8 0:01.65 a.out
The CPU % varies based on the activity I do in the primary domain. i.e. more rt_printfs more %CPU in both primary and secondary.
Question:
If the linux process is sleeping, why do I see a CPU util against the process?
Why is the CPU % util vary based on the activity I do in the primary domain?
Thanks for taking the time to look at the question.
Would highly appreciate your inputs.
Warm Rgds,
Makarand.
[-- Attachment #2: Type: text/html, Size: 5803 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Xenomai-core] CPU utilization question
2011-10-24 22:19 [Xenomai-core] CPU utilization question makarand pradhan
@ 2011-10-25 8:50 ` Gilles Chanteperdrix
2011-10-25 14:18 ` makarand pradhan
0 siblings, 1 reply; 4+ messages in thread
From: Gilles Chanteperdrix @ 2011-10-25 8:50 UTC (permalink / raw)
To: makarand pradhan; +Cc: xenomai@xenomai.org
On 10/25/2011 12:19 AM, makarand pradhan wrote:
> (...) I'm
> assuming that the ROOT thread captures the %CPU spent in
> Linux/secnodary and each xenomai thread listed, captures the %CPU in
> primary domain. If a thread transitions to the secondary, then I'm
> assuming that the %util in secondary domain will get accounted
> against ROOT and the actual % usage in primary will get accounted
> against the thread.
You are assuming wrong, the CPU utilization measures the activity of the
linux kernel as a whole, including its idle task. So, the sum of all the
primary mode tasks and of the ROOT task is always 100%.
> Question:
>
> If the linux process is sleeping, why do I see a CPU util against the
> process? Why is the CPU % util vary based on the activity I do in the
> primary domain?
rt_printf is a primary mode service which causes activity in secondary
mode: the actual printf is done by a plain linux task.
--
Gilles.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Xenomai-core] CPU utilization question
2011-10-25 8:50 ` Gilles Chanteperdrix
@ 2011-10-25 14:18 ` makarand pradhan
2011-10-25 15:16 ` Gilles Chanteperdrix
0 siblings, 1 reply; 4+ messages in thread
From: makarand pradhan @ 2011-10-25 14:18 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai@xenomai.org
[-- Attachment #1: Type: text/plain, Size: 2234 bytes --]
Hi Gilles,
Appreciate your response.
Pl find comments inline.
________________________________
From: Gilles Chanteperdrix <gilles.chanteperdrix@domain.hid>
To: makarand pradhan <makarand_u_pradhan@domain.hido.com>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>
Sent: Tuesday, October 25, 2011 4:50 AM
Subject: Re: [Xenomai-core] CPU utilization question
On 10/25/2011 12:19 AM, makarand pradhan wrote:
> (...) I'm
> assuming that the ROOT thread captures the %CPU spent in
> Linux/secnodary and each xenomai thread listed, captures the %CPU in
> primary domain. If a thread transitions to the secondary, then I'm
> assuming that the %util in secondary domain will get accounted
> against ROOT and the actual % usage in primary will get accounted
> against the thread.
You are assuming wrong, the CPU utilization measures the activity of the
linux kernel as a whole, including its idle task. So, the sum of all the
primary mode tasks and of the ROOT task is always 100%.
[MP]: Yes. I've noticed that the sum of all tasks is always 100. My question was specifically about a xenomai task that transitions in secondary.
e.g. Assume a xenomai task that uses a total of 20% CPU. Of this assume that 10% is spent executing system calls in secondary domain and 10% is spent in the primary domain. I believe that from an accounting perspective, 10% would get accounted against ROOT and the xenomai task will show a CPU util of 10%. Is this accurate?
> Question:
>
> If the linux process is sleeping, why do I see a CPU util against the
> process? Why is the CPU % util vary based on the activity I do in the
> primary domain?
rt_printf is a primary mode service which causes activity in secondary
mode: the actual printf is done by a plain linux task.
[MP]: Tx. It helped. I've taken the rt_printfs out and now my Linux process that started the xenomai task shows 0% as expected.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5136 root 20 0 4936 4372 3688 S 0.0 0.8 0:00.04 a.out
Rgds,
Makarand.
--
Gilles.
[-- Attachment #2: Type: text/html, Size: 5304 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Xenomai-core] CPU utilization question
2011-10-25 14:18 ` makarand pradhan
@ 2011-10-25 15:16 ` Gilles Chanteperdrix
0 siblings, 0 replies; 4+ messages in thread
From: Gilles Chanteperdrix @ 2011-10-25 15:16 UTC (permalink / raw)
To: makarand pradhan; +Cc: xenomai@xenomai.org
On 10/25/2011 04:18 PM, makarand pradhan wrote:
> [MP]: Yes. I've noticed that the sum of all tasks is always 100. My
> question was specifically about a xenomai task that transitions in
> secondary.
>
> e.g. Assume a xenomai task that uses a total of 20% CPU. Of this
> assume that 10% is spent executing system calls in secondary domain
> and 10% is spent in the primary domain. I believe that from an
> accounting perspective, 10% would get accounted against ROOT and the
> xenomai task will show a CPU util of 10%. Is this accurate?
Yes.
--
Gilles.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-10-25 15:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-24 22:19 [Xenomai-core] CPU utilization question makarand pradhan
2011-10-25 8:50 ` Gilles Chanteperdrix
2011-10-25 14:18 ` makarand pradhan
2011-10-25 15:16 ` Gilles Chanteperdrix
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.