Hi Gilles,

Appreciate your response.

Pl find comments inline.

From: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
To: makarand pradhan <makarand_u_prad...@yahoo.com>
Cc: "xenomai-core@gna.org" <xenomai-core@gna.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              

Xenomai-core mailing list

Reply via email to