From mboxrd@z Thu Jan 1 00:00:00 1970 References: <1319494779.40265.YahooMailNeo@domain.hid> <4EA67872.30609@domain.hid> Message-ID: <1319552289.52870.YahooMailNeo@domain.hid> Date: Tue, 25 Oct 2011 07:18:09 -0700 (PDT) From: makarand pradhan In-Reply-To: <4EA67872.30609@domain.hid> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-965286322-45318363-1319552289=:52870" Subject: Re: [Xenomai-core] CPU utilization question Reply-To: makarand pradhan List-Id: Xenomai life and development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gilles Chanteperdrix Cc: "xenomai@xenomai.org" ---965286322-45318363-1319552289=:52870 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hi Gilles,=0A=0AAppreciate your response.=0A=0APl find comments inline.=0A= =0A=0A________________________________=0AFrom: Gilles Chanteperdrix =0ATo: makarand pradhan =0ACc: "xenomai@xenomai.org" =0ASent: Tuesday,= October 25, 2011 4:50 AM=0ASubject: Re: [Xenomai-core] CPU utilization que= stion=0A=0AOn 10/25/2011 12:19 AM, makarand pradhan wrote:=0A> (...) I'm=0A= > assuming that the ROOT thread captures the %CPU spent in=0A> Linux/secnod= ary and each xenomai thread listed, captures the %CPU in=0A> primary domain= . If a thread transitions to the secondary, then I'm=0A> assuming that the = %util in secondary domain will get accounted=0A> against ROOT and the actua= l % usage in primary will get accounted=0A> against the thread.=0A=0AYou ar= e assuming wrong, the CPU utilization measures the activity of the=0Alinux = kernel as a whole, including its idle task. So, the sum of all the=0Aprimar= y mode tasks and of the ROOT task is always 100%.=0A=0A[MP]: Yes. I've noti= ced that the sum of all tasks is always 100. My question was specifically a= bout a xenomai task that transitions in secondary.=0A=0Ae.g. Assume a xenom= ai task that uses a total of 20% CPU. Of this assume that 10% is spent exec= uting system calls in secondary domain and 10% is spent in the primary doma= in. 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 accu= rate?=0A=0A> Question:=0A> =0A> If the linux process is sleeping, why do I = see a CPU util against the=0A> process? Why is the CPU % util vary based on= the activity I do in the=0A> primary domain?=0A=0Art_printf is a primary m= ode service which causes activity in secondary=0Amode: the actual printf is= done by a plain linux task.=0A=0A[MP]: Tx. It helped. I've taken the rt_pr= intfs out and now my Linux process that started the xenomai task shows 0% a= s expected.=0A=0A=A0 PID USER =A0 =A0 =A0PR =A0NI =A0VIRT =A0RES =A0SHR S %= CPU %MEM =A0 =A0TIME+ =A0COMMAND =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0= =0A=A05136 root =A0 =A0 =A020 =A0 0 =A04936 4372 3688 S =A00.0 =A00.8 =A0 0= :00.04 a.out =A0 =A0 =A0 =A0 =A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0=0ARgds,=0AMakarand.=0A= =0A-- =0A=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0 =A0 Gilles. ---965286322-45318363-1319552289=:52870 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Hi Gilles,

Appreciate your response.
Pl find comments inline.


From: Gilles Chanteperdrix= <gilles.chanteperdrix@xenomai.org>
To: makarand pradhan <makarand_u_pradhan@domain.hid>= ;
Cc: "xenomai@xenomai.org= .org" <xenomai@xenomai.org>
Sent: Tuesday, October 25, 2011 4:50 AM
Subject: Re: [Xenomai-core] CPU utilization qu= estion

=0AOn 10/25/2011 12:19 AM, makarand pradhan wrote:
= > (...) I'm
> assuming that the ROOT thread captures the %CPU spen= t in
> Linux/secnodary and each xenomai thread listed, captures the %= CPU in
> primary domain. If a thread transitions to the secondary, th= en I'm
> assuming that the %util in secondary domain will get account= ed
> against ROOT and the actual % usage in primary will get accounte= d
> against the thread.

You are assuming wrong, the CPU utiliz= ation measures the activity of the
linux kernel as a whole, including it= s idle task. So, the sum of all the
primary mode tasks and of the ROOT t= ask is always 100%.

[MP]:= Yes. I've noticed that the sum of all tasks is always 100. My question was specifically about a x= enomai 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 th= e
> 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 &n= bsp;    PR  NI  VIRT  RES  SHR S %CPU %MEM &n= bsp;  TIME+  COMMAND             &n= bsp;                     =                       = ;
 5136 root   &= nbsp;  20   0  4936 4372 3688 S  0.0  0.8 &= nbsp; 0:00.04 a.out                =                      = ;                   

Rgds,
Makarand.

--
&nb= sp;               &n= bsp;       Gilles.


= ---965286322-45318363-1319552289=:52870--